|
|
|
|
|
by sdeframond
1023 days ago
|
|
It make sense in some contexts: it binds the value produced by the monad to a new name. For example, it binds (or "assigns") the value read from a file to the variable x. I agree that `flatMap` is clearer when manipulating lists, which is probably a better first approach than the IO monad. However `flatMap` would sound weird for IO monad, I think. What I find confusing is using the do notation for monads with very different meaning. Code looks the same but it does something totally different! I wonder if putting the Monad interface ("typeclass") front and center in Haskell is such a good idea. Kinda feels like premature abstraction. We should use descriptive names instead of opaque abstractions. ...or maybe I haven't seen the light yet. |
|