packages feed

transformers 0.1.0.1 → 0.1.1.0

raw patch · 6 files changed

+25/−25 lines, 6 files

Files

Control/Monad/Trans/Error.hs view
@@ -135,10 +135,10 @@           -> ErrorT e' n b mapErrorT f m = ErrorT $ f (runErrorT m) -instance (Monad m) => Functor (ErrorT e m) where-    fmap f = ErrorT . liftM (fmap f) . runErrorT+instance (Functor m) => Functor (ErrorT e m) where+    fmap f = ErrorT . fmap (fmap f) . runErrorT -instance (Monad m) => Applicative (ErrorT e m) where+instance (Functor m, Monad m) => Applicative (ErrorT e m) where     pure a  = ErrorT $ return (Right a)     f <*> v = ErrorT $ do         mf <- runErrorT f@@ -150,7 +150,7 @@                     Left  e -> return (Left e)                     Right x -> return (Right (k x)) -instance (Monad m, Error e) => Alternative (ErrorT e m) where+instance (Functor m, Monad m, Error e) => Alternative (ErrorT e m) where     empty = mzero     (<|>) = mplus 
Control/Monad/Trans/RWS/Lazy.hs view
@@ -106,16 +106,15 @@ withRWST :: (r' -> s -> (r, s)) -> RWST r w s m a -> RWST r' w s m a withRWST f m = RWST $ \r s -> uncurry (runRWST m) (f r s) -instance (Monad m) => Functor (RWST r w s m) where-    fmap f m = RWST $ \r s -> do-        (a, s', w) <- runRWST m r s -        return (f a, s', w)+instance (Functor m) => Functor (RWST r w s m) where+    fmap f m = RWST $ \r s ->+        fmap (\ ~(a, s', w) -> (f a, s', w)) $ runRWST m r s  -instance (Monoid w, Monad m) => Applicative (RWST r w s m) where+instance (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) where     pure = return     (<*>) = ap -instance (Monoid w, MonadPlus m) => Alternative (RWST r w s m) where+instance (Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) where     empty = mzero     (<|>) = mplus 
Control/Monad/Trans/RWS/Strict.hs view
@@ -106,16 +106,15 @@ withRWST :: (r' -> s -> (r, s)) -> RWST r w s m a -> RWST r' w s m a withRWST f m = RWST $ \r s -> uncurry (runRWST m) (f r s) -instance (Monad m) => Functor (RWST r w s m) where-    fmap f m = RWST $ \r s -> do-        (a, s', w) <- runRWST m r s-        return (f a, s', w)+instance (Functor m) => Functor (RWST r w s m) where+    fmap f m = RWST $ \r s ->+        fmap (\ (a, s', w) -> (f a, s', w)) $ runRWST m r s -instance (Monoid w, Monad m) => Applicative (RWST r w s m) where+instance (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) where     pure = return     (<*>) = ap -instance (Monoid w, MonadPlus m) => Alternative (RWST r w s m) where+instance (Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) where     empty = mzero     (<|>) = mplus 
Control/Monad/Trans/State/Lazy.hs view
@@ -155,14 +155,15 @@ withStateT :: (s -> s) -> StateT s m a -> StateT s m a withStateT f m = StateT $ runStateT m . f -instance (Monad m) => Functor (StateT s m) where-    fmap = liftM+instance (Functor m) => Functor (StateT s m) where+    fmap f m = StateT $ \ s ->+        fmap (\ ~(a, s') -> (f a, s')) $ runStateT m s -instance (Monad m) => Applicative (StateT s m) where+instance (Functor m, Monad m) => Applicative (StateT s m) where     pure = return     (<*>) = ap -instance (MonadPlus m) => Alternative (StateT s m) where+instance (Functor m, MonadPlus m) => Alternative (StateT s m) where     empty = mzero     (<|>) = mplus 
Control/Monad/Trans/State/Strict.hs view
@@ -155,14 +155,15 @@ withStateT :: (s -> s) -> StateT s m a -> StateT s m a withStateT f m = StateT $ runStateT m . f -instance (Monad m) => Functor (StateT s m) where-    fmap = liftM+instance (Functor m) => Functor (StateT s m) where+    fmap f m = StateT $ \ s ->+        fmap (\ (a, s') -> (f a, s')) $ runStateT m s -instance (Monad m) => Applicative (StateT s m) where+instance (Functor m, Monad m) => Applicative (StateT s m) where     pure = return     (<*>) = ap -instance (MonadPlus m) => Alternative (StateT s m) where+instance (Functor m, MonadPlus m) => Alternative (StateT s m) where     empty = mzero     (<|>) = mplus 
transformers.cabal view
@@ -1,5 +1,5 @@ name:         transformers-version:      0.1.0.1+version:      0.1.1.0 license:      BSD3 license-file: LICENSE author:       Andy Gill