Remove Control.Parallel*, now in package parallel
[packages/random.git] / Control / Monad / Instances.hs
1 {-# OPTIONS_NHC98 -prelude #-}
2 -----------------------------------------------------------------------------
3 -- |
4 -- Module : Control.Monad.Instances
5 -- Copyright : (c) The University of Glasgow 2001
6 -- License : BSD-style (see the file libraries/base/LICENSE)
7 --
8 -- Maintainer : libraries@haskell.org
9 -- Stability : provisional
10 -- Portability : portable
11 --
12 -- 'Functor' and 'Monad' instances for @(->) r@ and
13 -- 'Functor' instances for @(,) a@ and @'Either' a@.
14
15 module Control.Monad.Instances (Functor(..),Monad(..)) where
16
17 import Prelude
18
19 instance Functor ((->) r) where
20 fmap = (.)
21
22 instance Monad ((->) r) where
23 return = const
24 f >>= k = \ r -> k (f r) r
25
26 instance Functor ((,) a) where
27 fmap f (x,y) = (x, f y)
28
29 instance Functor (Either a) where
30 fmap _ (Left x) = Left x
31 fmap f (Right y) = Right (f y)