-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Adjunctions and representable functors -- -- Adjunctions and representable functors. @package adjunctions @version 4.4 -- |
-- Cont r ~ Contravariant.Adjoint (Op r) (Op r) -- Conts r ~ Contravariant.AdjointT (Op r) (Op r) -- ContsT r w m ~ Contravariant.AdjointT (Op (m r)) (Op (m r)) w --module Control.Monad.Trans.Conts type Cont r = ContsT r Identity Identity cont :: ((a -> r) -> r) -> Cont r a runCont :: Cont r a -> (a -> r) -> r type Conts r w = ContsT r w Identity runConts :: Functor w => Conts r w a -> w (a -> r) -> r conts :: Functor w => (w (a -> r) -> r) -> Conts r w a newtype ContsT r w m a ContsT :: (w (a -> m r) -> m r) -> ContsT r w m a [runContsT] :: ContsT r w m a -> w (a -> m r) -> m r callCC :: Comonad w => ((a -> ContsT r w m b) -> ContsT r w m a) -> ContsT r w m a instance GHC.Base.Functor w => GHC.Base.Functor (Control.Monad.Trans.Conts.ContsT r w m) instance Control.Comonad.Comonad w => Data.Functor.Bind.Class.Apply (Control.Monad.Trans.Conts.ContsT r w m) instance Control.Comonad.Comonad w => GHC.Base.Applicative (Control.Monad.Trans.Conts.ContsT r w m) instance Control.Comonad.Comonad w => GHC.Base.Monad (Control.Monad.Trans.Conts.ContsT r w m) instance Control.Comonad.Comonad w => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Conts.ContsT r w) -- | Representable contravariant endofunctors over the category of Haskell -- types are isomorphic to (_ -> r) and resemble mappings to -- a fixed range. module Data.Functor.Contravariant.Rep -- | A Contravariant functor f is Representable if -- tabulate and index witness an isomorphism to (_ -- -> Rep f). -- --
-- tabulate . index ≡ id -- index . tabulate ≡ id --class Contravariant f => Representable f where { type family Rep f :: *; } -- |
-- contramap f (tabulate g) = tabulate (g . f) --tabulate :: Representable f => (a -> Rep f) -> f a index :: Representable f => f a -> a -> Rep f -- |
-- contramapWithRep f p ≡ tabulate $ either (index p) id . f --contramapWithRep :: Representable f => (b -> Either a (Rep f)) -> f a -> f b -- | tabulate and index form two halves of an isomorphism. -- -- This can be used with the combinators from the lens package. -- --
-- tabulated :: Representable f => Iso' (a -> Rep f) (f a) --tabulated :: (Representable f, Representable g, Profunctor p, Functor h) => p (f a) (h (g b)) -> p (a -> Rep f) (h (b -> Rep g)) contramapRep :: Representable f => (a -> b) -> f b -> f a instance Data.Functor.Contravariant.Rep.Representable Data.Proxy.Proxy instance Data.Functor.Contravariant.Rep.Representable (Data.Functor.Contravariant.Op r) instance Data.Functor.Contravariant.Rep.Representable Data.Functor.Contravariant.Predicate instance (Data.Functor.Contravariant.Rep.Representable f, Data.Functor.Contravariant.Rep.Representable g) => Data.Functor.Contravariant.Rep.Representable (Data.Functor.Product.Product f g) instance Data.Functor.Contravariant.Rep.Representable GHC.Generics.U1 instance (Data.Functor.Contravariant.Rep.Representable f, Data.Functor.Contravariant.Rep.Representable g) => Data.Functor.Contravariant.Rep.Representable (f GHC.Generics.:*: g) module Data.Functor.Contravariant.Adjunction -- | An adjunction from Hask^op to Hask -- --
-- Op (f a) b ~ Hask a (g b) ---- --
-- rightAdjunct unit = id -- leftAdjunct counit = id ---- -- Any adjunction from Hask to Hask^op would indirectly -- permit unsafePerformIO, and therefore does not exist. class (Contravariant f, Representable g) => Adjunction f g | f -> g, g -> f unit :: Adjunction f g => a -> g (f a) counit :: Adjunction f g => a -> f (g a) leftAdjunct :: Adjunction f g => (b -> f a) -> a -> g b rightAdjunct :: Adjunction f g => (a -> g b) -> b -> f a -- | leftAdjunct and rightAdjunct form two halves of an -- isomorphism. -- -- This can be used with the combinators from the lens package. -- --
-- adjuncted :: Adjunction f g => Iso' (b -> f a) (a -> g b) --adjuncted :: (Adjunction f g, Profunctor p, Functor h) => p (a -> g b) (h (c -> g d)) -> p (b -> f a) (h (d -> f c)) -- | Represent a Contravariant functor that has a left adjoint contrarepAdjunction :: Adjunction f g => (a -> f ()) -> g a coindexAdjunction :: Adjunction f g => g a -> a -> f () instance Data.Functor.Contravariant.Adjunction.Adjunction (Data.Functor.Contravariant.Op r) (Data.Functor.Contravariant.Op r) instance Data.Functor.Contravariant.Adjunction.Adjunction Data.Functor.Contravariant.Predicate Data.Functor.Contravariant.Predicate -- | Uses a contravariant adjunction: -- -- f -| g : Hask^op -> Hask -- -- to build a Comonad to Monad transformer. Sadly, the dual -- construction, which builds a Comonad out of a Monad, is -- uninhabited, because any Adjunction of the form -- --
-- f -| g : Hask -> Hask^op ---- -- would trivially admit unsafePerformIO. module Control.Monad.Trans.Contravariant.Adjoint type Adjoint f g = AdjointT f g Identity runAdjoint :: Contravariant g => Adjoint f g a -> g (f a) adjoint :: Contravariant g => g (f a) -> Adjoint f g a newtype AdjointT f g w a AdjointT :: g (w (f a)) -> AdjointT f g w a [runAdjointT] :: AdjointT f g w a -> g (w (f a)) instance (Data.Functor.Contravariant.Adjunction.Adjunction f g, GHC.Base.Functor w) => GHC.Base.Functor (Control.Monad.Trans.Contravariant.Adjoint.AdjointT f g w) instance (Data.Functor.Contravariant.Adjunction.Adjunction f g, Control.Comonad.Comonad w) => GHC.Base.Applicative (Control.Monad.Trans.Contravariant.Adjoint.AdjointT f g w) instance (Data.Functor.Contravariant.Adjunction.Adjunction f g, Control.Comonad.Comonad w) => GHC.Base.Monad (Control.Monad.Trans.Contravariant.Adjoint.AdjointT f g w) -- | Representable endofunctors over the category of Haskell types are -- isomorphic to the reader monad and so inherit a very large number of -- properties for free. module Data.Functor.Rep -- | A Functor f is Representable if tabulate -- and index witness an isomorphism to (->) x. -- -- Every Distributive Functor is actually -- Representable. -- -- Every Representable Functor from Hask to Hask is a right -- adjoint. -- --
-- tabulate . index ≡ id -- index . tabulate ≡ id -- tabulate . return ≡ return --class Distributive f => Representable f where { type family Rep f :: *; type Rep f = GRep f; } -- |
-- fmap f . tabulate ≡ tabulate . fmap f ---- -- If no definition is provided, this will default to gtabulate. tabulate :: Representable f => (Rep f -> a) -> f a -- |
-- fmap f . tabulate ≡ tabulate . fmap f ---- -- If no definition is provided, this will default to gtabulate. tabulate :: (Representable f, Generic1 f, GRep f ~ Rep f, GTabulate (Rep1 f)) => (Rep f -> a) -> f a -- | If no definition is provided, this will default to gindex. index :: Representable f => f a -> Rep f -> a -- | If no definition is provided, this will default to gindex. index :: (Representable f, Generic1 f, GRep f ~ Rep f, GIndex (Rep1 f)) => f a -> Rep f -> a -- | tabulate and index form two halves of an isomorphism. -- -- This can be used with the combinators from the lens package. -- --
-- tabulated :: Representable f => Iso' (Rep f -> a) (f a) --tabulated :: (Representable f, Representable g, Profunctor p, Functor h) => p (f a) (h (g b)) -> p (Rep f -> a) (h (Rep g -> b)) newtype Co f a Co :: f a -> Co f a [unCo] :: Co f a -> f a fmapRep :: Representable f => (a -> b) -> f a -> f b distributeRep :: (Representable f, Functor w) => w (f a) -> f (w a) collectRep :: (Representable f, Functor w) => (a -> f b) -> w a -> f (w b) apRep :: Representable f => f (a -> b) -> f a -> f b pureRep :: Representable f => a -> f a liftR2 :: Representable f => (a -> b -> c) -> f a -> f b -> f c liftR3 :: Representable f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d bindRep :: Representable f => f a -> (a -> f b) -> f b mfixRep :: Representable f => (a -> f a) -> f a mzipRep :: Representable f => f a -> f b -> f (a, b) mzipWithRep :: Representable f => (a -> b -> c) -> f a -> f b -> f c askRep :: Representable f => f (Rep f) localRep :: Representable f => (Rep f -> Rep f) -> f a -> f a duplicatedRep :: (Representable f, Semigroup (Rep f)) => f a -> f (f a) extendedRep :: (Representable f, Semigroup (Rep f)) => (f a -> b) -> f a -> f b duplicateRep :: (Representable f, Monoid (Rep f)) => f a -> f (f a) extendRep :: (Representable f, Monoid (Rep f)) => (f a -> b) -> f a -> f b extractRep :: (Representable f, Monoid (Rep f)) => f a -> a duplicateRepBy :: Representable f => (Rep f -> Rep f -> Rep f) -> f a -> f (f a) extendRepBy :: Representable f => (Rep f -> Rep f -> Rep f) -> (f a -> b) -> f a -> f b extractRepBy :: Representable f => (Rep f) -> f a -> a imapRep :: Representable r => (Rep r -> a -> a') -> (r a -> r a') ifoldMapRep :: forall r m a. (Representable r, Foldable r, Monoid m) => (Rep r -> a -> m) -> (r a -> m) itraverseRep :: forall r f a a'. (Representable r, Traversable r, Applicative f) => (Rep r -> a -> f a') -> (r a -> f (r a')) -- | A default implementation of Rep for a datatype that is an -- instance of Generic1. This is usually composed of -- Either, tuples, unit tuples, and underlying Rep values. -- For instance, if you have: -- --
-- data Foo a = MkFoo a (Bar a) (Baz (Quux a)) deriving (Functor, Generic1) -- instance Representable Foo ---- -- Then you'll get: -- --
-- GRep Foo = Either () (Either (WrappedRep Bar) (WrappedRep Baz, WrappedRep Quux)) ---- -- (See the Haddocks for WrappedRep for an explanation of its -- purpose.) type GRep f = GRep' (Rep1 f) -- | A default implementation of index in terms of GRep. gindex :: (Generic1 f, GRep f ~ Rep f, GIndex (Rep1 f)) => f a -> Rep f -> a -- | A default implementation of tabulate in terms of GRep. gtabulate :: (Generic1 f, GRep f ~ Rep f, GTabulate (Rep1 f)) => (Rep f -> a) -> f a -- | On the surface, WrappedRec is a simple wrapper around -- Rep. But it plays a very important role: it prevents generic -- Representable instances for recursive types from sending the -- typechecker into an infinite loop. Consider the following datatype: -- --
-- data Stream a = a :< Stream a deriving (Functor, Generic1) -- instance Representable Stream ---- -- With WrappedRep, we have its Rep being: -- --
-- Rep Stream = Either () (WrappedRep Stream) ---- -- If WrappedRep didn't exist, it would be: -- --
-- Rep Stream = Either () (Either () (Either () ...)) ---- -- An infinite type! WrappedRep breaks the potentially infinite -- loop. newtype WrappedRep f WrapRep :: Rep f -> WrappedRep f [unwrapRep] :: WrappedRep f -> Rep f instance GHC.Base.Functor f => GHC.Base.Functor (Data.Functor.Rep.Co f) instance Data.Functor.Rep.Representable w => Data.Functor.Rep.Representable (Control.Comonad.Trans.Traced.TracedT s w) instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (Data.Functor.Rep.Co f) instance Data.Functor.Rep.Representable f => Data.Functor.Bind.Class.Apply (Data.Functor.Rep.Co f) instance Data.Functor.Rep.Representable f => GHC.Base.Applicative (Data.Functor.Rep.Co f) instance Data.Functor.Rep.Representable f => Data.Distributive.Distributive (Data.Functor.Rep.Co f) instance Data.Functor.Rep.Representable f => Data.Functor.Bind.Class.Bind (Data.Functor.Rep.Co f) instance Data.Functor.Rep.Representable f => GHC.Base.Monad (Data.Functor.Rep.Co f) instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Rep f ~ a) => Control.Monad.Reader.Class.MonadReader a (Data.Functor.Rep.Co f) instance (Data.Functor.Rep.Representable f, Data.Semigroup.Semigroup (Data.Functor.Rep.Rep f)) => Data.Functor.Extend.Extend (Data.Functor.Rep.Co f) instance (Data.Functor.Rep.Representable f, GHC.Base.Monoid (Data.Functor.Rep.Rep f)) => Control.Comonad.Comonad (Data.Functor.Rep.Co f) instance Control.Comonad.Trans.Class.ComonadTrans Data.Functor.Rep.Co instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.GTabulate g) => Data.Functor.Rep.GTabulate (f GHC.Generics.:.: g) instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.GIndex g) => Data.Functor.Rep.GIndex (f GHC.Generics.:.: g) instance Data.Functor.Rep.Representable f => Data.Functor.Rep.GTabulate (GHC.Generics.Rec1 f) instance Data.Functor.Rep.Representable f => Data.Functor.Rep.GIndex (GHC.Generics.Rec1 f) instance Data.Functor.Rep.Representable Data.Proxy.Proxy instance Data.Functor.Rep.Representable Data.Functor.Identity.Identity instance Data.Functor.Rep.Representable (Data.Tagged.Tagged t) instance Data.Functor.Rep.Representable m => Data.Functor.Rep.Representable (Control.Monad.Trans.Identity.IdentityT m) instance Data.Functor.Rep.Representable ((->) e) instance Data.Functor.Rep.Representable m => Data.Functor.Rep.Representable (Control.Monad.Trans.Reader.ReaderT e m) instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Functor.Rep.Representable (Data.Functor.Compose.Compose f g) instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Functor.Rep.Representable (Data.Functor.Product.Product f g) instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (Control.Comonad.Cofree.Cofree f) instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (Control.Applicative.Backwards.Backwards f) instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (Data.Functor.Reverse.Reverse f) instance Data.Functor.Rep.Representable Data.Monoid.Dual instance Data.Functor.Rep.Representable Data.Monoid.Product instance Data.Functor.Rep.Representable Data.Monoid.Sum instance Data.Functor.Rep.Representable Data.Complex.Complex instance Data.Functor.Rep.Representable GHC.Generics.U1 instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Functor.Rep.Representable (f GHC.Generics.:*: g) instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Functor.Rep.Representable (f GHC.Generics.:.: g) instance Data.Functor.Rep.Representable GHC.Generics.Par1 instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (GHC.Generics.Rec1 f) instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (GHC.Generics.M1 i c f) instance (Data.Functor.Rep.GIndex f, Data.Functor.Rep.GIndex g) => Data.Functor.Rep.GIndex (f GHC.Generics.:*: g) instance Data.Functor.Rep.GIndex GHC.Generics.Par1 instance Data.Functor.Rep.GIndex f => Data.Functor.Rep.GIndex (GHC.Generics.M1 i c f) instance (Data.Functor.Rep.GTabulate f, Data.Functor.Rep.GTabulate g) => Data.Functor.Rep.GTabulate (f GHC.Generics.:*: g) instance Data.Functor.Rep.GTabulate GHC.Generics.Par1 instance Data.Functor.Rep.GTabulate f => Data.Functor.Rep.GTabulate (GHC.Generics.M1 i c f) module Data.Functor.Adjunction -- | An adjunction between Hask and Hask. -- -- Minimal definition: both unit and counit or both -- leftAdjunct and rightAdjunct, subject to the constraints -- imposed by the default definitions that the following laws should -- hold. -- --
-- unit = leftAdjunct id -- counit = rightAdjunct id -- leftAdjunct f = fmap f . unit -- rightAdjunct f = counit . fmap f ---- -- Any implementation is required to ensure that leftAdjunct and -- rightAdjunct witness an isomorphism from Nat (f a, b) -- to Nat (a, g b) -- --
-- rightAdjunct unit = id -- leftAdjunct counit = id --class (Functor f, Representable u) => Adjunction f u | f -> u, u -> f unit :: Adjunction f u => a -> u (f a) counit :: Adjunction f u => f (u a) -> a leftAdjunct :: Adjunction f u => (f a -> b) -> a -> u b rightAdjunct :: Adjunction f u => (a -> u b) -> f a -> b -- | leftAdjunct and rightAdjunct form two halves of an -- isomorphism. -- -- This can be used with the combinators from the lens package. -- --
-- adjuncted :: Adjunction f u => Iso' (f a -> b) (a -> u b) --adjuncted :: (Adjunction f u, Profunctor p, Functor g) => p (a -> u b) (g (c -> u d)) -> p (f a -> b) (g (f c -> d)) -- | Every right adjoint is representable by its left adjoint applied to a -- unit element -- -- Use this definition and the primitives in Data.Functor.Representable -- to meet the requirements of the superclasses of Representable. tabulateAdjunction :: Adjunction f u => (f () -> b) -> u b -- | This definition admits a default definition for the index -- method of 'Index", one of the superclasses of Representable. indexAdjunction :: Adjunction f u => u b -> f a -> b zapWithAdjunction :: Adjunction f u => (a -> b -> c) -> u a -> f b -> c -- | A right adjoint functor admits an intrinsic notion of zipping zipR :: Adjunction f u => (u a, u b) -> u (a, b) -- | Every functor in Haskell permits unzipping unzipR :: Functor u => u (a, b) -> (u a, u b) -- | A left adjoint must be inhabited, or we can derive bottom. unabsurdL :: Adjunction f u => f Void -> Void absurdL :: Void -> f Void -- | And a left adjoint must be inhabited by exactly one element cozipL :: Adjunction f u => f (Either a b) -> Either (f a) (f b) -- | Every functor in Haskell permits uncozipping uncozipL :: Functor f => Either (f a) (f b) -> f (Either a b) extractL :: Adjunction f u => f a -> a duplicateL :: Adjunction f u => f a -> f (f a) splitL :: Adjunction f u => f a -> (a, f ()) unsplitL :: Functor f => a -> f () -> f a instance Data.Functor.Adjunction.Adjunction ((,) e) ((->) e) instance Data.Functor.Adjunction.Adjunction Data.Functor.Identity.Identity Data.Functor.Identity.Identity instance Data.Functor.Adjunction.Adjunction f g => Data.Functor.Adjunction.Adjunction (Control.Monad.Trans.Identity.IdentityT f) (Control.Monad.Trans.Identity.IdentityT g) instance Data.Functor.Adjunction.Adjunction w m => Data.Functor.Adjunction.Adjunction (Control.Comonad.Trans.Env.EnvT e w) (Control.Monad.Trans.Reader.ReaderT e m) instance Data.Functor.Adjunction.Adjunction m w => Data.Functor.Adjunction.Adjunction (Control.Monad.Trans.Writer.Lazy.WriterT s m) (Control.Comonad.Trans.Traced.TracedT s w) instance (Data.Functor.Adjunction.Adjunction f g, Data.Functor.Adjunction.Adjunction f' g') => Data.Functor.Adjunction.Adjunction (Data.Functor.Compose.Compose f' f) (Data.Functor.Compose.Compose g g') instance (Data.Functor.Adjunction.Adjunction f g, Data.Functor.Adjunction.Adjunction f' g') => Data.Functor.Adjunction.Adjunction (Data.Functor.Sum.Sum f f') (Data.Functor.Product.Product g g') instance Data.Functor.Adjunction.Adjunction f u => Data.Functor.Adjunction.Adjunction (Control.Monad.Free.Free f) (Control.Comonad.Cofree.Cofree u) instance Data.Functor.Adjunction.Adjunction GHC.Generics.V1 GHC.Generics.U1 instance Data.Functor.Adjunction.Adjunction GHC.Generics.Par1 GHC.Generics.Par1 instance Data.Functor.Adjunction.Adjunction f g => Data.Functor.Adjunction.Adjunction (GHC.Generics.Rec1 f) (GHC.Generics.Rec1 g) instance (Data.Functor.Adjunction.Adjunction f g, Data.Functor.Adjunction.Adjunction f' g') => Data.Functor.Adjunction.Adjunction (f' GHC.Generics.:.: f) (g GHC.Generics.:.: g') instance (Data.Functor.Adjunction.Adjunction f g, Data.Functor.Adjunction.Adjunction f' g') => Data.Functor.Adjunction.Adjunction (f GHC.Generics.:+: f') (g GHC.Generics.:*: g') module Control.Monad.Trans.Adjoint type Adjoint f g = AdjointT f g Identity runAdjoint :: Functor g => Adjoint f g a -> g (f a) adjoint :: Functor g => g (f a) -> Adjoint f g a newtype AdjointT f g m a AdjointT :: g (m (f a)) -> AdjointT f g m a [runAdjointT] :: AdjointT f g m a -> g (m (f a)) instance (Data.Functor.Adjunction.Adjunction f g, GHC.Base.Monad m) => GHC.Base.Functor (Control.Monad.Trans.Adjoint.AdjointT f g m) instance (Data.Functor.Adjunction.Adjunction f g, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Monad.Trans.Adjoint.AdjointT f g m) instance (Data.Functor.Adjunction.Adjunction f g, GHC.Base.Monad m) => GHC.Base.Monad (Control.Monad.Trans.Adjoint.AdjointT f g m) instance (Data.Functor.Adjunction.Adjunction f g, Data.Traversable.Traversable f) => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Adjoint.AdjointT f g) module Control.Comonad.Trans.Adjoint type Adjoint f g = AdjointT f g Identity runAdjoint :: Functor f => Adjoint f g a -> f (g a) adjoint :: Functor f => f (g a) -> Adjoint f g a newtype AdjointT f g w a AdjointT :: f (w (g a)) -> AdjointT f g w a [runAdjointT] :: AdjointT f g w a -> f (w (g a)) instance (Data.Functor.Adjunction.Adjunction f g, GHC.Base.Functor w) => GHC.Base.Functor (Control.Comonad.Trans.Adjoint.AdjointT f g w) instance (Data.Functor.Adjunction.Adjunction f g, Data.Functor.Extend.Extend w) => Data.Functor.Extend.Extend (Control.Comonad.Trans.Adjoint.AdjointT f g w) instance (Data.Functor.Adjunction.Adjunction f g, Control.Comonad.Comonad w) => Control.Comonad.Comonad (Control.Comonad.Trans.Adjoint.AdjointT f g w) instance (Data.Functor.Adjunction.Adjunction f g, Data.Distributive.Distributive g) => Control.Comonad.Trans.Class.ComonadTrans (Control.Comonad.Trans.Adjoint.AdjointT f g) -- | A generalized State monad, parameterized by a Representable functor. -- The representation of that functor serves as the state. module Control.Monad.Representable.State -- | A memoized state monad parameterized by a representable functor -- g, where the representatation of g, Rep g -- is the state to carry. -- -- 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 g = StateT g Identity -- | Unwrap a state monad computation as a function. (The inverse of -- state.) runState :: Representable g => State g a -> Rep g -> (a, Rep g) -- | Evaluate a state computation with the given initial state and return -- the final value, discarding the final state. -- -- evalState :: Representable g => State g a -> Rep g -> a -- | Evaluate a state computation with the given initial state and return -- the final state, discarding the final value. -- -- execState :: Representable g => State g a -> Rep g -> Rep g -- | Map both the return value and final state of a computation using the -- given function. -- -- mapState :: Functor g => ((a, Rep g) -> (b, Rep g)) -> State g a -> State g b -- | A state transformer monad parameterized by: -- --
evalStateT m s = liftM fst -- (runStateT m s)
execStateT m s = liftM snd -- (runStateT m s)