1 -----------------------------------------------------------------------------
3 -- Module : Control.Monad.Instances
4 -- Copyright : (c) The University of Glasgow 2001
5 -- License : BSD-style (see the file libraries/base/LICENSE)
7 -- Maintainer : libraries@haskell.org
8 -- Stability : provisional
9 -- Portability : portable
11 -- 'Functor' and 'Monad' instances for @(->) r@ and
12 -- 'Functor' instances for @(,) a@ and @'Either' a@.
14 module Control.Monad.Instances () where
18 instance Functor ((->) r) where
21 instance Monad ((->) r) where
23 f >>= k = \ r -> k (f r) r
25 instance Functor ((,) a) where
26 fmap f (x,y) = (x, f y)
28 instance Functor (Either a) where
29 fmap _ (Left x) = Left x
30 fmap f (Right y) = Right (f y)