diff options
author | Bas van Dijk <v.dijk.bas@gmail.com> | 2011-12-07 15:37:31 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-01-13 23:50:23 +0000 |
commit | 3af923c50e161d4650bd981876adcb713e999b21 (patch) | |
tree | d19c84a79dc8a2fa472ab8990f1b8a1b66f9dc09 /libraries/base/Control | |
parent | 4b60b567d4174e793aea7a92d672af130a1c98d5 (diff) | |
download | haskell-3af923c50e161d4650bd981876adcb713e999b21.tar.gz |
Moved the instances from Control.Monad.Instances to GHC.Base and Data.Either
Diffstat (limited to 'libraries/base/Control')
-rw-r--r-- | libraries/base/Control/Applicative.hs | 1 | ||||
-rw-r--r-- | libraries/base/Control/Monad/Fix.hs | 6 | ||||
-rw-r--r-- | libraries/base/Control/Monad/Instances.hs | 22 |
3 files changed, 2 insertions, 27 deletions
diff --git a/libraries/base/Control/Applicative.hs b/libraries/base/Control/Applicative.hs index 248bbacd40..bf58bea1bd 100644 --- a/libraries/base/Control/Applicative.hs +++ b/libraries/base/Control/Applicative.hs @@ -50,7 +50,6 @@ import Prelude hiding (id,(.)) import Control.Category import Control.Arrow (Arrow(arr, (&&&)), ArrowZero(zeroArrow), ArrowPlus((<+>))) import Control.Monad (liftM, ap, MonadPlus(..)) -import Control.Monad.Instances () #ifndef __NHC__ import Control.Monad.ST.Safe (ST) import qualified Control.Monad.ST.Lazy.Safe as Lazy (ST) diff --git a/libraries/base/Control/Monad/Fix.hs b/libraries/base/Control/Monad/Fix.hs index b1fe43d619..a3d2c89d85 100644 --- a/libraries/base/Control/Monad/Fix.hs +++ b/libraries/base/Control/Monad/Fix.hs @@ -27,7 +27,6 @@ module Control.Monad.Fix ( import Prelude import System.IO -import Control.Monad.Instances () import Data.Function (fix) #ifdef __HUGS__ import Hugs.Prelude (MonadFix(mfix)) @@ -65,24 +64,19 @@ class (Monad m) => MonadFix m where -- Instances of MonadFix for Prelude monads --- Maybe: instance MonadFix Maybe where mfix f = let a = f (unJust a) in a where unJust (Just x) = x unJust Nothing = error "mfix Maybe: Nothing" --- List: instance MonadFix [] where mfix f = case fix (f . head) of [] -> [] (x:_) -> x : mfix (tail . f) --- IO: instance MonadFix IO where mfix = fixIO --- Prelude types with Monad instances in Control.Monad.Instances - instance MonadFix ((->) r) where mfix f = \ r -> let a = f a r in a diff --git a/libraries/base/Control/Monad/Instances.hs b/libraries/base/Control/Monad/Instances.hs index 3849e3b7bd..f30f7a4ab2 100644 --- a/libraries/base/Control/Monad/Instances.hs +++ b/libraries/base/Control/Monad/Instances.hs @@ -13,29 +13,11 @@ -- Stability : provisional -- Portability : portable -- +-- /This module is DEPRECATED and will be removed in the future!/ +-- -- 'Functor' and 'Monad' instances for @(->) r@ and -- 'Functor' instances for @(,) a@ and @'Either' a@. module Control.Monad.Instances (Functor(..),Monad(..)) where import Prelude - -instance Functor ((->) r) where - fmap = (.) - -instance Monad ((->) r) where - return = const - f >>= k = \ r -> k (f r) r - -instance Functor ((,) a) where - fmap f (x,y) = (x, f y) - -instance Functor (Either a) where - fmap _ (Left x) = Left x - fmap f (Right y) = Right (f y) - -instance Monad (Either e) where - return = Right - Left l >>= _ = Left l - Right r >>= k = k r - |