The Control.Monad module provides the Functor, Monad and MonadPlus classes, together with some useful operations on monads.
class Functor f where |
The instances of Functor for lists, Data.Maybe.Maybe and System.IO.IO satisfy these laws.
Methods
fmap :: (a -> b) -> f a -> f b |
instance Functor [] |
instance Functor IO |
instance Functor Maybe |
instance Ix i => Functor (Array i) |
class Monad m where |
Minimal complete definition: >>= and return.
Instances of Monad should satisfy the following laws:
Instances of both Monad and Functor should additionally satisfy the law:
The instances of Monad for lists, Data.Maybe.Maybe and System.IO.IO defined in the Prelude satisfy these laws.
Methods
(>>=) :: m a -> (a -> m b) -> m b |
(>>) :: m a -> m b -> m b |
return :: a -> m a |
fail :: String -> m a |
instance Monad [] |
instance Monad IO |
instance Monad Maybe |
class< |