4 ms·
Understanding monads sufficiently to work in monadic production code requires two things: - Learning the type signatures of all the primitives of the Functor/A
by whateveracct 11y ago
Understanding monads sufficiently to work in monadic production code requires two things:
- Learning the type signatures of all the primitives of the Functor/Applicative/Monad hierarchy.
- Seeing some common monadic types in action. Basically understand how to interpret the "context" of M[A] and the semantics of bind. So Option[A] is a potentially missing A and bind short circuits. Writer[W, A] is an A with some accumulated W and bind accumulates the W. IO[A] is a description of an IO action that, when run, will yield an A and bind will create a new IO action that will use the result to produce a new IO action.