-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | more flexible mtl -- -- more flexible mtl @package monad-classes @version 0.3.2.0 -- | Proxied monad. Proxied x is a monad transformer -- that has a global configuration parameter of type x -- associated with it. -- -- It is used to implement things like ZoomT/runZoom -- and CustromWriterT/evalWriterWith. -- -- Most of the time you don't need to use this directly. It is exported -- for two purposes: -- -- module Control.Monad.Classes.Proxied newtype Proxied x m a Proxied :: (forall (q :: *). Reifies q x => Proxy# q -> m a) -> Proxied x m a fromProxy# :: Proxy# a -> Proxy a toProxy# :: Proxy a -> Proxy# a reify :: a -> (forall (q :: *). Reifies q a => Proxy# q -> r) -> r reflect :: Reifies q a => Proxy# q -> a class Reifies k (s :: k) a | s -> a -- | The type constructor Proxy# is used to bear witness to some -- type variable. It's used when you want to pass around proxy values for -- doing things like modelling type applications. A Proxy# is -- not only unboxed, it also has a polymorphic kind, and has no runtime -- representation, being totally free. data Proxy# :: forall k. k -> TYPE VoidRep -- | Witness for an unboxed Proxy# value, which has no runtime -- representation. proxy# :: Proxy# k a instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Classes.Proxied.Proxied x m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Monad.Classes.Proxied.Proxied x m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Classes.Proxied.Proxied x m) instance GHC.Base.Alternative m => GHC.Base.Alternative (Control.Monad.Classes.Proxied.Proxied x m) instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Classes.Proxied.Proxied x m) instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Classes.Proxied.Proxied x) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Classes.Proxied.Proxied x m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Classes.Proxied.Proxied x m) instance Control.Monad.Trans.Control.MonadTransControl (Control.Monad.Classes.Proxied.Proxied x) -- | Functions to run outer layers of monadic stacks. -- -- These are provided for convenience only; you can use the running -- functions (like runState) from the transformers' modules -- directly. -- -- Note that reader and state runners have their arguments swapped -- around; this makes it convenient to chain them. module Control.Monad.Classes.Run run :: Identity a -> a runReader :: r -> ReaderT r m a -> m a runStateLazy :: s -> StateT s m a -> m (a, s) runStateStrict :: s -> StateT s m a -> m (a, s) evalStateLazy :: Monad m => s -> StateT s m a -> m a evalStateStrict :: Monad m => s -> StateT s m a -> m a execStateLazy :: Monad m => s -> StateT s m a -> m s execStateStrict :: Monad m => s -> StateT s m a -> m s runWriterLazy :: (Monad m, Monoid w) => WriterT w m a -> m (a, w) runWriterStrict :: (Monad m, Monoid w) => StateT w m a -> m (a, w) evalWriterLazy :: (Monad m, Monoid w) => WriterT w m a -> m a evalWriterStrict :: (Monad m, Monoid w) => StateT w m a -> m a execWriterLazy :: (Monad m, Monoid w) => WriterT w m a -> m w execWriterStrict :: (Monad m, Monoid w) => StateT w m a -> m w evalWriterWith :: forall w m a. (w -> m ()) -> CustomWriterT w m a -> m a -- | Transform all writer requests with a given function mapWriter :: forall w1 w2 m a. MonadWriter w2 m => (w1 -> w2) -> CustomWriterT w1 m a -> m a newtype CustomWriterT' w n m a CustomWriterT :: (Proxied (w -> n ()) m a) -> CustomWriterT' w n m a type CustomWriterT w m = CustomWriterT' w m m runExcept :: ExceptT e m a -> m (Either e a) runMaybe :: MaybeT m a -> m (Maybe a) runZoom :: forall big small m a. (forall f. Functor f => (small -> f small) -> big -> f big) -> ZoomT big small m a -> m a newtype ZoomT big small m a ZoomT :: (Proxied (VLLens big small) m a) -> ZoomT big small m a -- | ReadState is used to translate reader effects into state -- effects. -- -- If you run a computation with StateT, this handler is not -- needed, since StateT already handles read requests. -- -- This is useful in cases when you work in an abstract MonadState -- monad and thus have no guarantee that its handler will also accept -- reader requests. newtype ReadStateT s m a ReadStateT :: (IdentityT m a) -> ReadStateT s m a runReadState :: Proxy s -> ReadStateT s m a -> m a module Control.Monad.Classes -- | The MonadState s m constraint asserts that m -- is a monad stack that supports state operations on type s type MonadState s m = MonadStateN (Find (EffState s) m) s m -- | Construct a state monad computation from a function state :: forall s m a. (MonadState s m) => (s -> (a, s)) -> m a -- | Fetch the current value of the state within the monad get :: MonadState a m => m a -- | put s sets the state within the monad to s put :: MonadState s m => s -> m () -- | Maps an old state to a new state inside a state monad layer modify :: MonadState s m => (s -> s) -> m () -- | A variant of modify in which the computation is strict in the -- new state modify' :: MonadState s m => (s -> s) -> m () -- | Gets specific component of the state, using a projection function -- supplied. gets :: MonadState s m => (s -> a) -> m a -- | The MonadReader r m constraint asserts that m -- is a monad stack that supports a fixed environment of type r type MonadReader e m = MonadReaderN (Find (EffReader e) m) e m -- | The MonadLocal r m constraint asserts that m -- is a monad stack that supports a fixed environment of type r -- that can be changed externally to the monad type MonadLocal e m = MonadLocalN (Find (EffLocal e) m) e m -- | Fetch the environment passed through the reader monad ask :: forall m r. MonadReader r m => m r -- | Executes a computation in a modified environment. local :: forall a m r. MonadLocal r m => (r -> r) -> m a -> m a -- | The MonadWriter w m constraint asserts that m -- is a monad stack that supports outputting values of type w type MonadWriter w m = MonadWriterN (Find (EffWriter w) m) w m -- | tell w is an action that produces the output -- w tell :: forall w m. MonadWriter w m => w -> m () -- | The MonadExcept e m constraint asserts that m -- is a monad stack that supports throwing exceptions of type e type MonadExcept e m = MonadExceptN (Find (EffExcept e) m) e m -- | Throw an exception throw :: forall a e m. MonadExcept e m => e -> m a type MonadExec w m = MonadExecN (Find (EffExec w) m) w m -- | Lift an IO action exec :: forall w m a. MonadExec w m => w a -> m a class MonadLiftN (n :: Peano) m where type Down n m :: * -> * where { type family Down n m :: * -> *; } liftN :: MonadLiftN n m => Proxy# n -> Down n m a -> m a -- | Writer effect data EffWriter (w :: *) -- | Reader effect data EffReader (e :: *) -- | Local state change effect data EffLocal (e :: *) -- | State effect data EffState (s :: *) -- | Arbitrary monadic effect data EffExec (w :: * -> *) -- | Except effect data EffExcept (e :: *) data Peano :: * Zero :: Peano Succ :: Peano -> Peano class Monad m => MonadStateN (n :: Peano) s m stateN :: MonadStateN n s m => Proxy# n -> ((s -> (a, s)) -> m a) class Monad m => MonadReaderN (n :: Peano) r m askN :: MonadReaderN n r m => Proxy# n -> m r class Monad m => MonadLocalN (n :: Peano) r m localN :: MonadLocalN n r m => Proxy# n -> ((r -> r) -> m a -> m a) class Monad m => MonadWriterN (n :: Peano) w m tellN :: MonadWriterN n w m => Proxy# n -> (w -> m ()) class Monad m => MonadExceptN (n :: Peano) e m throwN :: MonadExceptN n e m => Proxy# n -> (e -> m a) class Monad m => MonadExecN (n :: Peano) w m execN :: MonadExecN n w m => Proxy# n -> (w a -> m a) -- | Find eff m finds the first transformer in a monad -- transformer stack that can handle the effect eff type Find eff (m :: * -> *) = FindTrue (MapCanDo eff m) -- | FindTrue bs returns a (type-level) index of the first -- occurrence of True in a list of booleans -- | MapCanDo eff stack maps the type-level function (m -- -> CanDo m eff) over all layers that a monad -- transformer stack stack consists of -- | CanDo m eff describes whether the given effect can be -- performed in the monad m (without any additional lifting)