-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An Effect System based on Type Classes -- -- Please see the README on GitHub at -- https://github.com/typedbyte/effet#readme @package effet @version 0.2.0.0 -- | This module provides default implementations for the MonadTrans -- and MonadTransControl type classes. module Control.Effect.Machinery.Default -- | This type provides default implementations for the MonadTrans -- and MonadTransControl type classes. The type is intended to be -- targeted by the DerivingVia language extension when writing -- an effect handler newtype that wraps a monad m a : -- --
--   newtype MyHandler m a =
--     MyHandler { runMyHandler :: m a }
--       deriving (Applicative, Functor, Monad, MonadIO)
--       deriving (MonadTrans, MonadTransControl) via Default
--       deriving (MonadBase b, MonadBaseControl b)
--   
newtype Default m a Default :: m a -> Default m a [runDefault] :: Default m a -> m a instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Machinery.Default.Default m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.Machinery.Default.Default m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.Machinery.Default.Default m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.Machinery.Default.Default m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.Machinery.Default.Default m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Effect.Machinery.Default.Default m) instance Control.Monad.Trans.Class.MonadTrans Control.Effect.Machinery.Default.Default instance Control.Monad.Trans.Control.MonadTransControl Control.Effect.Machinery.Default.Default -- | This module defines an effect handler which handles tagging, retagging -- and untagging of effects. module Control.Effect.Machinery.Tagger -- | This type provides instances for effect type classes in order to -- enable tagging, retagging and untagging of effects. Whenever this type -- is used as handler of an effect, the effect previously tagged with -- tag will be tagged with new instead. -- -- You usually don't interact with this type directly, since the type -- class instances for this type are generated by the functions found in -- the module Control.Effect.Machinery.TH. newtype Tagger tag new m a Tagger :: m a -> Tagger tag new m a [runTagger] :: Tagger tag new m a -> m a instance forall (b :: * -> *) k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall (b :: * -> *) k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2). Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Machinery.Tagger.Tagger tag new) instance forall k1 (tag :: k1) k2 (new :: k2). Control.Monad.Trans.Class.MonadTrans (Control.Effect.Machinery.Tagger.Tagger tag new) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Applicative m => GHC.Base.Applicative (Control.Effect.Machinery.Tagger.Tagger tag new m) -- | This module defines the types EachVia and its corresponding -- type synonym Via which indicate that specific effects are -- handled by a specific monad transformer (also known as effect handler -- or effect interpreter). -- -- It also defines the G type, which is the global tag that is -- used for untagged effects. -- -- Last but not least, it defines some constraint synonyms and kinds that -- are used throughout this library, hopefully to increase the -- readability of the code at some points. module Control.Effect.Machinery.Via -- | This type indicates that the effects (i.e., type classes) -- effs are handled by a specific monad transformer t. -- The type is a simple wrapper around the monad transformer itself. The -- whole purpose of this type is to guide the type system to pick the -- instances of type classes effs given by the type t, -- and to delegate all other effects that are not in effs to -- their handlers which are located somewhere further down the monad -- transformer stack. newtype EachVia (effs :: [Effect]) (t :: Transformer) m a EachVia :: t m a -> EachVia (effs :: [Effect]) (t :: Transformer) m a [runVia] :: EachVia (effs :: [Effect]) (t :: Transformer) m a -> t m a -- | This type synonym can be used to indicate that a single effect -- eff is handled by a specific monad transformer t. type Via eff t m a = EachVia '[eff] t m a -- | This type is used as tag for all untagged effects. In order words, -- every effect is tagged, even untagged ones, but all the untagged ones -- simply have the same tag G (short for "Global", because you -- can view tags as some kind of namespace mechanism, and all untagged -- effects live in the same global namespace). -- -- If you don't want to use tagged effects (i.e., you write effect type -- classes without a tag type parameter), you can ignore this type -- completely. data G -- | The kind of monads. type SomeMonad = Type -> Type -- | The kind of effects, which are type classes with a monad type -- parameter at the end. type Effect = SomeMonad -> Constraint -- | The kind of monad transformers, also known as effect handlers or -- effect interpreters. type Transformer = SomeMonad -> Type -> Type -- | This type synonym indicates that an effect is handled by a specific -- monad transformer. type Handle (eff :: Effect) (t :: Transformer) m = eff (t m) -- | This type synonym indicates that an effect eff is not at the -- head of the type level list of effects to be handled, so the effect -- must be found further down in the tail effs. type Find eff effs t m = (Monad (t m), eff (EachVia effs t m)) -- | This constraint synonym indicates that a first-order effect is not -- handled by a specific monad transformer and must thus be delegated -- ("lifted") further down the monad transformer stack in order to find -- its associated handler. -- -- Roughly speaking, a first-order effect is a type class whose monad -- type parameter m appears only in positive position when -- looking at the types of its corresponding class methods (e.g., -- m appears only in the result type). -- -- An example of a first-order effect is the State' effect. type Lift (eff :: Effect) (t :: Transformer) m = (eff m, Monad (t m), MonadTrans t) -- | This constraint synonym indicates that a higher-order effect is not -- handled by a specific monad transformer and must thus be delegated -- ("lifted") further down the monad transformer stack in order to find -- its associated handler. -- -- Roughly speaking, a higher-order effect is a type class whose monad -- type parameter m appears in negative position when looking at -- the types of its corresponding class methods (e.g., m appears -- in the type of a method parameter). -- -- An example of a higher-order effect is the Reader' effect, -- since its class method local' has a parameter of type m -- a. type Control (eff :: Effect) (t :: Transformer) m = (eff m, Monad (t m), MonadTransControl t) instance Control.Monad.Trans.Control.MonadTransControl t => Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Machinery.Via.EachVia effs t) instance Control.Monad.Trans.Class.MonadTrans t => Control.Monad.Trans.Class.MonadTrans (Control.Effect.Machinery.Via.EachVia effs t) instance Control.Monad.IO.Class.MonadIO (t m) => Control.Monad.IO.Class.MonadIO (Control.Effect.Machinery.Via.EachVia effs t m) instance GHC.Base.Monad (t m) => GHC.Base.Monad (Control.Effect.Machinery.Via.EachVia effs t m) instance GHC.Base.Functor (t m) => GHC.Base.Functor (Control.Effect.Machinery.Via.EachVia effs t m) instance GHC.Base.Applicative (t m) => GHC.Base.Applicative (Control.Effect.Machinery.Via.EachVia effs t m) instance (GHC.Base.Monad (t m), Control.Monad.Base.MonadBase b m, Control.Monad.Trans.Class.MonadTrans t) => Control.Monad.Base.MonadBase b (Control.Effect.Machinery.Via.EachVia effs t m) instance (GHC.Base.Monad (t m), Control.Monad.Trans.Control.MonadBaseControl b m, Control.Monad.Trans.Control.MonadTransControl t) => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Machinery.Via.EachVia effs t m) -- | This module provides TemplateHaskell functions to generate -- the handling, lifting and tagging infrastructure for effect type -- classes. module Control.Effect.Machinery.TH -- | Generates the effect handling and lifting infrastructure for an effect -- which does not have a tag type parameter. Requires the -- TemplateHaskell language extension. -- -- Consider the following effect type class: -- --
--   class Monad m => MyEffect a b c m where
--     ...
--   
-- -- makeEffect ''MyEffect then generates three instances for this -- effect type class (Lift for first-order effects, Control -- for higher-order effects): -- --
--   instance Handle (MyEffect a b c) t m => MyEffect a b c (EachVia (MyEffect a b c : effs) t m) where
--     ...
--   
--   instance {-# OVERLAPPABLE #-} Find (MyEffect a b c) effs t m => MyEffect a b c (EachVia (other : effs) t m) where
--     ...
--   
--   instance Lift/Control (MyEffect a b c) t m => MyEffect a b c (EachVia '[] t m) where
--     ...
--   
-- -- The first instance indicates that MyEffect was found at the -- head of the type level list of effects to be handled, so -- MyEffect is delegated to t. -- -- The second instance indicates that MyEffect was not found at -- the head of the type level list of effects to be handled, so we must -- find MyEffect in the tail effs of the type level -- list. -- -- The third instance indicates that MyEffect could not be found -- in the type level list of effects to be handled, so the effect must be -- delegated further down the monad transformer stack in order to find -- its corresponding effect handler. -- -- Without TemplateHaskell, you have to write these three -- instances by hand. These instances can also be generated separately, -- see makeHandler, makeFinder and makeLifter. makeEffect :: Name -> Q [Dec] -- | Similar to makeEffect, but only generates the effect type class -- instance for handling an effect. makeHandler :: Name -> Q [Dec] -- | Similar to makeEffect, but only generates the effect type class -- instance for finding the effect in the tail of the type level list. makeFinder :: Name -> Q [Dec] -- | Similar to makeEffect, but only generates the effect type class -- instance for lifting an effect. makeLifter :: Name -> Q [Dec] -- | Generates the effect handling and lifting infrastructure for an effect -- which has a tag type parameter. It is expected that the tag type -- parameter is the first type parameter of the effect type class. It is -- also expected that the names of the effect type class and its methods -- end with an apostrophe "'". If you want more control over the naming -- convention, use makeTaggedEffectWith. -- -- In general, this function generates everything that makeEffect -- does, but also some additional things. Consider the following effect -- type class: -- --
--   class Monad m => MyEffect' tag a b c m where
--     methodA' :: a -> m ()
--     methodB' :: b -> m ()
--     methodC' :: c -> m ()
--   
-- -- makeTaggedEffect ''MyEffect' then generates the -- following additional things: -- -- -- -- As a rule of thumb, whenever you see an apostrophe suffix in the name -- of a definition somewhere in this library, it has something to do with -- tags. Most of the time you will use such definitions in combination -- with the language extension TypeApplications, like: -- --
--   ... forall tag ... methodA' @tag ...
--   tagMyEffect' @"newTag" program
--   retagMyEffect' @"oldTag" @"newTag" program
--   untagMyEffect' @"erasedTag" program
--   
-- -- All the tag-related definitions can also be generated separately -- (i.e., without the instances generated by makeEffect), see -- makeTagger and makeTaggerWith. makeTaggedEffect :: Name -> Q [Dec] -- | Similar to makeTaggedEffect, but allows to define a naming -- convention function for the names of the effect type class and its -- methods. This function is used to transform the name of a tagged -- definition (i.e., the type class or its methods) into its untagged -- counterpart. -- -- The default naming convention is enforced by removeApostrophe, -- which simply removes the apostrophe "'" at the end of a name. makeTaggedEffectWith :: (String -> Q String) -> Name -> Q [Dec] -- | Similar to makeTaggedEffect, but only generates the tag-related -- definitions. makeTagger :: Name -> Q [Dec] -- | Similar to makeTaggedEffectWith, but only generates the -- tag-related definitions. makeTaggerWith :: (String -> Q String) -> Name -> Q [Dec] -- | Adds an effect eff to the type level list of effects that -- need to be handled by the transformer t. From a structural -- point of view, this is analogous to lift in the mtl -- ecosystem. This function comes in handy when writing the -- Find-based instance of an effect by hand. liftL :: EachVia effs t m a -> EachVia (eff : effs) t m a -- | Removes an effect eff from the type level list of effects -- that need to be handled by the transformer t. From a -- structural point of view, this is analogous to the run... -- functions in the mtl ecosystem. This function comes in handy -- when writing the Find-based instance of an effect by hand. runL :: EachVia (eff : effs) t m a -> EachVia effs t m a -- | Extracts the untagged name from a name which is expected to end with -- "'". In other words, this function removes the suffix "'" from a given -- name, or fails otherwise. removeApostrophe :: String -> Q String -- | This module exports all the definitions needed to define effects and -- their corresponding handlers. Usually, importing this module is -- everything you need to get started. module Control.Effect.Machinery -- | The error effect, similar to the MonadError type class from -- the mtl library. module Control.Effect.Error -- | An effect that equips a computation with the ability to throw and -- catch exceptions. class Monad m => Error' tag e m | tag m -> e -- | Throws an exception during the computation and begins exception -- processing. throwError' :: Error' tag e m => e -> m a -- | Catches an exception in order to handle it and return to normal -- execution. catchError' :: Error' tag e m => m a -> (e -> m a) -> m a type Error e_ai33 = Error' G e_ai33 throwError :: Error e_ai33 m_ai34 => e_ai33 -> m_ai34 a_ai35 catchError :: Error e_ai33 m_ai34 => m_ai34 a_ai36 -> (e_ai33 -> m_ai34 a_ai36) -> m_ai34 a_ai36 -- | Lifts an Either e into any Error' e. liftEither' :: forall tag e m a. Error' tag e m => Either e a -> m a -- | The untagged version of liftEither'. liftEither :: Error e m => Either e a -> m a -- | Runs the error effect by wrapping exceptions in the Either -- type. runError' :: (Error' tag e `Via` ExceptT e) m a -> m (Either e a) -- | The untagged version of runError'. runError :: (Error e `Via` ExceptT e) m a -> m (Either e a) tagError' :: forall new_ai56 e_ai33 m_ai57 a_ai58. Via (Error' G e_ai33) (Tagger G new_ai56) m_ai57 a_ai58 -> m_ai57 a_ai58 retagError' :: forall tag_ai55 new_ai56 e_ai33 m_ai59 a_ai5a. Via (Error' tag_ai55 e_ai33) (Tagger tag_ai55 new_ai56) m_ai59 a_ai5a -> m_ai59 a_ai5a untagError' :: forall tag_ai55 e_ai33 m_ai5b a_ai5c. Via (Error' tag_ai55 e_ai33) (Tagger tag_ai55 G) m_ai5b a_ai5c -> m_ai5b a_ai5c instance forall k (tag :: k) e (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Error.Error' tag e) t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.EachVia (Control.Effect.Error.Error' tag e : effs) t m) instance forall k (tag :: k) e (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Error.Error' tag e) effs t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k (tag :: k) e (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Error.Error' tag e) t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k1 k2 (new :: k1) e (m :: * -> *) (tag :: k2). Control.Effect.Error.Error' new e m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k (m :: * -> *) (tag :: k) e. GHC.Base.Monad m => Control.Effect.Error.Error' tag e (Control.Monad.Trans.Except.ExceptT e m) -- | The embed effect for integrating arbitrary monads into the effect -- system. module Control.Effect.Embed -- | An effect that integrates a monad n into the computation -- m. class Monad m => Embed n m -- | Monadic actions in n can be lifted into m via -- embed. -- -- embed is like liftIO, but not limited to IO. In -- fact, liftIO can be realized using embed by specializing -- n to IO. embed :: Embed n m => n a -> m a -- | The transformation interpreter of the embed effect. This type -- implements the Embed type class by transforming the integrated -- monad n into another integrated monad t via natural -- transformation. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data Transformation n t m a -- | Runs the embed effect by transforming the integrated monad n -- into another integrated monad t. runEmbed :: (forall b. n b -> t b) -> (Embed n `Via` Transformation n t) m a -> m a instance forall (b :: * -> *) k (n :: k -> *) (t :: k -> *) (m :: * -> *). Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Embed.Transformation n t m) instance forall (b :: * -> *) k (n :: k -> *) (t :: k -> *) (m :: * -> *). Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.Embed.Transformation n t m) instance forall k (n :: k -> *) (t :: k -> *). Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Embed.Transformation n t) instance forall k (n :: k -> *) (t :: k -> *). Control.Monad.Trans.Class.MonadTrans (Control.Effect.Embed.Transformation n t) instance forall k (n :: k -> *) (t :: k -> *) (m :: * -> *). Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.Embed.Transformation n t m) instance forall k (n :: k -> *) (t :: k -> *) (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.Embed.Transformation n t m) instance forall k (n :: k -> *) (t :: k -> *) (m :: * -> *). GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.Embed.Transformation n t m) instance forall k (n :: k -> *) (t :: k -> *) (m :: * -> *). GHC.Base.Applicative m => GHC.Base.Applicative (Control.Effect.Embed.Transformation n t m) instance Control.Effect.Embed.Embed t m => Control.Effect.Embed.Embed n (Control.Effect.Embed.Transformation n t m) instance Control.Effect.Machinery.Via.Handle (Control.Effect.Embed.Embed n) t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.EachVia (Control.Effect.Embed.Embed n : effs) t m) instance Control.Effect.Machinery.Via.Find (Control.Effect.Embed.Embed n) effs t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance Control.Effect.Machinery.Via.Lift (Control.Effect.Embed.Embed n) t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.EachVia '[] t m) instance GHC.Base.Monad m => Control.Effect.Embed.Embed m m -- | The continuation effect, similar to the MonadCont type class -- from the mtl library. module Control.Effect.Cont -- | An effect that adds an abortive continuation to a computation. class Monad m => Cont' tag m -- | Adapted from the mtl library documentation: -- -- callCC' (call-with-current-continuation) calls a function -- with the current continuation as its argument. Provides an escape -- continuation mechanism for use with continuation monads. Escape -- continuations allow to abort the current computation and return a -- value immediately. They achieve a similar result to throwError' -- and catchError' of the Error' effect. Advantage of this -- function over calling return is that it makes the -- continuation explicit, allowing more flexibility and better control. -- -- The standard idiom used with callCC' is to provide a -- lambda-expression to name the continuation. Then calling the named -- continuation anywhere within its scope will escape from the -- computation, even if it is many layers deep within nested -- computations. callCC' :: Cont' tag m => ((a -> m b) -> m a) -> m a type Cont = Cont' G callCC :: Cont m_ajXN => ((a_ajXO -> m_ajXN b_ajXP) -> m_ajXN a_ajXO) -> m_ajXN a_ajXO -- | Runs the continuation effect with a given final continuation. runCont' :: forall tag r m a. (a -> m r) -> (Cont' tag `Via` ContT r) m a -> m r -- | The untagged version of runCont'. runCont :: (a -> m r) -> (Cont `Via` ContT r) m a -> m r -- | Runs the continuation effect with pure as final continuation. evalCont' :: forall tag r m. Applicative m => (Cont' tag `Via` ContT r) m r -> m r -- | The untagged version of evalCont'. evalCont :: Applicative m => (Cont `Via` ContT r) m r -> m r tagCont' :: forall new_ak3N m_ak3O a_ak3P. Via (Cont' G) (Tagger G new_ak3N) m_ak3O a_ak3P -> m_ak3O a_ak3P retagCont' :: forall tag_ak3M new_ak3N m_ak3Q a_ak3R. Via (Cont' tag_ak3M) (Tagger tag_ak3M new_ak3N) m_ak3Q a_ak3R -> m_ak3Q a_ak3R untagCont' :: forall tag_ak3M m_ak3S a_ak3T. Via (Cont' tag_ak3M) (Tagger tag_ak3M G) m_ak3S a_ak3T -> m_ak3S a_ak3T instance forall k1 k2 (new :: k1) (m :: * -> *) (tag :: k2). Control.Effect.Cont.Cont' new m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: Control.Effect.Machinery.Via.SomeMonad). Control.Effect.Machinery.Via.Control (Control.Effect.Cont.Cont' tag) t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k1 k2 (tag :: k1) (r :: k2) (m :: k2 -> *). Control.Effect.Cont.Cont' tag (Control.Monad.Trans.Cont.ContT r m) instance forall k (tag :: k) (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Cont.Cont' tag) effs t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Cont.Cont' tag) t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.EachVia (Control.Effect.Cont.Cont' tag : effs) t m) -- | The map effect for modeling a mutable collection of key-value pairs. -- -- Lazy and strict interpretations of the effect are available here: -- Control.Effect.Map.Lazy and Control.Effect.Map.Strict. module Control.Effect.Map -- | An effect that adds a mutable collection of key-value pairs to a given -- computation. class Monad m => Map' tag k v m | tag m -> k v -- | Deletes all key-value pairs from the map. clear' :: Map' tag k v m => m () -- | Searches for a value that corresponds to a given key. Returns -- Nothing if the key cannot be found. lookup' :: Map' tag k v m => k -> m (Maybe v) -- | Updates the value that corresponds to a given key. Passing -- Nothing as the updated value removes the key-value pair from -- the map. update' :: Map' tag k v m => k -> Maybe v -> m () type Map k_akwz v_akwA = Map' G k_akwz v_akwA clear :: Map k_akwz v_akwA m_akwB => m_akwB () lookup :: Map k_akwz v_akwA m_akwB => k_akwz -> m_akwB (Maybe v_akwA) update :: Map k_akwz v_akwA m_akwB => k_akwz -> Maybe v_akwA -> m_akwB () -- | Deletes a key and its corresponding value from the map. delete' :: forall tag k v m. Map' tag k v m => k -> m () -- | The untagged version of delete'. delete :: Map k v m => k -> m () -- | Checks if the map contains a given key. exists' :: forall tag k v m. Map' tag k v m => k -> m Bool -- | The untagged version of exists'. exists :: Map k v m => k -> m Bool -- | Inserts a new key-value pair into the map. If the key is already -- present in the map, the associated value is replaced with the new -- value. insert' :: forall tag k v m. Map' tag k v m => k -> v -> m () -- | The untagged version of insert'. insert :: Map k v m => k -> v -> m () -- | Updates the value that corresponds to a given key. If the key cannot -- be found, a corresponding default value is assumed. modify' :: forall tag k v m. Map' tag k v m => v -> (v -> v) -> k -> m () -- | The untagged version of modify'. modify :: Map k v m => v -> (v -> v) -> k -> m () tagMap' :: forall new_akyF k_akwz v_akwA m_akyG a_akyH. Via (Map' G k_akwz v_akwA) (Tagger G new_akyF) m_akyG a_akyH -> m_akyG a_akyH retagMap' :: forall tag_akyE new_akyF k_akwz v_akwA m_akyI a_akyJ. Via (Map' tag_akyE k_akwz v_akwA) (Tagger tag_akyE new_akyF) m_akyI a_akyJ -> m_akyI a_akyJ untagMap' :: forall tag_akyE k_akwz v_akwA m_akyK a_akyL. Via (Map' tag_akyE k_akwz v_akwA) (Tagger tag_akyE G) m_akyK a_akyL -> m_akyK a_akyL instance forall k1 (tag :: k1) k2 v (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Map.Map' tag k2 v) t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.EachVia (Control.Effect.Map.Map' tag k2 v : effs) t m) instance forall k1 (tag :: k1) k2 v (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Map.Map' tag k2 v) effs t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k1 (tag :: k1) k2 v (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Lift (Control.Effect.Map.Map' tag k2 v) t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k1 k2 (new :: k1) k3 v (m :: * -> *) (tag :: k2). Control.Effect.Map.Map' new k3 v m => Control.Effect.Map.Map' tag k3 v (Control.Effect.Machinery.Tagger.Tagger tag new m) -- | Lazy interpretations of the Map' effect. -- -- If you don't require disambiguation of multiple map effects (i.e., you -- only have one map effect in your monadic context), you usually need -- the untagged interpretations. module Control.Effect.Map.Lazy -- | The lazy interpreter of the map effect. This type implements the -- Map' type class in a lazy manner. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data LazyMap k v m a -- | Runs the map effect, initialized with an empty map. runMap' :: forall tag k v m a. Monad m => (Map' tag k v `Via` LazyMap k v) m a -> m a -- | The untagged version of runMap'. runMap :: Monad m => (Map k v `Via` LazyMap k v) m a -> m a instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Map.Lazy.LazyMap k v m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.Map.Lazy.LazyMap k v m) instance Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Map.Lazy.LazyMap k v) instance Control.Monad.Trans.Class.MonadTrans (Control.Effect.Map.Lazy.LazyMap k v) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.Map.Lazy.LazyMap k v m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.Map.Lazy.LazyMap k v m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.Map.Lazy.LazyMap k v m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Effect.Map.Lazy.LazyMap k v m) instance forall k1 (m :: * -> *) k2 (tag :: k1) v. (GHC.Base.Monad m, GHC.Classes.Ord k2) => Control.Effect.Map.Map' tag k2 v (Control.Effect.Map.Lazy.LazyMap k2 v m) -- | Strict interpretations of the Map' effect. -- -- If you don't require disambiguation of multiple map effects (i.e., you -- only have one map effect in your monadic context), you usually need -- the untagged interpretations. module Control.Effect.Map.Strict -- | The strict interpreter of the map effect. This type implements the -- Map' type class in a strict manner. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data StrictMap k v m a -- | Runs the map effect, initialized with an empty map. runMap' :: forall tag k v m a. Monad m => (Map' tag k v `Via` StrictMap k v) m a -> m a -- | The untagged version of runMap'. runMap :: Monad m => (Map k v `Via` StrictMap k v) m a -> m a instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Map.Strict.StrictMap k v m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.Map.Strict.StrictMap k v m) instance Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Map.Strict.StrictMap k v) instance Control.Monad.Trans.Class.MonadTrans (Control.Effect.Map.Strict.StrictMap k v) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.Map.Strict.StrictMap k v m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.Map.Strict.StrictMap k v m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.Map.Strict.StrictMap k v m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Effect.Map.Strict.StrictMap k v m) instance forall k1 (m :: * -> *) k2 (tag :: k1) v. (GHC.Base.Monad m, GHC.Classes.Ord k2) => Control.Effect.Map.Map' tag k2 v (Control.Effect.Map.Strict.StrictMap k2 v m) -- | The reader effect, similar to the MonadReader type class from -- the mtl library. module Control.Effect.Reader -- | An effect that adds an immutable state (i.e., an "environment") to a -- given computation. The effect allows to read values from the -- environment, pass values from function to function, and execute -- sub-computations in a modified environment. class Monad m => Reader' tag r m | tag m -> r -- | Gets the environment. ask' :: Reader' tag r m => m r -- | Executes a sub-computation in a modified environment. local' :: Reader' tag r m => (r -> r) -> m a -> m a -- | Gets a specific component of the environment, using the provided -- projection function. reader' :: Reader' tag r m => (r -> a) -> m a type Reader r_an2M = Reader' G r_an2M ask :: Reader r_an2M m_an2N => m_an2N r_an2M local :: Reader r_an2M m_an2N => (r_an2M -> r_an2M) -> m_an2N a_an2O -> m_an2N a_an2O reader :: Reader r_an2M m_an2N => (r_an2M -> a_an2P) -> m_an2N a_an2P -- | Gets a specific component of the environment, using the provided -- projection function. asks' :: forall tag r m a. Reader' tag r m => (r -> a) -> m a -- | The untagged version of asks'. asks :: Reader r m => (r -> a) -> m a -- | Runs the reader effect. runReader' :: forall tag r m a. r -> (Reader' tag r `Via` ReaderT r) m a -> m a -- | The untagged version of runReader'. runReader :: r -> (Reader r `Via` ReaderT r) m a -> m a tagReader' :: forall new_an5G r_an2M m_an5H a_an5I. Via (Reader' G r_an2M) (Tagger G new_an5G) m_an5H a_an5I -> m_an5H a_an5I retagReader' :: forall tag_an5F new_an5G r_an2M m_an5J a_an5K. Via (Reader' tag_an5F r_an2M) (Tagger tag_an5F new_an5G) m_an5J a_an5K -> m_an5J a_an5K untagReader' :: forall tag_an5F r_an2M m_an5L a_an5M. Via (Reader' tag_an5F r_an2M) (Tagger tag_an5F G) m_an5L a_an5M -> m_an5L a_an5M instance forall k (tag :: k) r (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Reader.Reader' tag r) t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia (Control.Effect.Reader.Reader' tag r : effs) t m) instance forall k (tag :: k) r (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Reader.Reader' tag r) effs t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k (tag :: k) r (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Reader.Reader' tag r) t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k1 k2 (new :: k1) r (m :: * -> *) (tag :: k2). Control.Effect.Reader.Reader' new r m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k (m :: * -> *) (tag :: k) r. GHC.Base.Monad m => Control.Effect.Reader.Reader' tag r (Control.Monad.Trans.Reader.ReaderT r m) instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Reader.Reader' tag r (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance forall k (m :: * -> *) (tag :: k) r w s. GHC.Base.Monad m => Control.Effect.Reader.Reader' tag r (Control.Monad.Trans.RWS.CPS.RWST r w s m) -- | The resource effect allows a computation to allocate resources which -- are guaranteed to be released after their usage. module Control.Effect.Resource -- | An effect that allows a computation to allocate resources which are -- guaranteed to be released after their usage. class Monad m => Resource' tag m -- | Acquire a resource, use it, and then release the resource after usage. bracket' :: Resource' tag m => m a -> (a -> m c) -> (a -> m b) -> m b -- | Like bracket', but only performs the release computation if the -- usage computation throws an exception. bracketOnError' :: Resource' tag m => m a -> (a -> m c) -> (a -> m b) -> m b type Resource = Resource' G bracket :: Resource m_anUP => m_anUP a_anUQ -> (a_anUQ -> m_anUP c_anUR) -> (a_anUQ -> m_anUP b_anUS) -> m_anUP b_anUS bracketOnError :: Resource m_anUP => m_anUP a_anUT -> (a_anUT -> m_anUP c_anUU) -> (a_anUT -> m_anUP b_anUV) -> m_anUP b_anUV -- | A simpler version of bracket' where one computation is -- guaranteed to run after another. finally' :: forall tag m a b. Resource' tag m => m a -> m b -> m a -- | The untagged version of finally'. finally :: Resource m => m a -> m b -> m a -- | A simpler version of bracketOnError' where one computation is -- guaranteed to run after another in case the first computation throws -- an exception. onException' :: forall tag m a b. Resource' tag m => m a -> m b -> m a -- | The untagged version of onException'. onException :: Resource m => m a -> m b -> m a -- | The IO-based interpreter of the resource effect. This type implements -- the Resource' type class by using bracket, thus -- requiring IO at the bottom of the monad transformer stack. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data LowerIO m a -- | Runs the resource effect using bracket. runResourceIO' :: (Resource' tag `Via` LowerIO) m a -> m a -- | The untagged version of runResourceIO'. runResourceIO :: (Resource `Via` LowerIO) m a -> m a tagResource' :: forall new_anY2 m_anY3 a_anY4. Via (Resource' G) (Tagger G new_anY2) m_anY3 a_anY4 -> m_anY3 a_anY4 retagResource' :: forall tag_anY1 new_anY2 m_anY5 a_anY6. Via (Resource' tag_anY1) (Tagger tag_anY1 new_anY2) m_anY5 a_anY6 -> m_anY5 a_anY6 untagResource' :: forall tag_anY1 m_anY7 a_anY8. Via (Resource' tag_anY1) (Tagger tag_anY1 G) m_anY7 a_anY8 -> m_anY7 a_anY8 instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Resource.LowerIO m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.Resource.LowerIO m) instance Control.Monad.Trans.Control.MonadTransControl Control.Effect.Resource.LowerIO instance Control.Monad.Trans.Class.MonadTrans Control.Effect.Resource.LowerIO instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.Resource.LowerIO m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.Resource.LowerIO m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.Resource.LowerIO m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Effect.Resource.LowerIO m) instance forall k (m :: * -> *) (tag :: k). Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m => Control.Effect.Resource.Resource' tag (Control.Effect.Resource.LowerIO m) instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Resource.Resource' tag) t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.EachVia (Control.Effect.Resource.Resource' tag : effs) t m) instance forall k (tag :: k) (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Resource.Resource' tag) effs t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Resource.Resource' tag) t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k1 k2 (new :: k1) (m :: * -> *) (tag :: k2). Control.Effect.Resource.Resource' new m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Tagger.Tagger tag new m) -- | The state effect, similar to the MonadState type class from -- the mtl library. -- -- Lazy and strict interpretations of the effect are available here: -- Control.Effect.State.Lazy and -- Control.Effect.State.Strict. module Control.Effect.State -- | An effect that adds a mutable state to a given computation. class Monad m => State' tag s m | tag m -> s -- | Gets the current state. get' :: State' tag s m => m s -- | Replaces the state with a new value. put' :: State' tag s m => s -> m () -- | Updates the state and produces a value based on the current state. state' :: State' tag s m => (s -> (s, a)) -> m a type State s_aq02 = State' G s_aq02 get :: State s_aq02 m_aq03 => m_aq03 s_aq02 put :: State s_aq02 m_aq03 => s_aq02 -> m_aq03 () state :: State s_aq02 m_aq03 => (s_aq02 -> (s_aq02, a_aq04)) -> m_aq03 a_aq04 -- | Gets a specific component of the state, using the provided projection -- function. gets' :: forall tag s m a. State' tag s m => (s -> a) -> m a -- | The untagged version of gets'. gets :: State s m => (s -> a) -> m a -- | Modifies the state, using the provided function. modify' :: forall tag s m. State' tag s m => (s -> s) -> m () -- | The untagged version of modify'. modify :: State s m => (s -> s) -> m () -- | Modifies the state, using the provided function. The computation is -- strict in the new state. modifyStrict' :: forall tag s m. State' tag s m => (s -> s) -> m () -- | The untagged version of modifyStrict'. modifyStrict :: State s m => (s -> s) -> m () tagState' :: forall new_aq33 s_aq02 m_aq34 a_aq35. Via (State' G s_aq02) (Tagger G new_aq33) m_aq34 a_aq35 -> m_aq34 a_aq35 retagState' :: forall tag_aq32 new_aq33 s_aq02 m_aq36 a_aq37. Via (State' tag_aq32 s_aq02) (Tagger tag_aq32 new_aq33) m_aq36 a_aq37 -> m_aq36 a_aq37 untagState' :: forall tag_aq32 s_aq02 m_aq38 a_aq39. Via (State' tag_aq32 s_aq02) (Tagger tag_aq32 G) m_aq38 a_aq39 -> m_aq38 a_aq39 instance forall k (tag :: k) s (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.State.State' tag s) t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia (Control.Effect.State.State' tag s : effs) t m) instance forall k (tag :: k) s (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.State.State' tag s) effs t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k (tag :: k) s (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Lift (Control.Effect.State.State' tag s) t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k1 k2 (new :: k1) s (m :: * -> *) (tag :: k2). Control.Effect.State.State' new s m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k (m :: * -> *) (tag :: k) s. GHC.Base.Monad m => Control.Effect.State.State' tag s (Control.Monad.Trans.State.Lazy.StateT s m) instance forall k (m :: * -> *) (tag :: k) s. GHC.Base.Monad m => Control.Effect.State.State' tag s (Control.Monad.Trans.State.Strict.StateT s m) instance forall k (m :: * -> *) w (tag :: k) s r. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.State.State' tag s (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance forall k (m :: * -> *) (tag :: k) s r w. GHC.Base.Monad m => Control.Effect.State.State' tag s (Control.Monad.Trans.RWS.CPS.RWST r w s m) -- | Lazy interpretations of the State' effect. -- -- If you don't require disambiguation of multiple state effects (i.e., -- you only have one state effect in your monadic context), you usually -- need the untagged interpretations. module Control.Effect.State.Lazy -- | Runs the state effect and discards the final state. evalState' :: forall tag s m a. Functor m => s -> (State' tag s `Via` StateT s) m a -> m a -- | Runs the state effect and discards the result of the interpreted -- program. execState' :: forall tag s m a. Functor m => s -> (State' tag s `Via` StateT s) m a -> m s -- | Runs the state effect and returns both the final state and the result -- of the interpreted program. runState' :: forall tag s m a. Functor m => s -> (State' tag s `Via` StateT s) m a -> m (s, a) -- | The untagged version of evalState'. evalState :: Functor m => s -> (State s `Via` StateT s) m a -> m a -- | The untagged version of execState'. execState :: Functor m => s -> (State s `Via` StateT s) m a -> m s -- | The untagged version of runState'. runState :: Functor m => s -> (State s `Via` StateT s) m a -> m (s, a) -- | Strict interpretations of the State' effect. -- -- If you don't require disambiguation of multiple state effects (i.e., -- you only have one state effect in your monadic context), you usually -- need the untagged interpretations. module Control.Effect.State.Strict -- | Runs the state effect and discards the final state. evalState' :: forall tag s m a. Functor m => s -> (State' tag s `Via` StateT s) m a -> m a -- | Runs the state effect and returns the final state. execState' :: forall tag s m a. Functor m => s -> (State' tag s `Via` StateT s) m a -> m s -- | Runs the state effect and returns both the final state and the result -- of the interpreted program. runState' :: forall tag s m a. Functor m => s -> (State' tag s `Via` StateT s) m a -> m (s, a) -- | The untagged version of evalState'. evalState :: Functor m => s -> (State s `Via` StateT s) m a -> m a -- | The untagged version of execState'. execState :: Functor m => s -> (State s `Via` StateT s) m a -> m s -- | The untagged version of runState'. runState :: Functor m => s -> (State s `Via` StateT s) m a -> m (s, a) -- | The writer effect, similar to the MonadWriter type class from -- the mtl library. -- -- Lazy and strict interpretations of the effect are available here: -- Control.Effect.Writer.Lazy and -- Control.Effect.Writer.Strict. module Control.Effect.Writer -- | An effect that adds a write-only, accumulated output to a given -- computation. class Monad m => Writer' tag w m | tag m -> w -- | Produces the output w. In other words, w is appended -- to the accumulated output. tell' :: Writer' tag w m => w -> m () -- | Executes a sub-computation and appends w to the accumulated -- output. listen' :: Writer' tag w m => m a -> m (w, a) -- | Executes a sub-computation and applies the function to its output. censor' :: Writer' tag w m => (w -> w) -> m a -> m a type Writer w_araD = Writer' G w_araD tell :: Writer w_araD m_araE => w_araD -> m_araE () listen :: Writer w_araD m_araE => m_araE a_araF -> m_araE (w_araD, a_araF) censor :: Writer w_araD m_araE => (w_araD -> w_araD) -> m_araE a_araG -> m_araE a_araG -- | Executes a sub-computation and applies the function to its output, -- thus adding an additional value to the result of the sub-computation. listens' :: forall tag w b m a. Writer' tag w m => (w -> b) -> m a -> m (b, a) -- | The untagged version of listens'. listens :: Writer w m => (w -> b) -> m a -> m (b, a) tagWriter' :: forall new_ard7 w_araD m_ard8 a_ard9. Via (Writer' G w_araD) (Tagger G new_ard7) m_ard8 a_ard9 -> m_ard8 a_ard9 retagWriter' :: forall tag_ard6 new_ard7 w_araD m_arda a_ardb. Via (Writer' tag_ard6 w_araD) (Tagger tag_ard6 new_ard7) m_arda a_ardb -> m_arda a_ardb untagWriter' :: forall tag_ard6 w_araD m_ardc a_ardd. Via (Writer' tag_ard6 w_araD) (Tagger tag_ard6 G) m_ardc a_ardd -> m_ardc a_ardd instance forall k (tag :: k) w (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Writer.Writer' tag w) t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia (Control.Effect.Writer.Writer' tag w : effs) t m) instance forall k (tag :: k) w (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Writer.Writer' tag w) effs t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k (tag :: k) w (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Writer.Writer' tag w) t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k1 k2 (new :: k1) w (m :: * -> *) (tag :: k2). Control.Effect.Writer.Writer' new w m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Tagger.Tagger tag new m) instance forall k (m :: * -> *) w (tag :: k). (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance forall k (m :: * -> *) w (tag :: k). (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Monad.Trans.Writer.CPS.WriterT w m) instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Monad.Trans.RWS.CPS.RWST r w s m) -- | The effect that combines the reader, writer and state effect, similar -- to the MonadRWS type class from the mtl library. -- -- Lazy and strict interpretations of the effect are available here: -- Control.Effect.RWS.Lazy and Control.Effect.RWS.Strict. module Control.Effect.RWS -- | An effect that adds the following features to a given computation: -- -- class (Reader' tag r m, Writer' tag w m, State' tag s m) => RWS' tag r w s m | tag m -> r w s type RWS r w s = RWS' G r w s -- | The separation interpreter of the RWS effect. This type implements the -- RWS' type class by splitting the effect into separate -- Reader', Writer' and State' effects which can -- then be interpreted individually. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data Separation m a -- | Runs the RWS effect via separation. runSeparatedRWS' :: ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` Separation) m a -> m a -- | The untagged version of runSeparatedRWS'. runSeparatedRWS :: ('[RWS r w s, Reader r, Writer w, State s] `EachVia` Separation) m a -> m a -- | The tagging interpreter of the RWS effect. This type implements the -- RWS' type class by tagging/retagging/untagging its reader, -- writer and state components. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data Tagger tag new m a tagRWS' :: forall new r w s m a. ('[RWS' G r w s, Reader' G r, Writer' G w, State' G s] `EachVia` Tagger G new) m a -> m a retagRWS' :: forall tag new r w s m a. ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` Tagger tag new) m a -> m a untagRWS' :: forall tag r w s m a. ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` Tagger tag G) m a -> m a instance forall (b :: * -> *) k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.RWS.Tagger tag new m) instance forall (b :: * -> *) k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.RWS.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2). Control.Monad.Trans.Control.MonadTransControl (Control.Effect.RWS.Tagger tag new) instance forall k1 (tag :: k1) k2 (new :: k2). Control.Monad.Trans.Class.MonadTrans (Control.Effect.RWS.Tagger tag new) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.RWS.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.RWS.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.RWS.Tagger tag new m) instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Applicative m => GHC.Base.Applicative (Control.Effect.RWS.Tagger tag new m) instance forall k (tag :: k) s (m :: * -> *). Control.Effect.State.State' tag s m => Control.Effect.State.State' tag s (Control.Effect.RWS.Separation m) instance forall k (tag :: k) w (m :: * -> *). Control.Effect.Writer.Writer' tag w m => Control.Effect.Writer.Writer' tag w (Control.Effect.RWS.Separation m) instance forall k (tag :: k) r (m :: * -> *). Control.Effect.Reader.Reader' tag r m => Control.Effect.Reader.Reader' tag r (Control.Effect.RWS.Separation m) instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.RWS.Separation m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.RWS.Separation m) instance Control.Monad.Trans.Control.MonadTransControl Control.Effect.RWS.Separation instance Control.Monad.Trans.Class.MonadTrans Control.Effect.RWS.Separation instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.RWS.Separation m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.RWS.Separation m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.RWS.Separation m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Effect.RWS.Separation m) instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.RWS.Tagger tag new m) instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.Reader.Reader' tag r (Control.Effect.RWS.Tagger tag new m) instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.Writer.Writer' tag w (Control.Effect.RWS.Tagger tag new m) instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.State.State' tag s (Control.Effect.RWS.Tagger tag new m) instance forall k (tag :: k) r (m :: * -> *) w s. (Control.Effect.Reader.Reader' tag r m, Control.Effect.Writer.Writer' tag w m, Control.Effect.State.State' tag s m) => Control.Effect.RWS.RWS' tag r w s (Control.Effect.RWS.Separation m) instance forall k (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: Control.Effect.Machinery.Via.SomeMonad) (tag :: k) r (effs :: [Control.Effect.Machinery.Via.Effect]) w s. (GHC.Base.Monad (t m), Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia effs t m), Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia effs t m), Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia effs t m)) => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.EachVia (Control.Effect.RWS.RWS' tag r w s : effs) t m) instance forall k (tag :: k) r w s (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: Control.Effect.Machinery.Via.SomeMonad) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.RWS.RWS' tag r w s) effs t m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.EachVia (other : effs) t m) instance forall k (tag :: k) r w s (t :: Control.Effect.Machinery.Via.Transformer) (m :: Control.Effect.Machinery.Via.SomeMonad). Control.Effect.Machinery.Via.Control (Control.Effect.RWS.RWS' tag r w s) t m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.EachVia '[] t m) instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.RWS.RWS' tag r w s (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.RWS.RWS' tag r w s (Control.Monad.Trans.RWS.CPS.RWST r w s m) -- | Strict interpretations of the RWS' effect. -- -- If you don't require disambiguation of multiple RWS effects (i.e., you -- only have one RWS effect in your monadic context), you usually need -- the untagged interpretations. module Control.Effect.RWS.Strict -- | The strict interpreter of the RWS effect. This type implements the -- RWS' type class in a strict manner. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data RWST r w s m a -- | Runs the RWS effect and discards the final state. evalRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, a) -- | Runs the RWS effect and discards the result of the interpreted -- program. execRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s) -- | Runs the RWS effect and returns the final output, the final state and -- the result of the interpreted program. runRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s, a) -- | The untagged version of evalRWS'. evalRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, a) -- | The untagged version of execRWS'. execRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s) -- | The untagged version of runRWS'. runRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s, a) instance forall k (tag :: k) r w s (m :: * -> *). GHC.Base.Monad m => Control.Effect.State.State' tag s (Control.Effect.RWS.Strict.RWST r w s m) instance forall k (tag :: k) r w s (m :: * -> *). (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Effect.RWS.Strict.RWST r w s m) instance forall k (tag :: k) r w s (m :: * -> *). GHC.Base.Monad m => Control.Effect.Reader.Reader' tag r (Control.Effect.RWS.Strict.RWST r w s m) instance forall k (tag :: k) r w s (m :: * -> *). (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.RWS.RWS' tag r w s (Control.Effect.RWS.Strict.RWST r w s m) instance Control.Monad.Trans.Class.MonadTrans (Control.Effect.RWS.Strict.RWST r w s) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.RWS.Strict.RWST r w s m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.RWS.Strict.RWST r w s m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.RWS.Strict.RWST r w s m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Effect.RWS.Strict.RWST r w s m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.RWS.Strict.RWST r w s m) instance (Control.Monad.Trans.Control.MonadBaseControl b m, GHC.Base.Monoid w) => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.RWS.Strict.RWST r w s m) instance GHC.Base.Monoid w => Control.Monad.Trans.Control.MonadTransControl (Control.Effect.RWS.Strict.RWST r w s) -- | Lazy interpretations of the RWS' effect. -- -- If you don't require disambiguation of multiple RWS effects (i.e., you -- only have one RWS effect in your monadic context), you usually need -- the untagged interpretations. module Control.Effect.RWS.Lazy -- | Runs the RWS effect and discards the final state. evalRWS' :: forall tag r w s m a. Functor m => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, a) -- | Runs the RWS effect and discards the result of the interpreted -- program. execRWS' :: forall tag r w s m a. Functor m => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s) -- | Runs the RWS effect and returns the final output, the final state and -- the result of the interpreted program. runRWS' :: forall tag r w s m a. Functor m => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s, a) -- | The untagged version of evalRWS'. evalRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, a) -- | The untagged version of execRWS'. execRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s) -- | The untagged version of runRWS'. runRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s, a) -- | Lazy interpretations of the Writer' effect. -- -- If you don't require disambiguation of multiple writer effects (i.e., -- you only have one writer effect in your monadic context), you usually -- need the untagged interpretations. module Control.Effect.Writer.Lazy -- | Runs the writer effect and returns the final output. execWriter' :: forall tag w m a. Monad m => (Writer' tag w `Via` WriterT w) m a -> m w -- | Runs the writer effect and returns both the final output and the -- result of the interpreted program. runWriter' :: forall tag w m a. Functor m => (Writer' tag w `Via` WriterT w) m a -> m (w, a) -- | The untagged version of execWriter'. execWriter :: Monad m => (Writer w `Via` WriterT w) m a -> m w -- | The untagged version of runWriter'. runWriter :: Functor m => (Writer w `Via` WriterT w) m a -> m (w, a) -- | Strict interpretations of the Writer' effect. -- -- If you don't require disambiguation of multiple writer effects (i.e., -- you only have one writer effect in your monadic context), you usually -- need the untagged interpretations. module Control.Effect.Writer.Strict -- | The strict interpreter of the writer effect. This type implements the -- Writer' type class in a strict manner. -- -- When interpreting the effect, you usually don't interact with this -- type directly, but instead use one of its corresponding interpretation -- functions. data WriterT w m a -- | Runs the writer effect and returns the final output. execWriter' :: forall tag w m a. (Monad m, Monoid w) => (Writer' tag w `Via` WriterT w) m a -> m w -- | Runs the writer effect and returns both the final output and the -- result of the interpreted program. runWriter' :: forall tag w m a. (Functor m, Monoid w) => (Writer' tag w `Via` WriterT w) m a -> m (w, a) -- | The untagged version of execWriter'. execWriter :: (Monad m, Monoid w) => (Writer w `Via` WriterT w) m a -> m w -- | The untagged version of runWriter'. runWriter :: (Functor m, Monoid w) => (Writer w `Via` WriterT w) m a -> m (w, a) instance forall k (tag :: k) w (m :: * -> *). (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Effect.Writer.Strict.WriterT w m) instance Control.Monad.Trans.Class.MonadTrans (Control.Effect.Writer.Strict.WriterT w) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.Writer.Strict.WriterT w m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.Writer.Strict.WriterT w m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.Writer.Strict.WriterT w m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Effect.Writer.Strict.WriterT w m) instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.Writer.Strict.WriterT w m) instance (Control.Monad.Trans.Control.MonadBaseControl b m, GHC.Base.Monoid w) => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Writer.Strict.WriterT w m) instance GHC.Base.Monoid w => Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Writer.Strict.WriterT w)