|
|
|
|
|
by cleue
1030 days ago
|
|
One of the design aspects is to make a distinction between functions with and without side effects (pure). In a way to tell these apart by looking at the function signature without having to read the function body.
The library uses a function signature without an input but with an output for this purpose. Aside from the trivial case of a constant function, such a signature can only mean that the function has side effects. type IO[A any] func() A If you consider this a valid approach, then the set of monadic helper functions make it easier to compose these effectful functions with pure functions. This article https://betterprogramming.pub/investigating-the-i-o-monad-in... contains some more detailed reasoning. |
|