| ▲ | floxy 11 hours ago | |
The time-honored way of learning about monads is to write a monad tutorial. Monads provide an order dependency (that along with some hidden strictness for I/O and the like) which allows the side-effecting to be isolated from the "pure" functional side of things. The purely functional Clean language had an explicit "world" variable that you could pass around to whatever side-effecting functions you wanted. And it had uniqueness typing so that you couldn't accidentally refer to the same "world" twice. You can think about monads as being a way to hide the crufty "world". A lot of the mystery around monads comes simultaneously with a whole bunch of other newness in learning Haskell (lazy evaluation, HM type system, differing syntax, algebraic data types, currying and partial application, functional programming, etc.). | ||