gt;) :: (FUnctor f) => (a -> b) -> f a -> f b f <gt; x = fmap f x ``` Applicative Style ```haskell (++) <gt; Just "foo" <*> Just "bar" ``` # Monoid Data.Monoid module ```haskell class Monoid m where mempty :: m mappend :: m -> m -> m mconcat :: [m] -> m mconcat = foldr mappend mempty ``` List is monoid. ```haskell interface Monoid [a] where mempty = [] mappend = (++) ``` # Monad ```haskell class Monad m where return :: a -> m a (>>=) :: m a -> (a -> m b) -> m b (>>) :: m a -> m b -> m b x >> y = x >>= \_ -> y fail :: String -> m a fail msg = error msg ``` Maybe is monad. ```haskell interface Monad Maybe where return x = Just x Nothing >>= f = Notiong Just x >>= f = f x fail _ Nothing ```