3 ms·
Monads are a way to model effects -- to mark a computation as using IO (or not), as being parallel (or not), as having exceptions (or not). Monads in Haskell a
by solidsnack9000 8y ago
Monads are a way to model effects -- to mark a computation as using IO (or not), as being parallel (or not), as having exceptions (or not).
Monads in Haskell are used as a mechanism for scheduling evaluation...
This is only partially true. Any language that tries to be fully declarative -- which is to say, that tries to make all effects "part of the value" (and in consequence, part of the type) -- faces the same problems as Haskell. Idris, a strict language, uses monads to model effects.
The C language doesn't make effects part of the type signature, but C program verifiers do add effects modeling. This can be with regards to aliasing (which writes/reads could affect another pointer?), termination or timing.
It's the underlying interest in program verification that drives the use of monads in Haskell, in part because it's program verification that drives the interest in Haskell to begin with.
- egillie 8y agoI can’t upvote this enough. I always wish monads has been described to me this way from the get-go, it would have saved me a lot of time.