-- 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.3

-- | 
--   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 :: Type -> Type) = 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 :: Type -> Type) (m :: Type -> Type) a
ContsT :: (w (a -> m r) -> m r) -> ContsT r (w :: Type -> Type) (m :: Type -> Type) a
[runContsT] :: ContsT r (w :: Type -> Type) (m :: Type -> Type) a -> w (a -> m r) -> m r
callCC :: forall (w :: Type -> Type) a r (m :: Type -> Type) b. Comonad w => ((a -> ContsT r w m b) -> ContsT r w m a) -> ContsT r w m a
instance Control.Comonad.Comonad w => GHC.Internal.Base.Applicative (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 GHC.Internal.Base.Functor w => GHC.Internal.Base.Functor (Control.Monad.Trans.Conts.ContsT r w m)
instance Control.Comonad.Comonad w => GHC.Internal.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 :: Type -> Type) where {
    type Rep (f :: Type -> Type);
}

-- | 
--   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 f, Data.Functor.Contravariant.Rep.Representable g) => Data.Functor.Contravariant.Rep.Representable (f GHC.Internal.Generics.:*: g)
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.Internal.Data.Proxy.Proxy
instance Data.Functor.Contravariant.Rep.Representable GHC.Internal.Generics.U1

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 :: Type -> Type) (g :: Type -> Type) | 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 :: Type -> Type) (g :: Type -> Type) = 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 :: Type -> Type) (g :: Type -> Type) (w :: Type -> Type) a
AdjointT :: g (w (f a)) -> AdjointT (f :: Type -> Type) (g :: Type -> Type) (w :: Type -> Type) a
[runAdjointT] :: AdjointT (f :: Type -> Type) (g :: Type -> Type) (w :: Type -> Type) a -> g (w (f a))
instance (Data.Functor.Contravariant.Adjunction.Adjunction f g, Control.Comonad.Comonad w) => GHC.Internal.Base.Applicative (Control.Monad.Trans.Contravariant.Adjoint.AdjointT f g w)
instance (Data.Functor.Contravariant.Adjunction.Adjunction f g, GHC.Internal.Base.Functor w) => GHC.Internal.Base.Functor (Control.Monad.Trans.Contravariant.Adjoint.AdjointT f g w)
instance (Data.Functor.Contravariant.Adjunction.Adjunction f g, Control.Comonad.Comonad w) => GHC.Internal.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 :: Type -> Type) where {
    
    -- | If no definition is provided, this will default to <a>GRep</a>.
    type Rep (f :: Type -> Type);
    type Rep f :: Type -> Type = 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
($dmtabulate) :: (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
($dmindex) :: (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 :: Type -> Type) a
Co :: f a -> Co (f :: Type -> Type) a
[unCo] :: Co (f :: Type -> Type) 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 :: (Representable r, Foldable r, Monoid m) => (Rep r -> a -> m) -> r a -> m
itraverseRep :: (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 :: Type -> Type) = 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 :: Type -> Type)
WrapRep :: Rep f -> WrappedRep (f :: Type -> Type)
[unwrapRep] :: WrappedRep (f :: Type -> Type) -> Rep f
instance Data.Functor.Rep.Representable f => GHC.Internal.Base.Applicative (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 => Data.Functor.Bind.Class.Bind (Data.Functor.Rep.Co f)
instance (Data.Functor.Rep.Representable f, GHC.Internal.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.Distributive.Distributive (Data.Functor.Rep.Co f)
instance (Data.Functor.Rep.Representable f, GHC.Internal.Base.Semigroup (Data.Functor.Rep.Rep f)) => Data.Functor.Extend.Extend (Data.Functor.Rep.Co f)
instance GHC.Internal.Base.Functor f => GHC.Internal.Base.Functor (Data.Functor.Rep.Co f)
instance (Data.Functor.Rep.GIndex f, Data.Functor.Rep.GIndex g) => Data.Functor.Rep.GIndex (f GHC.Internal.Generics.:*: g)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.GIndex g) => Data.Functor.Rep.GIndex (f GHC.Internal.Generics.:.: g)
instance Data.Functor.Rep.GIndex f => Data.Functor.Rep.GIndex (GHC.Internal.Generics.M1 i c f)
instance Data.Functor.Rep.GIndex GHC.Internal.Generics.Par1
instance Data.Functor.Rep.Representable f => Data.Functor.Rep.GIndex (GHC.Internal.Generics.Rec1 f)
instance (Data.Functor.Rep.GTabulate f, Data.Functor.Rep.GTabulate g) => Data.Functor.Rep.GTabulate (f GHC.Internal.Generics.:*: g)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.GTabulate g) => Data.Functor.Rep.GTabulate (f GHC.Internal.Generics.:.: g)
instance Data.Functor.Rep.GTabulate f => Data.Functor.Rep.GTabulate (GHC.Internal.Generics.M1 i c f)
instance Data.Functor.Rep.GTabulate GHC.Internal.Generics.Par1
instance Data.Functor.Rep.Representable f => Data.Functor.Rep.GTabulate (GHC.Internal.Generics.Rec1 f)
instance Data.Functor.Rep.Representable f => GHC.Internal.Base.Monad (Data.Functor.Rep.Co f)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Rep f GHC.Types.~ a) => Control.Monad.Reader.Class.MonadReader a (Data.Functor.Rep.Co f)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Functor.Rep.Representable (f GHC.Internal.Generics.:*: g)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Functor.Rep.Representable (f GHC.Internal.Generics.:.: g)
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.Rep.Co f)
instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (Control.Comonad.Cofree.Cofree f)
instance Data.Functor.Rep.Representable Data.Complex.Complex
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 GHC.Internal.Data.Semigroup.Internal.Dual
instance Data.Functor.Rep.Representable ((->) e)
instance Data.Functor.Rep.Representable GHC.Internal.Data.Functor.Identity.Identity
instance Data.Functor.Rep.Representable m => Data.Functor.Rep.Representable (Control.Monad.Trans.Identity.IdentityT m)
instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (GHC.Internal.Generics.M1 i c f)
instance Data.Functor.Rep.Representable GHC.Internal.Generics.Par1
instance Data.Functor.Rep.Representable GHC.Internal.Data.Semigroup.Internal.Product
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 GHC.Internal.Data.Proxy.Proxy
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 (GHC.Internal.Generics.Rec1 f)
instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (Data.Functor.Reverse.Reverse f)
instance Data.Functor.Rep.Representable GHC.Internal.Data.Semigroup.Internal.Sum
instance Data.Functor.Rep.Representable (Data.Tagged.Tagged t)
instance Data.Functor.Rep.Representable w => Data.Functor.Rep.Representable (Control.Comonad.Trans.Traced.TracedT s w)
instance Data.Functor.Rep.Representable GHC.Internal.Generics.U1

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 :: Type -> Type) (u :: Type -> Type) | 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 :: forall (f :: Type -> Type) u a b. 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 :: forall f (u :: Type -> Type). Adjunction f u => f Void -> Void
absurdL :: Void -> f Void

-- | And a left adjoint must be inhabited by exactly one element
cozipL :: forall f (u :: Type -> Type) a b. 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 :: forall f (u :: Type -> Type) a. Adjunction f u => f a -> a
duplicateL :: forall f (u :: Type -> Type) a. Adjunction f u => f a -> f (f a)
splitL :: forall f (u :: Type -> Type) a. Adjunction f u => f a -> (a, f ())
unsplitL :: Functor f => a -> f () -> f a
instance (Data.Functor.Adjunction.Adjunction f g, Data.Functor.Adjunction.Adjunction f' g') => Data.Functor.Adjunction.Adjunction (f GHC.Internal.Generics.:+: f') (g GHC.Internal.Generics.:*: g')
instance (Data.Functor.Adjunction.Adjunction f g, Data.Functor.Adjunction.Adjunction f' g') => Data.Functor.Adjunction.Adjunction (f' GHC.Internal.Generics.:.: f) (g GHC.Internal.Generics.:.: g')
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 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 f u => Data.Functor.Adjunction.Adjunction (Control.Monad.Free.Free f) (Control.Comonad.Cofree.Cofree u)
instance Data.Functor.Adjunction.Adjunction GHC.Internal.Data.Functor.Identity.Identity GHC.Internal.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 GHC.Internal.Generics.Par1 GHC.Internal.Generics.Par1
instance Data.Functor.Adjunction.Adjunction f g => Data.Functor.Adjunction.Adjunction (GHC.Internal.Generics.Rec1 f) (GHC.Internal.Generics.Rec1 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 ((,) e) ((->) e)
instance Data.Functor.Adjunction.Adjunction GHC.Internal.Generics.V1 GHC.Internal.Generics.U1
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)

module Control.Monad.Trans.Adjoint
type Adjoint (f :: Type -> Type) (g :: Type -> Type) = 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 :: Type -> Type) (g :: Type -> Type) (m :: Type -> Type) a
AdjointT :: g (m (f a)) -> AdjointT (f :: Type -> Type) (g :: Type -> Type) (m :: Type -> Type) a
[runAdjointT] :: AdjointT (f :: Type -> Type) (g :: Type -> Type) (m :: Type -> Type) a -> g (m (f a))
instance (Data.Functor.Adjunction.Adjunction f g, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Applicative (Control.Monad.Trans.Adjoint.AdjointT f g m)
instance (Data.Functor.Adjunction.Adjunction f g, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Functor (Control.Monad.Trans.Adjoint.AdjointT f g m)
instance (Data.Functor.Adjunction.Adjunction f g, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Monad (Control.Monad.Trans.Adjoint.AdjointT f g m)
instance (Data.Functor.Adjunction.Adjunction f g, GHC.Internal.Data.Traversable.Traversable f) => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Adjoint.AdjointT f g)

module Control.Comonad.Trans.Adjoint
type Adjoint (f :: Type -> Type) (g :: Type -> Type) = 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 :: Type -> Type) (g :: Type -> Type) (w :: Type -> Type) a
AdjointT :: f (w (g a)) -> AdjointT (f :: Type -> Type) (g :: Type -> Type) (w :: Type -> Type) a
[runAdjointT] :: AdjointT (f :: Type -> Type) (g :: Type -> Type) (w :: Type -> Type) a -> f (w (g a))
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)
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, GHC.Internal.Base.Functor w) => GHC.Internal.Base.Functor (Control.Comonad.Trans.Adjoint.AdjointT f g w)

-- | 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 :: Type -> Type) = StateT g Identity

-- | Unwrap a state monad computation as a function. (The inverse of
--   state.)
runState :: forall (g :: Type -> Type) a. 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 m s = fst (runState m
--   s)

--   
evalState :: forall (g :: Type -> Type) a. 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 m s = snd (runState m
--   s)

--   
execState :: forall (g :: Type -> Type) a. Representable g => State g a -> Rep g -> Rep g

-- | Map both the return value and final state of a computation using the
--   given function.
--   
--   
--   
- 
runState (mapState f m) = f . runState
--   m

--   
mapState :: forall (g :: Type -> Type) a b. Functor g => ((a, Rep g) -> (b, Rep g)) -> State g a -> State g b

-- | A state transformer monad parameterized by:
--   
--   
--   
- g - A representable functor used to memoize results for a
--   state Rep g
--   
- m - The inner monad.
--   
--   
--   The return function leaves the state unchanged, while
--   >>= uses the final state of the first computation as
--   the initial state of the second.
newtype StateT (g :: Type -> Type) (m :: Type -> Type) a
StateT :: g (m (a, Rep g)) -> StateT (g :: Type -> Type) (m :: Type -> Type) a
[getStateT] :: StateT (g :: Type -> Type) (m :: Type -> Type) a -> g (m (a, Rep g))
stateT :: forall (g :: Type -> Type) m a. Representable g => (Rep g -> m (a, Rep g)) -> StateT g m a
runStateT :: forall (g :: Type -> Type) m a. Representable g => StateT g m a -> Rep g -> m (a, Rep g)

-- | Evaluate a state computation with the given initial state and return
--   the final value, discarding the final state.
--   
--   
--   
- 
evalStateT m s = liftM fst
--   (runStateT m s)

--   
evalStateT :: forall (g :: Type -> Type) m a. (Representable g, Monad m) => StateT g m a -> Rep g -> m a

-- | Evaluate a state computation with the given initial state and return
--   the final state, discarding the final value.
--   
--   
--   
- 
execStateT m s = liftM snd
--   (runStateT m s)

--   
execStateT :: forall (g :: Type -> Type) m a. (Representable g, Monad m) => StateT g m a -> Rep g -> m (Rep g)
mapStateT :: forall (g :: Type -> Type) m a n b. Functor g => (m (a, Rep g) -> n (b, Rep g)) -> StateT g m a -> StateT g n b

-- | Uniform lifting of a callCC operation to the new monad. This
--   version rolls back to the original state on entering the continuation.
liftCallCC :: forall (g :: Type -> Type) a m b. Representable g => ((((a, Rep g) -> m (b, Rep g)) -> m (a, Rep g)) -> m (a, Rep g)) -> ((a -> StateT g m b) -> StateT g m a) -> StateT g m a

-- | In-situ lifting of a callCC operation to the new monad. This
--   version uses the current state on entering the continuation. It does
--   not satisfy the laws of a monad transformer.
liftCallCC' :: forall (g :: Type -> Type) a m b. Representable g => ((((a, Rep g) -> m (b, Rep g)) -> m (a, Rep g)) -> m (a, Rep g)) -> ((a -> StateT g m b) -> StateT g m a) -> StateT g m a

-- | Minimal definition is either both of get and put or
--   just state
class Monad m => MonadState s (m :: Type -> Type) | m -> s

-- | Return the state from the internals of the monad.
get :: MonadState s m => m s

-- | Replace the state inside the monad.
put :: MonadState s m => s -> m ()

-- | Embed a simple state action into the monad.
state :: MonadState s m => (s -> (a, s)) -> m a
instance (Data.Functor.Rep.Representable g, GHC.Internal.Base.Functor m, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Applicative (Control.Monad.Representable.State.StateT g m)
instance (Data.Functor.Rep.Representable g, Data.Functor.Bind.Class.Bind m) => Data.Functor.Bind.Class.Apply (Control.Monad.Representable.State.StateT g m)
instance (Data.Functor.Rep.Representable g, Data.Functor.Bind.Class.Bind m) => Data.Functor.Bind.Class.Bind (Control.Monad.Representable.State.StateT g m)
instance Data.Functor.Rep.Representable f => Data.Functor.Bind.Trans.BindTrans (Control.Monad.Representable.State.StateT f)
instance (GHC.Internal.Base.Functor g, GHC.Internal.Base.Functor m) => GHC.Internal.Base.Functor (Control.Monad.Representable.State.StateT g m)
instance (Data.Functor.Rep.Representable g, Control.Monad.Cont.Class.MonadCont m) => Control.Monad.Cont.Class.MonadCont (Control.Monad.Representable.State.StateT g m)
instance (GHC.Internal.Base.Functor f, Data.Functor.Rep.Representable g, Control.Monad.Free.Class.MonadFree f m) => Control.Monad.Free.Class.MonadFree f (Control.Monad.Representable.State.StateT g m)
instance (Data.Functor.Rep.Representable g, Control.Monad.Reader.Class.MonadReader e m) => Control.Monad.Reader.Class.MonadReader e (Control.Monad.Representable.State.StateT g m)
instance (Data.Functor.Rep.Representable g, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Monad (Control.Monad.Representable.State.StateT g m)
instance (Data.Functor.Rep.Representable g, GHC.Internal.Base.Monad m, Data.Functor.Rep.Rep g GHC.Types.~ s) => Control.Monad.State.Class.MonadState s (Control.Monad.Representable.State.StateT g m)
instance Data.Functor.Rep.Representable f => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Representable.State.StateT f)
instance (Data.Functor.Rep.Representable g, Control.Monad.Writer.Class.MonadWriter w m) => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Representable.State.StateT g m)

-- | Representable functors on Hask are all monads, because they are
--   isomorphic to a Reader monad.
module Control.Monad.Representable.Reader
type Reader (f :: Type -> Type) = ReaderT f Identity
runReader :: forall (f :: Type -> Type) b. Representable f => Reader f b -> Rep f -> b
newtype ReaderT (f :: Type -> Type) (m :: Type -> Type) b
ReaderT :: f (m b) -> ReaderT (f :: Type -> Type) (m :: Type -> Type) b
[getReaderT] :: ReaderT (f :: Type -> Type) (m :: Type -> Type) b -> f (m b)
readerT :: forall (f :: Type -> Type) m b. Representable f => (Rep f -> m b) -> ReaderT f m b
runReaderT :: forall (f :: Type -> Type) m b. Representable f => ReaderT f m b -> Rep f -> m b

-- | See examples in Control.Monad.Reader. Note, the partially
--   applied function type (->) r is a simple reader monad. See
--   the instance declaration below.
class Monad m => MonadReader r (m :: Type -> Type) | m -> r

-- | Retrieves the monad environment.
ask :: MonadReader r m => m r

-- | Executes a computation in a modified environment.
local :: MonadReader r m => (r -> r) -> m a -> m a

-- | Retrieves a function of the current environment.
reader :: MonadReader r m => (r -> a) -> m a
instance (Data.Functor.Rep.Representable f, GHC.Internal.Base.Applicative m) => GHC.Internal.Base.Applicative (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, Data.Functor.Bind.Class.Apply m) => Data.Functor.Bind.Class.Apply (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, Data.Functor.Bind.Class.Bind m) => Data.Functor.Bind.Class.Bind (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable m, GHC.Internal.Base.Monoid (Data.Functor.Rep.Rep f), GHC.Internal.Base.Monoid (Data.Functor.Rep.Rep m)) => Control.Comonad.Comonad (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, Data.Distributive.Distributive m) => Data.Distributive.Distributive (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable m, GHC.Internal.Base.Semigroup (Data.Functor.Rep.Rep f), GHC.Internal.Base.Semigroup (Data.Functor.Rep.Rep m)) => Data.Functor.Extend.Extend (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Foldable1.Foldable1 f, Data.Foldable1.Foldable1 m) => Data.Foldable1.Foldable1 (Control.Monad.Representable.Reader.ReaderT f m)
instance (GHC.Internal.Data.Foldable.Foldable f, GHC.Internal.Data.Foldable.Foldable m) => GHC.Internal.Data.Foldable.Foldable (Control.Monad.Representable.Reader.ReaderT f m)
instance (GHC.Internal.Base.Functor f, GHC.Internal.Base.Functor m) => GHC.Internal.Base.Functor (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, Control.Monad.IO.Class.MonadIO m) => Control.Monad.IO.Class.MonadIO (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, GHC.Internal.Base.Monad m) => GHC.Internal.Base.Monad (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, GHC.Internal.Base.Monad m, Data.Functor.Rep.Rep f GHC.Types.~ e) => Control.Monad.Reader.Class.MonadReader e (Control.Monad.Representable.Reader.ReaderT f m)
instance Data.Functor.Rep.Representable f => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Representable.Reader.ReaderT f)
instance (Data.Functor.Rep.Representable f, Control.Monad.Writer.Class.MonadWriter w m) => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable m) => Data.Functor.Rep.Representable (Control.Monad.Representable.Reader.ReaderT f m)
instance (Data.Semigroup.Traversable.Class.Traversable1 f, Data.Semigroup.Traversable.Class.Traversable1 m) => Data.Semigroup.Traversable.Class.Traversable1 (Control.Monad.Representable.Reader.ReaderT f m)
instance (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable m) => GHC.Internal.Data.Traversable.Traversable (Control.Monad.Representable.Reader.ReaderT f m)

-- | This is a generalized Store Comonad, parameterized by a
--   Representable Functor. The representation of that
--   Functor serves as the index of the store.
--   
--   This can be useful if the representable functor serves to memoize its
--   contents and will be inspected often.
module Control.Comonad.Representable.Store

-- | A memoized store comonad parameterized by a representable functor
--   g, where the representatation of g, Rep g
--   is the index of the store.
type Store (g :: Type -> Type) = StoreT g Identity

-- | Construct a store comonad computation from a function and a current
--   index. (The inverse of runStore.)
store :: forall (g :: Type -> Type) a. Representable g => (Rep g -> a) -> Rep g -> Store g a

-- | Unwrap a store comonad computation as a function and a current index.
--   (The inverse of store.)
runStore :: forall (g :: Type -> Type) a. Representable g => Store g a -> (Rep g -> a, Rep g)

-- | A store transformer comonad parameterized by:
--   
--   
--   
- g - A representable functor used to memoize results for
--   an index Rep g
--   
- w - The inner comonad.
--   
data StoreT (g :: Type -> Type) (w :: Type -> Type) a
StoreT :: w (g a) -> Rep g -> StoreT (g :: Type -> Type) (w :: Type -> Type) a
storeT :: forall w (g :: Type -> Type) a. (Functor w, Representable g) => w (Rep g -> a) -> Rep g -> StoreT g w a
runStoreT :: forall w (g :: Type -> Type) a. (Functor w, Representable g) => StoreT g w a -> (w (Rep g -> a), Rep g)
class Comonad w => ComonadStore s (w :: Type -> Type) | w -> s
pos :: ComonadStore s w => w a -> s
peek :: ComonadStore s w => s -> w a -> a
peeks :: ComonadStore s w => (s -> s) -> w a -> a
seek :: ComonadStore s w => s -> w a -> w a
seeks :: ComonadStore s w => (s -> s) -> w a -> w a
experiment :: (ComonadStore s w, Functor f) => (s -> f s) -> w a -> f a
instance (GHC.Internal.Base.Applicative w, GHC.Internal.Base.Monoid (Data.Functor.Rep.Rep g), Data.Functor.Rep.Representable g) => GHC.Internal.Base.Applicative (Control.Comonad.Representable.Store.StoreT g w)
instance (Data.Functor.Bind.Class.Apply w, GHC.Internal.Base.Semigroup (Data.Functor.Rep.Rep g), Data.Functor.Rep.Representable g) => Data.Functor.Bind.Class.Apply (Control.Comonad.Representable.Store.StoreT g w)
instance (Control.Comonad.ComonadApply w, GHC.Internal.Base.Semigroup (Data.Functor.Rep.Rep g), Data.Functor.Rep.Representable g) => Control.Comonad.ComonadApply (Control.Comonad.Representable.Store.StoreT g w)
instance (Data.Functor.Rep.Representable g, Control.Comonad.Cofree.Class.ComonadCofree f w) => Control.Comonad.Cofree.Class.ComonadCofree f (Control.Comonad.Representable.Store.StoreT g w)
instance (Control.Comonad.Env.Class.ComonadEnv m w, Data.Functor.Rep.Representable g) => Control.Comonad.Env.Class.ComonadEnv m (Control.Comonad.Representable.Store.StoreT g w)
instance Control.Comonad.Hoist.Class.ComonadHoist (Control.Comonad.Representable.Store.StoreT g)
instance (Control.Comonad.Comonad w, Data.Functor.Rep.Representable g) => Control.Comonad.Comonad (Control.Comonad.Representable.Store.StoreT g w)
instance (Control.Comonad.Comonad w, Data.Functor.Rep.Representable g, Data.Functor.Rep.Rep g GHC.Types.~ s) => Control.Comonad.Store.Class.ComonadStore s (Control.Comonad.Representable.Store.StoreT g w)
instance (Control.Comonad.Traced.Class.ComonadTraced m w, Data.Functor.Rep.Representable g) => Control.Comonad.Traced.Class.ComonadTraced m (Control.Comonad.Representable.Store.StoreT g w)
instance Data.Functor.Rep.Representable g => Control.Comonad.Trans.Class.ComonadTrans (Control.Comonad.Representable.Store.StoreT g)
instance (Data.Functor.Extend.Extend w, Data.Functor.Rep.Representable g) => Data.Functor.Extend.Extend (Control.Comonad.Representable.Store.StoreT g w)
instance (GHC.Internal.Base.Functor w, GHC.Internal.Base.Functor g) => GHC.Internal.Base.Functor (Control.Comonad.Representable.Store.StoreT g w)
