class Monad m where
return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b
instance Monad IO where ...
Typkonstruktor Liste ist eine Monade:
instance Monad [] where
return x = [x]
xs >>= f = concat $ map f xs
-- Benutzung:
[ 1 .. 3 ] >>= \ x ->
[ 1 .. x ] >>= \ y -> return (x*y)