-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Monad transformers and classes -- -- Ether is a Haskell library that extends mtl and -- transformers with tagged monad transformers and classes in a -- compatible way. @package ether @version 0.3.1.0 -- | Template Haskell utilities. module Control.Ether.TH -- | Creates a tag and a value-level proxy for it. -- -- ethereal "Foo" "foo" generates the following code: -- --
--   data Foo
--   foo :: Proxy Foo
--   foo = Proxy
--   
ethereal :: String -> String -> DecsQ -- | Type-level machinery for tag manipulation. module Control.Ether.Tagged -- | The Taggable class defines the type families to manage tags in -- monad transformer stacks. Its kind is restricted to * -> * -- to prevent incorrect instances. class Taggable (m :: * -> *) where type family Tag m :: Maybe * type family Inner m :: Maybe (* -> *) Tag m = Nothing Inner m = Nothing -- | The Tagged type class establishes a relationship between a -- tagged monad transformer and its untagged counterpart. class (Taggable m, Tag m ~ Just tag) => Tagged m tag | m -> tag where type family Untagged m :: * -> * tagged _ = pack untagged _ = unpack tagged :: Tagged m tag => proxy tag -> Untagged m a -> m a untagged :: Tagged m tag => proxy tag -> m a -> Untagged m a -- | The Tags type function returns a type-level list of all tags in -- a monad transformer stack. Requires Taggable instances. type Tags (m :: * -> *) = MaybeToList (Tag m) ++ ListMapTag (Inners m) -- | The Inners type function recursively applies Inner and -- returns the results in a type-level list. type Inners m = Inners' (Inner m) -- | The main purpose of the UniqueTag class is to provide clear -- error messages when the tag uniqueness property is violated. You -- should never write instances for it unless you know what you're doing. class UniqueTag a -- | The UniqueTags constraint placed on a type variable -- representing a monad transformer stack ensures that every tag in the -- stack appears only once. -- | Type-restricted version of id that adds a UniqueTags -- constraint to the provided monadic value. ensureUniqueTags :: UniqueTags m => m a -> m a instance Control.Ether.Tagged.Taggable GHC.Types.IO instance Control.Ether.Tagged.Taggable Data.Functor.Identity.Identity instance Control.Ether.Tagged.Taggable GHC.Base.Maybe instance Control.Ether.Tagged.Taggable Data.Monoid.Last instance Control.Ether.Tagged.Taggable Data.Monoid.First instance Control.Ether.Tagged.Taggable ((->) r) instance Control.Ether.Tagged.Taggable GHC.Conc.Sync.STM instance Control.Ether.Tagged.Taggable (Data.Either.Either e) instance Control.Ether.Tagged.Taggable Data.Proxy.Proxy instance Control.Ether.Tagged.Taggable (GHC.ST.ST s) instance Control.Ether.Tagged.Taggable (Control.Monad.ST.Lazy.Imp.ST s) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Cont.ContT r m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Except.ExceptT e m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Identity.IdentityT m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.List.ListT m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Maybe.MaybeT m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Reader.ReaderT r m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.State.Lazy.StateT s m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.State.Strict.StateT s m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Writer.Strict.WriterT w m) -- | See Control.Monad.Trans.Reader. module Control.Monad.Trans.Ether.Reader -- | The parameterizable reader monad. -- -- Computations are functions of a shared environment. -- -- The return function ignores the environment, while -- >>= passes the inherited environment to both -- subcomputations. type Reader tag r = ReaderT tag r Identity -- | Constructor for computations in the reader monad (the inverse of -- runReader). reader :: Monad m => proxy tag -> (r -> a) -> ReaderT tag r m a -- | Runs a ReaderT with the given environment and returns the vinal -- value. runReader :: proxy tag -> Reader tag r a -> r -> a -- | The reader monad transformer, which adds a read-only environment to -- the given monad. -- -- The return function ignores the environment, while -- >>= passes the inherited environment to both -- subcomputations. data ReaderT tag r m a -- | Constructor for computations in the reader monad transformer. readerT :: proxy tag -> (r -> m a) -> ReaderT tag r m a -- | Runs a ReaderT with the given environment and returns the vinal -- value. runReaderT :: proxy tag -> ReaderT tag r m a -> r -> m a -- | Fetch the value of the environment. ask :: Monad m => proxy tag -> ReaderT tag r m r -- | Execute a computation in a modified environment (a specialization of -- withReaderT). -- -- local :: proxy tag -> (r -> r) -> ReaderT tag r m a -> ReaderT tag r m a instance GHC.Generics.Constructor Control.Monad.Trans.Ether.Reader.C1_0ReaderT instance GHC.Generics.Datatype Control.Monad.Trans.Ether.Reader.D1ReaderT instance Control.Monad.Morph.MMonad (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.Morph.MFunctor (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance GHC.Base.Alternative m => GHC.Base.Alternative (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance GHC.Generics.Generic (Control.Monad.Trans.Ether.Reader.ReaderT tag r m a) instance Control.Newtype.Newtype (Control.Monad.Trans.Ether.Reader.ReaderT tag r m a) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Monad.Trans.Control.MonadTransControl (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Monad.Trans.Lift.Local.LiftLocal (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.Trans.Lift.Catch.LiftCatch (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.Trans.Lift.Listen.LiftListen (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.Trans.Lift.Pass.LiftPass (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Monad.Trans.Lift.CallCC.LiftCallCC (Control.Monad.Trans.Ether.Reader.ReaderT tag r) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Ether.Tagged.Tagged (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) tag instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Monad.Reader.Class.MonadReader r' m => Control.Monad.Reader.Class.MonadReader r' (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) -- | See Control.Monad.Reader.Class. module Control.Monad.Ether.Reader.Class -- | See MonadReader. class Monad m => MonadReader tag r m | m tag -> r where ask t = reader t id reader t f = fmap f (ask t) -- | Retrieves the monad environment. ask :: MonadReader tag r m => proxy tag -> m r -- | Executes a computation in a modified environment. local :: MonadReader tag r m => proxy tag -> (r -> r) -> m a -> m a -- | Retrieves a function of the current environment. reader :: MonadReader tag r m => proxy tag -> (r -> a) -> m a -- | Retrieves a function of the current environment. asks :: MonadReader tag r m => proxy tag -> (r -> a) -> m a instance GHC.Base.Monad m => Control.Monad.Ether.Reader.Class.MonadReader tag r (Control.Monad.Trans.Ether.Reader.ReaderT tag r m) instance (Control.Monad.Trans.Lift.Local.LiftLocal t, GHC.Base.Monad (t m), Control.Monad.Ether.Reader.Class.MonadReader tag r m) => Control.Monad.Ether.Reader.Class.MonadReader tag r (t m) -- | See Control.Monad.Reader. module Control.Monad.Ether.Reader -- | See MonadReader. class Monad m => MonadReader tag r m | m tag -> r where ask t = reader t id reader t f = fmap f (ask t) -- | Retrieves the monad environment. ask :: MonadReader tag r m => proxy tag -> m r -- | Executes a computation in a modified environment. local :: MonadReader tag r m => proxy tag -> (r -> r) -> m a -> m a -- | Retrieves a function of the current environment. reader :: MonadReader tag r m => proxy tag -> (r -> a) -> m a -- | Retrieves a function of the current environment. asks :: MonadReader tag r m => proxy tag -> (r -> a) -> m a -- | The parameterizable reader monad. -- -- Computations are functions of a shared environment. -- -- The return function ignores the environment, while -- >>= passes the inherited environment to both -- subcomputations. type Reader tag r = ReaderT tag r Identity -- | Runs a ReaderT with the given environment and returns the vinal -- value. runReader :: proxy tag -> Reader tag r a -> r -> a -- | The reader monad transformer, which adds a read-only environment to -- the given monad. -- -- The return function ignores the environment, while -- >>= passes the inherited environment to both -- subcomputations. data ReaderT tag r m a -- | Constructor for computations in the reader monad transformer. readerT :: proxy tag -> (r -> m a) -> ReaderT tag r m a -- | Runs a ReaderT with the given environment and returns the vinal -- value. runReaderT :: proxy tag -> ReaderT tag r m a -> r -> m a -- | See Control.Monad.Ether.Reader. module Control.Monad.Ether.Implicit.Reader -- | See MonadReader. type MonadReader r = MonadReader r r -- | See local. local :: MonadReader r m => (r -> r) -> m a -> m a -- | See ask. ask :: MonadReader r m => m r -- | See reader. reader :: MonadReader r m => (r -> a) -> m a -- | See asks. asks :: MonadReader r m => (r -> a) -> m a -- | See Reader. type Reader r = Reader r r -- | See runReader. runReader :: Reader r a -> r -> a -- | See ReaderT. type ReaderT r = ReaderT r r -- | See readerT. readerT :: (r -> m a) -> ReaderT r m a -- | See runReaderT. runReaderT :: ReaderT r m a -> r -> m a -- | See Control.Monad.Trans.Writer. module Control.Monad.Trans.Ether.Writer -- | The parametrizable writer monad. -- -- Computations can accumulate a monoid value. -- -- The return function produces the output mempty, while -- >>= combines the outputs of the subcomputations using -- mappend. type Writer tag w = WriterT tag w Identity -- | Constructor for computations in the writer monad (the inverse of -- runWriter). writer :: Monad m => proxy tag -> (a, w) -> WriterT tag w m a -- | Runs a Writer and returns both the normal value and the final -- accumulator. runWriter :: proxy tag -> Writer tag w a -> (a, w) -- | Runs a Writer and returns the final accumulator, discarding the -- normal value. execWriter :: proxy tag -> Writer tag w a -> w -- | The writer monad transformer. -- -- The return function produces the output mempty, while -- >>= combines the outputs of the subcomputations using -- mappend. data WriterT tag w m a -- | Constructor for computations in the writer monad transformer. writerT :: proxy tag -> m (a, w) -> WriterT tag w m a -- | Runs a WriterT and returns both the normal value and the final -- accumulator. runWriterT :: proxy tag -> WriterT tag w m a -> m (a, w) -- | Runs a WriterT and returns the final accumulator, discarding -- the normal value. execWriterT :: Monad m => proxy tag -> WriterT tag w m a -> m w -- | Appends a value to the accumulator within the monad. tell :: Monad m => proxy tag -> w -> WriterT tag w m () -- | Executes an action and adds its accumulator to the value of the -- computation. listen :: (Monoid w, Monad m) => proxy tag -> WriterT tag w m a -> WriterT tag w m (a, w) -- | Executes an action which returns a value and a function, and returns -- the value, applying the function to the accumulator. pass :: (Monoid w, Monad m) => proxy tag -> WriterT tag w m (a, w -> w) -> WriterT tag w m a instance GHC.Generics.Constructor Control.Monad.Trans.Ether.Writer.C1_0WriterT instance GHC.Generics.Datatype Control.Monad.Trans.Ether.Writer.D1WriterT instance GHC.Base.Monoid w => Control.Monad.Morph.MMonad (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance Control.Monad.Morph.MFunctor (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m) => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance GHC.Base.Monoid w => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance (Control.Monad.Fix.MonadFix m, GHC.Base.Monoid w) => Control.Monad.Fix.MonadFix (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Monoid w, GHC.Base.MonadPlus m) => GHC.Base.MonadPlus (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Monad m, GHC.Base.Monoid w) => GHC.Base.Monad (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Monoid w, GHC.Base.Alternative m) => GHC.Base.Alternative (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Applicative m, GHC.Base.Monoid w) => GHC.Base.Applicative (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance GHC.Generics.Generic (Control.Monad.Trans.Ether.Writer.WriterT tag w m a) instance Control.Newtype.Newtype (Control.Monad.Trans.Ether.Writer.WriterT tag w m a) instance (GHC.Base.Monoid w, Control.Monad.Base.MonadBase b m) => Control.Monad.Base.MonadBase b (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance GHC.Base.Monoid w => Control.Monad.Trans.Control.MonadTransControl (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance (GHC.Base.Monoid w, Control.Monad.Trans.Control.MonadBaseControl b m) => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance GHC.Base.Monoid w => Control.Monad.Trans.Lift.Local.LiftLocal (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance GHC.Base.Monoid w => Control.Monad.Trans.Lift.Catch.LiftCatch (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance GHC.Base.Monoid w => Control.Monad.Trans.Lift.Listen.LiftListen (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance GHC.Base.Monoid w' => Control.Monad.Trans.Lift.Pass.LiftPass (Control.Monad.Trans.Ether.Writer.WriterT tag w') instance GHC.Base.Monoid w => Control.Monad.Trans.Lift.CallCC.LiftCallCC (Control.Monad.Trans.Ether.Writer.WriterT tag w) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance Control.Ether.Tagged.Tagged (Control.Monad.Trans.Ether.Writer.WriterT tag w m) tag instance (GHC.Base.Monoid w, Control.Monad.Cont.Class.MonadCont m) => Control.Monad.Cont.Class.MonadCont (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Monoid w, Control.Monad.Reader.Class.MonadReader r m) => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Monoid w, Control.Monad.State.Class.MonadState s m) => Control.Monad.State.Class.MonadState s (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Monoid w, Control.Monad.Writer.Class.MonadWriter w' m) => Control.Monad.Writer.Class.MonadWriter w' (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (GHC.Base.Monoid w, Control.Monad.Error.Class.MonadError e m) => Control.Monad.Error.Class.MonadError e (Control.Monad.Trans.Ether.Writer.WriterT tag w m) -- | See Control.Monad.Writer.Class. module Control.Monad.Ether.Writer.Class -- | See MonadWriter. class (Monoid w, Monad m) => MonadWriter tag w m | m tag -> w where writer t ~(a, w) = do { tell t w; return a } tell t w = writer t ((), w) -- | Embed a simple writer action. writer :: MonadWriter tag w m => proxy tag -> (a, w) -> m a -- | Append a value to the accumulator within the monad. tell :: MonadWriter tag w m => proxy tag -> w -> m () -- | Execute an action and add its accumulator to the value of the -- computation. listen :: MonadWriter tag w m => proxy tag -> m a -> m (a, w) -- | Execute an action which returns a value and a function, and return the -- value, applying the function to the accumulator. pass :: MonadWriter tag w m => proxy tag -> m (a, w -> w) -> m a -- | Execute an action and add the result of applying the given function to -- its accumulator to the value of the computation. listens :: MonadWriter tag w m => proxy tag -> (w -> b) -> m a -> m (a, b) -- | Execute an action and apply a function to its accumulator. censor :: MonadWriter tag w m => proxy tag -> (w -> w) -> m a -> m a instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Control.Monad.Ether.Writer.Class.MonadWriter tag w (Control.Monad.Trans.Ether.Writer.WriterT tag w m) instance (Control.Monad.Trans.Lift.Listen.LiftListen t, Control.Monad.Trans.Lift.Pass.LiftPass t, GHC.Base.Monad (t m), Control.Monad.Ether.Writer.Class.MonadWriter tag w m, GHC.Base.Monoid w) => Control.Monad.Ether.Writer.Class.MonadWriter tag w (t m) -- | See Control.Monad.Writer. module Control.Monad.Ether.Writer -- | See MonadWriter. class (Monoid w, Monad m) => MonadWriter tag w m | m tag -> w where writer t ~(a, w) = do { tell t w; return a } tell t w = writer t ((), w) -- | Embed a simple writer action. writer :: MonadWriter tag w m => proxy tag -> (a, w) -> m a -- | Append a value to the accumulator within the monad. tell :: MonadWriter tag w m => proxy tag -> w -> m () -- | Execute an action and add its accumulator to the value of the -- computation. listen :: MonadWriter tag w m => proxy tag -> m a -> m (a, w) -- | Execute an action which returns a value and a function, and return the -- value, applying the function to the accumulator. pass :: MonadWriter tag w m => proxy tag -> m (a, w -> w) -> m a -- | Execute an action and add the result of applying the given function to -- its accumulator to the value of the computation. listens :: MonadWriter tag w m => proxy tag -> (w -> b) -> m a -> m (a, b) -- | Execute an action and apply a function to its accumulator. censor :: MonadWriter tag w m => proxy tag -> (w -> w) -> m a -> m a -- | The parametrizable writer monad. -- -- Computations can accumulate a monoid value. -- -- The return function produces the output mempty, while -- >>= combines the outputs of the subcomputations using -- mappend. type Writer tag w = WriterT tag w Identity -- | Runs a Writer and returns both the normal value and the final -- accumulator. runWriter :: proxy tag -> Writer tag w a -> (a, w) -- | Runs a Writer and returns the final accumulator, discarding the -- normal value. execWriter :: proxy tag -> Writer tag w a -> w -- | The writer monad transformer. -- -- The return function produces the output mempty, while -- >>= combines the outputs of the subcomputations using -- mappend. data WriterT tag w m a -- | Constructor for computations in the writer monad transformer. writerT :: proxy tag -> m (a, w) -> WriterT tag w m a -- | Runs a WriterT and returns both the normal value and the final -- accumulator. runWriterT :: proxy tag -> WriterT tag w m a -> m (a, w) -- | Runs a WriterT and returns the final accumulator, discarding -- the normal value. execWriterT :: Monad m => proxy tag -> WriterT tag w m a -> m w -- | See Control.Monad.Ether.Writer. module Control.Monad.Ether.Implicit.Writer -- | See MonadWriter. type MonadWriter w = MonadWriter w w -- | See writer. writer :: MonadWriter w m => (a, w) -> m a -- | See tell. tell :: MonadWriter w m => w -> m () -- | See listen. listen :: MonadWriter w m => m a -> m (a, w) -- | See pass. pass :: MonadWriter w m => m (a, w -> w) -> m a -- | See listens. listens :: MonadWriter w m => (w -> b) -> m a -> m (a, b) -- | See censor. censor :: MonadWriter w m => (w -> w) -> m a -> m a -- | See Writer. type Writer w = Writer w w -- | See runWriter. runWriter :: Writer w a -> (a, w) -- | See execWriter. execWriter :: Writer w a -> w -- | See WriterT. type WriterT w = WriterT w w -- | See writerT. writerT :: m (a, w) -> WriterT w m a -- | See runWriterT. runWriterT :: WriterT w m a -> m (a, w) -- | See execWriterT. execWriterT :: Monad m => WriterT w m a -> m w -- | See Control.Monad.Trans.State.Lazy. module Control.Monad.Trans.Ether.State.Lazy -- | The parametrizable state monad. -- -- Computations have access to a mutable state. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. type State tag r = StateT tag r Identity -- | Constructor for computations in the state monad (the inverse of -- runState). state :: Monad m => proxy tag -> (s -> (a, s)) -> StateT tag s m a -- | Runs a State with the given initial state and returns both the -- final value and the final state. runState :: proxy tag -> State tag s a -> s -> (a, s) -- | Runs a State with the given initial state and returns the final -- value, discarding the final state. evalState :: proxy tag -> State tag s a -> s -> a -- | Runs a State with the given initial state and returns the final -- state, discarding the final value. execState :: proxy tag -> State tag s a -> s -> s -- | The state monad transformer. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. data StateT tag s m a -- | Constructor for computations in the state monad transformer. stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a -- | Runs a StateT with the given initial state and returns both the -- final value and the final state. runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s) -- | Runs a StateT with the given initial state and returns the -- final value, discarding the final state. evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a -- | Runs a StateT with the given initial state and returns the -- final state, discarding the final value. execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s -- | Fetch the current value of the state within the monad. get :: Monad m => proxy tag -> StateT tag s m s -- | Set the value of the state within the monad. put :: Monad m => proxy tag -> s -> StateT tag s m () instance GHC.Generics.Constructor Control.Monad.Trans.Ether.State.Lazy.C1_0StateT instance GHC.Generics.Datatype Control.Monad.Trans.Ether.State.Lazy.D1StateT instance Control.Monad.Morph.MFunctor (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance GHC.Base.MonadPlus m => GHC.Base.Alternative (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance GHC.Generics.Generic (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m a) instance Control.Newtype.Newtype (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m a) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Monad.Trans.Control.MonadTransControl (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Monad.Trans.Lift.Local.LiftLocal (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Monad.Trans.Lift.Catch.LiftCatch (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Monad.Trans.Lift.Listen.LiftListen (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Monad.Trans.Lift.Pass.LiftPass (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Monad.Trans.Lift.CallCC.LiftCallCC (Control.Monad.Trans.Ether.State.Lazy.StateT tag s) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Ether.Tagged.Tagged (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) tag instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Monad.State.Class.MonadState s' m => Control.Monad.State.Class.MonadState s' (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) -- | See Control.Monad.Trans.State. module Control.Monad.Trans.Ether.State -- | See Control.Monad.Trans.State.Strict. module Control.Monad.Trans.Ether.State.Strict -- | The parametrizable state monad. -- -- Computations have access to a mutable state. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. type State tag r = StateT tag r Identity -- | Constructor for computations in the state monad (the inverse of -- runState). state :: Monad m => proxy tag -> (s -> (a, s)) -> StateT tag s m a -- | Runs a State with the given initial state and returns both the -- final value and the final state. runState :: proxy tag -> State tag s a -> s -> (a, s) -- | Runs a State with the given initial state and returns the final -- value, discarding the final state. evalState :: proxy tag -> State tag s a -> s -> a -- | Runs a State with the given initial state and returns the final -- state, discarding the final value. execState :: proxy tag -> State tag s a -> s -> s -- | The state monad transformer. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. data StateT tag s m a -- | Constructor for computations in the state monad transformer. stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a -- | Runs a StateT with the given initial state and returns both the -- final value and the final state. runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s) -- | Runs a StateT with the given initial state and returns the -- final value, discarding the final state. evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a -- | Runs a StateT with the given initial state and returns the -- final state, discarding the final value. execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s -- | Fetch the current value of the state within the monad. get :: Monad m => proxy tag -> StateT tag s m s -- | Set the value of the state within the monad. put :: Monad m => proxy tag -> s -> StateT tag s m () instance GHC.Generics.Constructor Control.Monad.Trans.Ether.State.Strict.C1_0StateT instance GHC.Generics.Datatype Control.Monad.Trans.Ether.State.Strict.D1StateT instance Control.Monad.Morph.MFunctor (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance GHC.Base.MonadPlus m => GHC.Base.Alternative (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance GHC.Generics.Generic (Control.Monad.Trans.Ether.State.Strict.StateT tag s m a) instance Control.Newtype.Newtype (Control.Monad.Trans.Ether.State.Strict.StateT tag s m a) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Monad.Trans.Control.MonadTransControl (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Monad.Trans.Lift.Local.LiftLocal (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Monad.Trans.Lift.Catch.LiftCatch (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Monad.Trans.Lift.Listen.LiftListen (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Monad.Trans.Lift.Pass.LiftPass (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Monad.Trans.Lift.CallCC.LiftCallCC (Control.Monad.Trans.Ether.State.Strict.StateT tag s) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Ether.Tagged.Tagged (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) tag instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Monad.State.Class.MonadState s' m => Control.Monad.State.Class.MonadState s' (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) -- | See Control.Monad.State.Class. module Control.Monad.Ether.State.Class -- | See MonadState. class Monad m => MonadState tag s m | m tag -> s where get t = state t (\ s -> (s, s)) put t s = state t (\ _ -> ((), s)) state t f = do { s <- get t; let ~(a, s') = f s; put t s'; return a } -- | Return the state from the internals of the monad. get :: MonadState tag s m => proxy tag -> m s -- | Replace the state inside the monad. put :: MonadState tag s m => proxy tag -> s -> m () -- | Embed a simple state action into the monad. state :: MonadState tag s m => proxy tag -> (s -> (a, s)) -> m a -- | Modifies the state inside a state monad. modify :: MonadState tag s m => proxy tag -> (s -> s) -> m () -- | Gets specific component of the state, using a projection function -- supplied. gets :: MonadState tag s m => proxy tag -> (s -> a) -> m a instance GHC.Base.Monad m => Control.Monad.Ether.State.Class.MonadState tag s (Control.Monad.Trans.Ether.State.Lazy.StateT tag s m) instance GHC.Base.Monad m => Control.Monad.Ether.State.Class.MonadState tag s (Control.Monad.Trans.Ether.State.Strict.StateT tag s m) instance (Control.Monad.Trans.Class.MonadTrans t, GHC.Base.Monad (t m), Control.Monad.Ether.State.Class.MonadState tag s m) => Control.Monad.Ether.State.Class.MonadState tag s (t m) -- | See Control.Monad.State.Lazy. module Control.Monad.Ether.State.Lazy -- | See MonadState. class Monad m => MonadState tag s m | m tag -> s where get t = state t (\ s -> (s, s)) put t s = state t (\ _ -> ((), s)) state t f = do { s <- get t; let ~(a, s') = f s; put t s'; return a } -- | Return the state from the internals of the monad. get :: MonadState tag s m => proxy tag -> m s -- | Replace the state inside the monad. put :: MonadState tag s m => proxy tag -> s -> m () -- | Embed a simple state action into the monad. state :: MonadState tag s m => proxy tag -> (s -> (a, s)) -> m a -- | Modifies the state inside a state monad. modify :: MonadState tag s m => proxy tag -> (s -> s) -> m () -- | Gets specific component of the state, using a projection function -- supplied. gets :: MonadState tag s m => proxy tag -> (s -> a) -> m a -- | The parametrizable state monad. -- -- Computations have access to a mutable state. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. type State tag r = StateT tag r Identity -- | Runs a State with the given initial state and returns both the -- final value and the final state. runState :: proxy tag -> State tag s a -> s -> (a, s) -- | Runs a State with the given initial state and returns the final -- value, discarding the final state. evalState :: proxy tag -> State tag s a -> s -> a -- | Runs a State with the given initial state and returns the final -- state, discarding the final value. execState :: proxy tag -> State tag s a -> s -> s -- | The state monad transformer. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. data StateT tag s m a -- | Constructor for computations in the state monad transformer. stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a -- | Runs a StateT with the given initial state and returns both the -- final value and the final state. runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s) -- | Runs a StateT with the given initial state and returns the -- final value, discarding the final state. evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a -- | Runs a StateT with the given initial state and returns the -- final state, discarding the final value. execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s -- | See Control.Monad.State. module Control.Monad.Ether.State -- | See Control.Monad.Ether.State.Lazy. module Control.Monad.Ether.Implicit.State.Lazy -- | See MonadState. type MonadState s = MonadState s s -- | See get. get :: MonadState s m => m s -- | See put. put :: MonadState s m => s -> m () -- | See state. state :: MonadState s m => (s -> (a, s)) -> m a -- | See modify. modify :: MonadState s m => (s -> s) -> m () -- | See gets. gets :: MonadState s m => (s -> a) -> m a -- | See State. type State s = State s s -- | See runState. runState :: State s a -> s -> (a, s) -- | See evalState. evalState :: State s a -> s -> a -- | See execState. execState :: State s a -> s -> s -- | See StateT. type StateT s = StateT s s -- | See stateT. stateT :: (s -> m (a, s)) -> StateT s m a -- | See runStateT. runStateT :: StateT s m a -> s -> m (a, s) -- | See evalStateT. evalStateT :: Monad m => StateT s m a -> s -> m a -- | See execStateT. execStateT :: Monad m => StateT s m a -> s -> m s -- | See Control.Monad.Ether.State. module Control.Monad.Ether.Implicit.State -- | See Control.Monad.State.Strict. module Control.Monad.Ether.State.Strict -- | See MonadState. class Monad m => MonadState tag s m | m tag -> s where get t = state t (\ s -> (s, s)) put t s = state t (\ _ -> ((), s)) state t f = do { s <- get t; let ~(a, s') = f s; put t s'; return a } -- | Return the state from the internals of the monad. get :: MonadState tag s m => proxy tag -> m s -- | Replace the state inside the monad. put :: MonadState tag s m => proxy tag -> s -> m () -- | Embed a simple state action into the monad. state :: MonadState tag s m => proxy tag -> (s -> (a, s)) -> m a -- | Modifies the state inside a state monad. modify :: MonadState tag s m => proxy tag -> (s -> s) -> m () -- | Gets specific component of the state, using a projection function -- supplied. gets :: MonadState tag s m => proxy tag -> (s -> a) -> m a -- | The parametrizable state monad. -- -- Computations have access to a mutable state. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. type State tag r = StateT tag r Identity -- | Runs a State with the given initial state and returns both the -- final value and the final state. runState :: proxy tag -> State tag s a -> s -> (a, s) -- | Runs a State with the given initial state and returns the final -- value, discarding the final state. evalState :: proxy tag -> State tag s a -> s -> a -- | Runs a State with the given initial state and returns the final -- state, discarding the final value. execState :: proxy tag -> State tag s a -> s -> s -- | The state monad transformer. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as the -- initial state of the second. data StateT tag s m a -- | Constructor for computations in the state monad transformer. stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a -- | Runs a StateT with the given initial state and returns both the -- final value and the final state. runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s) -- | Runs a StateT with the given initial state and returns the -- final value, discarding the final state. evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a -- | Runs a StateT with the given initial state and returns the -- final state, discarding the final value. execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s -- | See Control.Monad.Ether.State.Strict. module Control.Monad.Ether.Implicit.State.Strict -- | See MonadState. type MonadState s = MonadState s s -- | See get. get :: MonadState s m => m s -- | See put. put :: MonadState s m => s -> m () -- | See state. state :: MonadState s m => (s -> (a, s)) -> m a -- | See modify. modify :: MonadState s m => (s -> s) -> m () -- | See gets. gets :: MonadState s m => (s -> a) -> m a -- | See State. type State s = State s s -- | See runState. runState :: State s a -> s -> (a, s) -- | See evalState. evalState :: State s a -> s -> a -- | See execState. execState :: State s a -> s -> s -- | See StateT. type StateT s = StateT s s -- | See stateT. stateT :: (s -> m (a, s)) -> StateT s m a -- | See runStateT. runStateT :: StateT s m a -> s -> m (a, s) -- | See evalStateT. evalStateT :: Monad m => StateT s m a -> s -> m a -- | See execStateT. execStateT :: Monad m => StateT s m a -> s -> m s -- | See Control.Monad.Trans.Except. module Control.Monad.Trans.Ether.Except -- | The parameterizable exception monad. -- -- Computations are either exceptions or normal values. -- -- The return function returns a normal value, while -- >>= exits on the first exception. type Except tag e = ExceptT tag e Identity -- | Constructor for computations in the exception monad (the inverse of -- runExcept). except :: Monad m => proxy tag -> Either e a -> ExceptT tag e m a -- | Runs an Except and returns either an exception or a normal -- value. runExcept :: proxy tag -> Except tag e a -> Either e a -- | The exception monad transformer. -- -- The return function returns a normal value, while -- >>= exits on the first exception. data ExceptT tag e m a -- | Constructor for computations in the exception monad transformer. exceptT :: proxy tag -> m (Either e a) -> ExceptT tag e m a -- | Runs an ExceptT and returns either an exception or a normal -- value. runExceptT :: proxy tag -> ExceptT tag e m a -> m (Either e a) -- | Is used within a monadic computation to begin exception processing. throw :: Monad m => proxy tag -> e -> ExceptT tag e m a -- | A handler function to handle previous exceptions and return to normal -- execution. catch :: Monad m => proxy tag -> ExceptT tag e m a -> (e -> ExceptT tag e m a) -> ExceptT tag e m a instance GHC.Generics.Constructor Control.Monad.Trans.Ether.Except.C1_0ExceptT instance GHC.Generics.Datatype Control.Monad.Trans.Ether.Except.D1ExceptT instance Control.Monad.Morph.MMonad (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.Morph.MFunctor (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => GHC.Base.MonadPlus (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance (GHC.Base.Monad m, GHC.Base.Monoid e) => GHC.Base.Alternative (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance GHC.Generics.Generic (Control.Monad.Trans.Ether.Except.ExceptT tag e m a) instance Control.Newtype.Newtype (Control.Monad.Trans.Ether.Except.ExceptT tag e m a) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Monad.Trans.Control.MonadTransControl (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Monad.Trans.Lift.Local.LiftLocal (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.Trans.Lift.Catch.LiftCatch (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.Trans.Lift.Listen.LiftListen (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.Trans.Lift.Pass.LiftPass (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Monad.Trans.Lift.CallCC.LiftCallCC (Control.Monad.Trans.Ether.Except.ExceptT tag e) instance Control.Ether.Tagged.Taggable (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Ether.Tagged.Tagged (Control.Monad.Trans.Ether.Except.ExceptT tag e m) tag instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance Control.Monad.Error.Class.MonadError e' m => Control.Monad.Error.Class.MonadError e' (Control.Monad.Trans.Ether.Except.ExceptT tag e m) -- | See Control.Monad.Except. module Control.Monad.Ether.Except.Class -- | See MonadError. class Monad m => MonadExcept tag e m | m tag -> e -- | Is used within a monadic computation to begin exception processing. throw :: MonadExcept tag e m => proxy tag -> e -> m a -- | A handler function to handle previous exceptions and return to normal -- execution. catch :: MonadExcept tag e m => proxy tag -> m a -> (e -> m a) -> m a instance GHC.Base.Monad m => Control.Monad.Ether.Except.Class.MonadExcept tag e (Control.Monad.Trans.Ether.Except.ExceptT tag e m) instance (Control.Monad.Trans.Lift.Catch.LiftCatch t, GHC.Base.Monad (t m), Control.Monad.Ether.Except.Class.MonadExcept tag e m) => Control.Monad.Ether.Except.Class.MonadExcept tag e (t m) -- | Annotating monads with tags to turn untagged constraints into tagged -- ones. -- --
--   import qualified Control.Monad.State as T
--   import Control.Ether.TH (ethereal)
--   import Control.Monad.Ether.State (MonadState)
--   import Control.Ether.Wrapped (ethered)
--   
--   ethereal "Foo" "foo"
--   
--   f :: T.MonadState Int m => m String
--   f = fmap show T.get
--   
--   g :: MonadState Foo Int m => m String
--   g = ethered foo f
--   
module Control.Ether.Wrapped -- | Wrap a monad to attach a tag to it. newtype WrappedEther tag m a WrapEther :: m a -> WrappedEther tag m a [unwrapEther] :: WrappedEther tag m a -> m a -- | Annotate a polymorphic monadic computation with a tag. ethered :: proxy tag -> WrappedEther tag m a -> m a instance GHC.Generics.Selector Control.Ether.Wrapped.S1_0_0WrappedEther instance GHC.Generics.Constructor Control.Ether.Wrapped.C1_0WrappedEther instance GHC.Generics.Datatype Control.Ether.Wrapped.D1WrappedEther instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Ether.Wrapped.WrappedEther tag m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Control.Ether.Wrapped.WrappedEther tag m) instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Ether.Wrapped.WrappedEther tag m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Ether.Wrapped.WrappedEther tag m) instance GHC.Base.Alternative m => GHC.Base.Alternative (Control.Ether.Wrapped.WrappedEther tag m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Ether.Wrapped.WrappedEther tag m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Ether.Wrapped.WrappedEther tag m) instance GHC.Generics.Generic (Control.Ether.Wrapped.WrappedEther tag m a) instance Control.Newtype.Newtype (Control.Ether.Wrapped.WrappedEther tag m a) instance Control.Monad.Ether.Reader.Class.MonadReader tag r m => Control.Monad.Reader.Class.MonadReader r (Control.Ether.Wrapped.WrappedEther tag m) instance Control.Monad.Ether.Reader.Class.MonadReader tag r m => Control.Monad.Ether.Reader.Class.MonadReader tag r (Control.Ether.Wrapped.WrappedEther tag' m) instance Control.Monad.Ether.State.Class.MonadState tag s m => Control.Monad.State.Class.MonadState s (Control.Ether.Wrapped.WrappedEther tag m) instance Control.Monad.Ether.State.Class.MonadState tag s m => Control.Monad.Ether.State.Class.MonadState tag s (Control.Ether.Wrapped.WrappedEther tag' m) instance Control.Monad.Ether.Except.Class.MonadExcept tag e m => Control.Monad.Error.Class.MonadError e (Control.Ether.Wrapped.WrappedEther tag m) instance Control.Monad.Ether.Except.Class.MonadExcept tag e m => Control.Monad.Ether.Except.Class.MonadExcept tag e (Control.Ether.Wrapped.WrappedEther tag' m) instance Control.Monad.Ether.Writer.Class.MonadWriter tag w m => Control.Monad.Writer.Class.MonadWriter w (Control.Ether.Wrapped.WrappedEther tag m) instance Control.Monad.Ether.Writer.Class.MonadWriter tag w m => Control.Monad.Ether.Writer.Class.MonadWriter tag w (Control.Ether.Wrapped.WrappedEther tag' m) -- | See Control.Monad.Except. module Control.Monad.Ether.Except -- | See MonadError. class Monad m => MonadExcept tag e m | m tag -> e -- | Is used within a monadic computation to begin exception processing. throw :: MonadExcept tag e m => proxy tag -> e -> m a -- | A handler function to handle previous exceptions and return to normal -- execution. catch :: MonadExcept tag e m => proxy tag -> m a -> (e -> m a) -> m a -- | The parameterizable exception monad. -- -- Computations are either exceptions or normal values. -- -- The return function returns a normal value, while -- >>= exits on the first exception. type Except tag e = ExceptT tag e Identity -- | Runs an Except and returns either an exception or a normal -- value. runExcept :: proxy tag -> Except tag e a -> Either e a -- | The exception monad transformer. -- -- The return function returns a normal value, while -- >>= exits on the first exception. data ExceptT tag e m a -- | Constructor for computations in the exception monad transformer. exceptT :: proxy tag -> m (Either e a) -> ExceptT tag e m a -- | Runs an ExceptT and returns either an exception or a normal -- value. runExceptT :: proxy tag -> ExceptT tag e m a -> m (Either e a) -- | Runs an ExceptT and handles the exception with the given -- function. handleT :: Functor m => proxy tag -> (e -> a) -> ExceptT tag e m a -> m a -- | Runs an Except and handles the exception with the given -- function. handle :: proxy tag -> (e -> a) -> Except tag e a -> a -- | This module provides convenience exports of all tagged monad classes -- from Ether. module Control.Monad.Ether -- | Creates a tag and a value-level proxy for it. -- -- ethereal "Foo" "foo" generates the following code: -- --
--   data Foo
--   foo :: Proxy Foo
--   foo = Proxy
--   
ethereal :: String -> String -> DecsQ -- | Abbreviations for constraints. module Control.Ether.Abbr -- | Denotes MonadReader. The mnemonic is that you read values of -- type r from the reader environment tagged by tag, -- thus the arrows points from tag to r. data (-->) tag r -- | Denotes MonadWriter. The mnemonic is that you write values of -- type w to the writer accumulator tagged by tag, thus -- the arrows points from w to tag. data (<--) tag w -- | Denotes MonadState. The mnemonic is that you can both read from -- and write into the state, thus the arrow points in both directions. data (<->) tag s -- | Denotes MonadExcept. data (-!-) tag e -- | Reify a list of constraint abbreviations. -- --
--   f :: Ether '[Foo --> r, Bar <-- w, Baz <-> s, Quux -!- e] m => m a
--   
-- -- expands into -- --
--   f :: ( MonadReader Foo  r m
--        , MonadWriter Bar  w m
--        , MonadState  Baz  s m
--        , MonadExcept Quux e m
--        ) => m a
--   
-- | Turns an abbreviation into an actual constraint. -- | See Control.Monad.Ether.Except. module Control.Monad.Ether.Implicit.Except -- | See MonadExcept. type MonadExcept e = MonadExcept e e -- | See throw. throw :: MonadExcept e m => e -> m a -- | See catch. catch :: MonadExcept e m => m a -> (e -> m a) -> m a -- | See Except. type Except e = Except e e -- | See runExcept. runExcept :: Except e a -> Either e a -- | See ExceptT. type ExceptT e = ExceptT e e -- | See exceptT. exceptT :: m (Either e a) -> ExceptT e m a -- | See runExceptT. runExceptT :: ExceptT e m a -> m (Either e a) -- | See handle. handle :: (e -> a) -> Except e a -> a -- | See handleT. handleT :: Functor m => (e -> a) -> ExceptT e m a -> m a -- | This module provides convenience exports of all implicitly tagged -- monad classes from Ether. module Control.Monad.Ether.Implicit -- | See Control.Ether.Abbr. module Control.Ether.Implicit.Abbr -- | Denotes MonadReader. data R r -- | Denotes MonadWriter. data W w -- | Denotes MonadState. data S s -- | Denotes MonadExcept. data E e