Monad
Haskell
In Haskell, monads are defined as:
class Monad m where (>>=) :: m a -> ( a -> m b) -> m b (>>) :: m a -> m b -> m b return :: a -> m a
Name | Handles | Signature |
---|---|---|
Result | Errors | Either e a -> (a -> Either e b) -> Either e b |
Maybe | Absent values | Maybe a -> (a -> Maybe b) -> Maybe b |
IO | Pure/Impure separation | IO a -> (a -> IO b) -> IO b |
State | Monadic State | State a -> (a -> State b) -> State b |
Reader | Environment Data | Reader a -> (a -> Reader b) -> Reader b |
Writer | Writer-Only Data | Writer a -> (a -> Writer b) -> Writer b |
Parser | Composing Parsers | Parser a -> (a -> Parser b) -> Parser b |