2 ms·
Nah no single resource, it took me a lot of time to understand monads, going over many resources. Just remember Absolutely ANY design pattern / data structure
by crimsonalucard 9y ago
Nah no single resource, it took me a lot of time to understand monads, going over many resources.
Just remember Absolutely ANY design pattern / data structure can be a monad as long as you can get an internal value out of that abstraction and define a bind operator to compose monads together.
This rule tells it all:
(>>=) :: m a -> (a -> m b) -> m b
m is the abstraction wrapper and a is the internal thing that is wrapped. You can wrap it in a type string, a list. Even like a binary tree can be a monad.
You can define the bind operator to do whatever you want, it just needs to follow the type signature above and be associative.