diff --git a/src/Control/Comonad/Env/Class.purs b/src/Control/Comonad/Env/Class.purs index 381a23ba..5310f435 100644 --- a/src/Control/Comonad/Env/Class.purs +++ b/src/Control/Comonad/Env/Class.purs @@ -5,7 +5,6 @@ module Control.Comonad.Env.Class where import Prelude import Control.Comonad -import Control.Comonad.Env import Control.Comonad.Env.Trans import Data.Tuple diff --git a/src/Control/Comonad/Traced/Trans.purs b/src/Control/Comonad/Traced/Trans.purs index b2fd1e08..ba1a05b3 100644 --- a/src/Control/Comonad/Traced/Trans.purs +++ b/src/Control/Comonad/Traced/Trans.purs @@ -9,7 +9,6 @@ import Control.Comonad.Trans import Control.Extend import Data.Monoid -import Data.Tuple -- | The cowriter comonad transformer. -- | diff --git a/src/Control/Monad/Except/Trans.purs b/src/Control/Monad/Except/Trans.purs index b68b40de..a4c53ee4 100644 --- a/src/Control/Monad/Except/Trans.purs +++ b/src/Control/Monad/Except/Trans.purs @@ -1,12 +1,12 @@ -- | This module defines the _exception monad transformer_ `ExceptT`. -module Control.Monad.Except.Trans +module Control.Monad.Except.Trans ( ExceptT(..), runExceptT, withExceptT, mapExceptT , module Control.Monad.Trans , module Control.Monad.Error.Class ) where -import Prelude +import Prelude import Data.Tuple (Tuple(..)) import Data.Either (Either(..), either) @@ -18,9 +18,6 @@ import Control.Monad.Rec.Class (MonadRec, tailRecM) import Control.Monad.Eff.Class (MonadEff, liftEff) import Control.Monad.Error.Class (MonadError, throwError, catchError) import Control.Monad.Cont.Class (MonadCont, callCC) -import Control.Monad.Reader.Class -import Control.Monad.State.Class -import Control.Monad.Writer.Class import Control.Monad.RWS.Class import Control.Monad.Trans import Control.MonadPlus (MonadPlus) @@ -99,7 +96,7 @@ instance monadTransExceptT :: MonadTrans (ExceptT e) where instance monadEffExceptT :: (MonadEff eff m) => MonadEff eff (ExceptT e m) where liftEff = lift <<< liftEff -instance monadContExceptT :: (MonadCont m) => MonadCont (ExceptT e m) where +instance monadContExceptT :: (MonadCont m) => MonadCont (ExceptT e m) where callCC f = ExceptT $ callCC $ \c -> runExceptT (f (\a -> ExceptT $ c (Right a))) instance monadErrorExceptT :: (Monad m) => MonadError e (ExceptT e m) where @@ -107,21 +104,21 @@ instance monadErrorExceptT :: (Monad m) => MonadError e (ExceptT e m) where catchError m handler = ExceptT (runExceptT m >>= either (runExceptT <<< handler) (pure <<< Right)) instance monadReaderExceptT :: (MonadReader r m) => MonadReader r (ExceptT e m) where - ask = lift ask + ask = lift ask local f = mapExceptT (local f) instance monadStateExceptT :: (MonadState s m) => MonadState s (ExceptT e m) where state f = lift (state f) -instance monadWriterExceptT :: (MonadWriter w m) => MonadWriter w (ExceptT e m) where - writer wd = lift (writer wd) - listen = mapExceptT $ \m -> do - Tuple a w <- listen m +instance monadWriterExceptT :: (MonadWriter w m) => MonadWriter w (ExceptT e m) where + writer wd = lift (writer wd) + listen = mapExceptT $ \m -> do + Tuple a w <- listen m return $ (\r -> Tuple r w) <$> a - pass = mapExceptT $ \m -> pass $ do - a <- m - return $ case a of - Left e -> Tuple (Left e) id - Right (Tuple r f) -> Tuple (Right r) f + pass = mapExceptT $ \m -> pass $ do + a <- m + return $ case a of + Left e -> Tuple (Left e) id + Right (Tuple r f) -> Tuple (Right r) f instance monadRWSExceptT :: (Monoid w, MonadRWS r w s m) => MonadRWS r w s (ExceptT e m) diff --git a/src/Control/Monad/Maybe/Trans.purs b/src/Control/Monad/Maybe/Trans.purs index 506182f9..4a2fee8f 100644 --- a/src/Control/Monad/Maybe/Trans.purs +++ b/src/Control/Monad/Maybe/Trans.purs @@ -1,6 +1,6 @@ -- | This module defines the `MaybeT` monad transformer. -module Control.Monad.Maybe.Trans +module Control.Monad.Maybe.Trans ( MaybeT(..), runMaybeT, mapMaybeT , module Control.Monad.Trans ) where @@ -14,15 +14,11 @@ import Data.Monoid import Control.Alt import Control.Alternative -import Control.Monad import Control.Monad.Trans import Control.Monad.Rec.Class import Control.Monad.Eff.Class import Control.Monad.Cont.Class import Control.Monad.Error.Class -import Control.Monad.Reader.Class -import Control.Monad.Writer.Class -import Control.Monad.State.Class import Control.Monad.RWS.Class import Control.MonadPlus import Control.Plus @@ -86,7 +82,7 @@ instance monadRecMaybeT :: (MonadRec m) => MonadRec (MaybeT m) where instance monadEffMaybe :: (MonadEff eff m) => MonadEff eff (MaybeT m) where liftEff = lift <<< liftEff - + instance monadContMaybeT :: (MonadCont m) => MonadCont (MaybeT m) where callCC f = MaybeT $ callCC $ \c -> runMaybeT (f (\a -> MaybeT $ c $ Just a)) @@ -112,4 +108,4 @@ instance monadWriterMaybeT :: (Monad m, MonadWriter w m) => MonadWriter w (Maybe Nothing -> Tuple Nothing id Just (Tuple v f) -> Tuple (Just v) f -instance monadRWSMaybeT :: (Monoid w, MonadRWS r w s m) => MonadRWS r w s (MaybeT m) \ No newline at end of file +instance monadRWSMaybeT :: (Monoid w, MonadRWS r w s m) => MonadRWS r w s (MaybeT m) diff --git a/src/Control/Monad/RWS.purs b/src/Control/Monad/RWS.purs index 32f27acc..8ac8e1bd 100644 --- a/src/Control/Monad/RWS.purs +++ b/src/Control/Monad/RWS.purs @@ -1,6 +1,6 @@ -- | This module defines the `RWS` monad. -module Control.Monad.RWS +module Control.Monad.RWS ( RWS() , rws , runRWS @@ -14,7 +14,6 @@ module Control.Monad.RWS import Prelude import Data.Identity -import Data.Monoid import Data.Tuple import Control.Monad.RWS.Class diff --git a/src/Control/Monad/RWS/Trans.purs b/src/Control/Monad/RWS/Trans.purs index 496d8370..329de31b 100644 --- a/src/Control/Monad/RWS/Trans.purs +++ b/src/Control/Monad/RWS/Trans.purs @@ -17,10 +17,7 @@ import Control.Monad.Eff.Class import Control.Monad.Error.Class import Control.Monad.RWS.Class import Control.Monad.Rec.Class -import Control.Monad.Reader.Class -import Control.Monad.State.Class import Control.Monad.Trans -import Control.Monad.Writer.Class data RWSResult state result writer = RWSResult state result writer diff --git a/src/Control/Monad/State/Class.purs b/src/Control/Monad/State/Class.purs index 1516afb2..96389f36 100644 --- a/src/Control/Monad/State/Class.purs +++ b/src/Control/Monad/State/Class.purs @@ -4,7 +4,6 @@ module Control.Monad.State.Class where import Prelude -import Data.Monoid import Data.Tuple -- | The `MonadState s` type class represents those monads which support a single piece of mutable diff --git a/src/Control/Monad/Writer.purs b/src/Control/Monad/Writer.purs index a56de1a1..c6a57ae0 100644 --- a/src/Control/Monad/Writer.purs +++ b/src/Control/Monad/Writer.purs @@ -1,17 +1,16 @@ -- | This module defines the `Writer` monad. -module Control.Monad.Writer +module Control.Monad.Writer ( Writer() , runWriter , execWriter , mapWriter , module Control.Monad.Writer.Class ) where - + import Prelude import Data.Identity -import Data.Monoid import Data.Tuple import Control.Monad.Writer.Class