-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Comonads
--   
--   Comonads.
@package comonad
@version 5.0.9

module Control.Comonad

-- | There are two ways to define a comonad:
--   
--   I. Provide definitions for extract and extend satisfying
--   these laws:
--   
--   
--   extend extract      = id
--   extract . extend f  = f
--   extend f . extend g = extend (f . extend g)
--   
--   
--   In this case, you may simply set fmap = liftW.
--   
--   These laws are directly analogous to the laws for monads and perhaps
--   can be made clearer by viewing them as laws stating that Cokleisli
--   composition must be associative, and has extract for a unit:
--   
--   
--   f =>= extract   = f
--   extract =>= f   = f
--   (f =>= g) =>= h = f =>= (g =>= h)
--   
--   
--   II. Alternately, you may choose to provide definitions for
--   fmap, extract, and duplicate satisfying these
--   laws:
--   
--   
--   extract . duplicate      = id
--   fmap extract . duplicate = id
--   duplicate . duplicate    = fmap duplicate . duplicate
--   
--   
--   In this case you may not rely on the ability to define fmap in
--   terms of liftW.
--   
--   You may of course, choose to define both duplicate and
--   extend. In that case you must also satisfy these laws:
--   
--   
--   extend f  = fmap f . duplicate
--   duplicate = extend id
--   fmap f    = extend (f . extract)
--   
--   
--   These are the default definitions of extend and
--   duplicate and the definition of liftW respectively.
class Functor w => Comonad (w :: Type -> Type)

-- | 
--   extract . fmap f = f . extract
--   
extract :: Comonad w => w a -> a

-- | 
--   duplicate = extend id
--   fmap (fmap f) . duplicate = duplicate . fmap f
--   
duplicate :: Comonad w => w a -> w (w a)

-- | 
--   extend f = fmap f . duplicate
--   
extend :: Comonad w => (w a -> b) -> w a -> w b

-- | A suitable default definition for fmap for a Comonad.
--   Promotes a function to a comonad.
--   
--   You can only safely use liftW to define fmap if your
--   Comonad defines extend, not just duplicate, since
--   defining extend in terms of duplicate uses fmap!
--   
--   
--   fmap f = liftW f = extend (f . extract)
--   
liftW :: Comonad w => (a -> b) -> w a -> w b

-- | Comonadic fixed point à la David Menendez
wfix :: Comonad w => w (w a -> a) -> a

-- | Comonadic fixed point à la Dominic Orchard
cfix :: Comonad w => (w a -> a) -> w a

-- | Comonadic fixed point à la Kenneth Foner:
--   
--   This is the evaluate function from his "Getting a Quick
--   Fix on Comonads" talk.
kfix :: ComonadApply w => w (w a -> a) -> w a

-- | Left-to-right Cokleisli composition
(=>=) :: Comonad w => (w a -> b) -> (w b -> c) -> w a -> c
infixr 1 =>=

-- | Right-to-left Cokleisli composition
(=<=) :: Comonad w => (w b -> c) -> (w a -> b) -> w a -> c
infixr 1 =<=

-- | extend in operator form
(<<=) :: Comonad w => (w a -> b) -> w a -> w b
infixr 1 <<=

-- | extend with the arguments swapped. Dual to >>= for
--   a Monad.
(=>>) :: Comonad w => w a -> (w a -> b) -> w b
infixl 1 =>>

-- | ComonadApply is to Comonad like Applicative
--   is to Monad.
--   
--   Mathematically, it is a strong lax symmetric semi-monoidal comonad on
--   the category Hask of Haskell types. That it to say that
--   w is a strong lax symmetric semi-monoidal functor on Hask,
--   where both extract and duplicate are symmetric monoidal
--   natural transformations.
--   
--   Laws:
--   
--   
--   (.) <$> u <@> v <@> w = u <@> (v <@> w)
--   extract (p <@> q) = extract p (extract q)
--   duplicate (p <@> q) = (<@>) <$> duplicate p <@> duplicate q
--   
--   
--   If our type is both a ComonadApply and Applicative we
--   further require
--   
--   
--   (<*>) = (<@>)
--   
--   
--   Finally, if you choose to define (<@) and (@>),
--   the results of your definitions should match the following laws:
--   
--   
--   a @> b = const id <$> a <@> b
--   a <@ b = const <$> a <@> b
--   
class Comonad w => ComonadApply (w :: Type -> Type)
(<@>) :: ComonadApply w => w (a -> b) -> w a -> w b
($dm<@>) :: (ComonadApply w, Applicative w) => w (a -> b) -> w a -> w b
(@>) :: ComonadApply w => w a -> w b -> w b
(<@) :: ComonadApply w => w a -> w b -> w a
infixl 4 <@>
infixl 4 @>
infixl 4 <@

-- | A variant of <@> with the arguments reversed.
(<@@>) :: ComonadApply w => w a -> w (a -> b) -> w b
infixl 4 <@@>

-- | Lift a binary function into a Comonad with zipping
liftW2 :: ComonadApply w => (a -> b -> c) -> w a -> w b -> w c

-- | Lift a ternary function into a Comonad with zipping
liftW3 :: ComonadApply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d

-- | The Cokleisli Arrows of a given Comonad
newtype Cokleisli (w :: k -> Type) (a :: k) b
Cokleisli :: (w a -> b) -> Cokleisli (w :: k -> Type) (a :: k) b
[runCokleisli] :: Cokleisli (w :: k -> Type) (a :: k) b -> w a -> b

-- | A type f is a Functor if it provides a function fmap
--   which, given any types a and b lets you apply any
--   function from (a -> b) to turn an f a into an
--   f b, preserving the structure of f. Furthermore
--   f needs to adhere to the following:
--   
--   
--   
- Identity fmap id == id
--   
- Composition fmap (f . g) == fmap f .
--   fmap g
--   
--   
--   Note, that the second law follows from the free theorem of the type
--   fmap and the first law, so you need only check that the former
--   condition holds. See these articles by School of Haskell or
--   David Luposchainsky for an explanation.
class Functor (f :: Type -> Type)

-- | fmap is used to apply a function of type (a -> b)
--   to a value of type f a, where f is a functor, to produce a
--   value of type f b. Note that for any type constructor with
--   more than one parameter (e.g., Either), only the last type
--   parameter can be modified with fmap (e.g., b in
--   `Either a b`).
--   
--   Some type constructors with two parameters or more have a
--   Bifunctor instance that allows both the last and the
--   penultimate parameters to be mapped over.
--   
--   
Examples
--   
--   Convert from a Maybe Int to a Maybe String
--   using show:
--   
--   
--   >>> fmap show Nothing
--   Nothing
--   
--   >>> fmap show (Just 3)
--   Just "3"
--   
--   
--   Convert from an Either Int Int to an Either Int
--   String using show:
--   
--   
--   >>> fmap show (Left 17)
--   Left 17
--   
--   >>> fmap show (Right 17)
--   Right "17"
--   
--   
--   Double each element of a list:
--   
--   
--   >>> fmap (*2) [1,2,3]
--   [2,4,6]
--   
--   
--   Apply even to the second element of a pair:
--   
--   
--   >>> fmap even (2,2)
--   (2,True)
--   
--   
--   It may seem surprising that the function is only applied to the last
--   element of the tuple compared to the list example above which applies
--   it to every element in the list. To understand, remember that tuples
--   are type constructors with multiple type parameters: a tuple of 3
--   elements (a,b,c) can also be written (,,) a b c and
--   its Functor instance is defined for Functor ((,,) a
--   b) (i.e., only the third parameter is free to be mapped over with
--   fmap).
--   
--   It explains why fmap can be used with tuples containing
--   values of different types as in the following example:
--   
--   
--   >>> fmap even ("hello", 1.0, 4)
--   ("hello",1.0,True)
--   
fmap :: Functor f => (a -> b) -> f a -> f b

-- | Replace all locations in the input with the same value. The default
--   definition is fmap . const, but this may be
--   overridden with a more efficient version.
--   
--   
Examples
--   
--   Perform a computation with Maybe and replace the result with a
--   constant value if it is Just:
--   
--   
--   >>> 'a' <$ Just 2
--   Just 'a'
--   
--   >>> 'a' <$ Nothing
--   Nothing
--   
(<$) :: Functor f => a -> f b -> f a
infixl 4 <$

-- | An infix synonym for fmap.
--   
--   The name of this operator is an allusion to $. Note the
--   similarities between their types:
--   
--   
--    ($)  ::              (a -> b) ->   a ->   b
--   (<$>) :: Functor f => (a -> b) -> f a -> f b
--   
--   
--   Whereas $ is function application, <$> is function
--   application lifted over a Functor.
--   
--   
Examples
--   
--   Convert from a Maybe Int to a Maybe
--   String using show:
--   
--   
--   >>> show <$> Nothing
--   Nothing
--   
--   
--   
--   >>> show <$> Just 3
--   Just "3"
--   
--   
--   Convert from an Either Int Int to an
--   Either Int String using show:
--   
--   
--   >>> show <$> Left 17
--   Left 17
--   
--   
--   
--   >>> show <$> Right 17
--   Right "17"
--   
--   
--   Double each element of a list:
--   
--   
--   >>> (*2) <$> [1,2,3]
--   [2,4,6]
--   
--   
--   Apply even to the second element of a pair:
--   
--   
--   >>> even <$> (2,2)
--   (2,True)
--   
(<$>) :: Functor f => (a -> b) -> f a -> f b
infixl 4 <$>

-- | Flipped version of <$.
--   
--   
Examples
--   
--   Replace the contents of a Maybe Int with a
--   constant String:
--   
--   
--   >>> Nothing $> "foo"
--   Nothing
--   
--   
--   
--   >>> Just 90210 $> "foo"
--   Just "foo"
--   
--   
--   Replace the contents of an Either Int
--   Int with a constant String, resulting in an
--   Either Int String:
--   
--   
--   >>> Left 8675309 $> "foo"
--   Left 8675309
--   
--   
--   
--   >>> Right 8675309 $> "foo"
--   Right "foo"
--   
--   
--   Replace each element of a list with a constant String:
--   
--   
--   >>> [1,2,3] $> "foo"
--   ["foo","foo","foo"]
--   
--   
--   Replace the second element of a pair with a constant String:
--   
--   
--   >>> (1,2) $> "foo"
--   (1,"foo")
--   
($>) :: Functor f => f a -> b -> f b
infixl 4 $>
instance forall k (w :: k -> *) (a :: k). GHC.Internal.Base.Applicative (Control.Comonad.Cokleisli w a)
instance Control.Comonad.Comonad w => GHC.Internal.Control.Arrow.ArrowApply (Control.Comonad.Cokleisli w)
instance Control.Comonad.Comonad w => GHC.Internal.Control.Arrow.ArrowChoice (Control.Comonad.Cokleisli w)
instance Control.Comonad.Comonad w => GHC.Internal.Control.Arrow.Arrow (Control.Comonad.Cokleisli w)
instance Control.Comonad.ComonadApply w => GHC.Internal.Control.Arrow.ArrowLoop (Control.Comonad.Cokleisli w)
instance Control.Comonad.Comonad w => GHC.Internal.Control.Category.Category (Control.Comonad.Cokleisli w)
instance GHC.Internal.Base.Monoid m => Control.Comonad.ComonadApply ((->) m)
instance Control.Comonad.ComonadApply GHC.Internal.Data.Functor.Identity.Identity
instance Control.Comonad.ComonadApply w => Control.Comonad.ComonadApply (Control.Monad.Trans.Identity.IdentityT w)
instance Control.Comonad.ComonadApply GHC.Internal.Base.NonEmpty
instance Control.Comonad.ComonadApply Data.Tree.Tree
instance GHC.Internal.Base.Semigroup m => Control.Comonad.ComonadApply ((,) m)
instance Control.Comonad.Comonad (Data.Semigroup.Arg e)
instance GHC.Internal.Base.Monoid m => Control.Comonad.Comonad ((->) m)
instance Control.Comonad.Comonad GHC.Internal.Data.Functor.Identity.Identity
instance Control.Comonad.Comonad w => Control.Comonad.Comonad (Control.Monad.Trans.Identity.IdentityT w)
instance Control.Comonad.Comonad GHC.Internal.Base.NonEmpty
instance (Control.Comonad.Comonad f, Control.Comonad.Comonad g) => Control.Comonad.Comonad (Data.Functor.Sum.Sum f g)
instance forall k (s :: k). Control.Comonad.Comonad (Data.Tagged.Tagged s)
instance Control.Comonad.Comonad Data.Tree.Tree
instance Control.Comonad.Comonad ((,) e)
instance forall k (w :: k -> *) (a :: k). GHC.Internal.Base.Functor (Control.Comonad.Cokleisli w a)
instance forall k (w :: k -> *) (a :: k). GHC.Internal.Base.Monad (Control.Comonad.Cokleisli w a)

module Control.Comonad.Hoist.Class
class ComonadHoist (t :: Type -> Type -> Type -> Type)

-- | Given any comonad-homomorphism from w to v this
--   yields a comonad homomorphism from t w to t v.
cohoist :: (ComonadHoist t, Comonad w, Comonad v) => (forall x. () => w x -> v x) -> t w a -> t v a
instance Control.Comonad.Hoist.Class.ComonadHoist Control.Monad.Trans.Identity.IdentityT

module Control.Comonad.Trans.Class
class ComonadTrans (t :: Type -> Type -> Type -> Type)
lower :: (ComonadTrans t, Comonad w) => t w a -> w a
instance Control.Comonad.Trans.Class.ComonadTrans Control.Monad.Trans.Identity.IdentityT

-- | The environment comonad holds a value along with some retrievable
--   context.
--   
--   This module specifies the environment comonad transformer (aka
--   coreader), which is left adjoint to the reader comonad.
--   
--   The following sets up an experiment that retains its initial value in
--   the background:
--   
--   
--   >>> let initial = env 0 0
--   
--   
--   Extract simply retrieves the value:
--   
--   
--   >>> extract initial
--   0
--   
--   
--   Play around with the value, in our case producing a negative value:
--   
--   
--   >>> let experiment = fmap (+ 10) initial
--   
--   >>> extract experiment
--   10
--   
--   
--   Oh noes, something went wrong, 10 isn't very negative! Better restore
--   the initial value using the default:
--   
--   
--   >>> let initialRestored = experiment =>> ask
--   
--   >>> extract initialRestored
--   0
--   
module Control.Comonad.Trans.Env
type Env e = EnvT e Identity

-- | Create an Env using an environment and a value
env :: e -> a -> Env e a
runEnv :: Env e a -> (e, a)
data EnvT e (w :: Type -> Type) a
EnvT :: e -> w a -> EnvT e (w :: Type -> Type) a
runEnvT :: EnvT e w a -> (e, w a)

-- | Gets rid of the environment. This differs from extract in that
--   it will not continue extracting the value from the contained comonad.
lowerEnvT :: EnvT e w a -> w a

-- | Retrieves the environment.
ask :: forall e (w :: Type -> Type) a. EnvT e w a -> e

-- | Like ask, but modifies the resulting value with a function.
--   
--   
--   asks = f . ask
--   
asks :: forall e f (w :: Type -> Type) a. (e -> f) -> EnvT e w a -> f

-- | Modifies the environment using the specified function.
local :: forall e e' (w :: Type -> Type) a. (e -> e') -> EnvT e w a -> EnvT e' w a
instance (GHC.Internal.Base.Monoid e, GHC.Internal.Base.Applicative m) => GHC.Internal.Base.Applicative (Control.Comonad.Trans.Env.EnvT e m)
instance (GHC.Internal.Base.Semigroup e, Control.Comonad.ComonadApply w) => Control.Comonad.ComonadApply (Control.Comonad.Trans.Env.EnvT e w)
instance Control.Comonad.Comonad w => Control.Comonad.Comonad (Control.Comonad.Trans.Env.EnvT e w)
instance Control.Comonad.Hoist.Class.ComonadHoist (Control.Comonad.Trans.Env.EnvT e)
instance Control.Comonad.Trans.Class.ComonadTrans (Control.Comonad.Trans.Env.EnvT e)
instance (GHC.Internal.Data.Data.Data e, GHC.Internal.Data.Typeable.Internal.Typeable w, GHC.Internal.Data.Data.Data (w a), GHC.Internal.Data.Data.Data a) => GHC.Internal.Data.Data.Data (Control.Comonad.Trans.Env.EnvT e w a)
instance GHC.Internal.Data.Foldable.Foldable w => GHC.Internal.Data.Foldable.Foldable (Control.Comonad.Trans.Env.EnvT e w)
instance GHC.Internal.Base.Functor w => GHC.Internal.Base.Functor (Control.Comonad.Trans.Env.EnvT e w)
instance GHC.Internal.Data.Traversable.Traversable w => GHC.Internal.Data.Traversable.Traversable (Control.Comonad.Trans.Env.EnvT e w)

module Control.Comonad.Trans.Identity

-- | The trivial monad transformer, which maps a monad to an equivalent
--   monad.
newtype IdentityT (f :: k -> Type) (a :: k)
IdentityT :: f a -> IdentityT (f :: k -> Type) (a :: k)
[runIdentityT] :: IdentityT (f :: k -> Type) (a :: k) -> f a

module Control.Comonad.Identity

-- | The store comonad holds a constant value along with a modifiable
--   accessor function, which maps the stored value to the
--   focus.
--   
--   This module defines the strict store (aka state-in-context/costate)
--   comonad transformer.
--   
--   stored value = (1, 5), accessor = fst, resulting
--   focus = 1:
--   
--   
--   >>> :{
--    let
--      storeTuple :: Store (Int, Int) Int
--      storeTuple = store fst (1, 5)
--   :}
--   
--   
--   Add something to the focus:
--   
--   
--   >>> :{
--    let
--      addToFocus :: Int -> Store (Int, Int) Int -> Int
--      addToFocus x wa = x + extract wa
--   :}
--   
--   
--   
--   >>> :{
--     let
--       added3 :: Store (Int, Int) Int
--       added3 = extend (addToFocus 3) storeTuple
--   :}
--   
--   
--   The focus of added3 is now 1 + 3 = 4. However, this action
--   changed only the accessor function and therefore the focus but not the
--   stored value:
--   
--   
--   >>> pos added3
--   (1,5)
--   
--   
--   
--   >>> extract added3
--   4
--   
--   
--   The strict store (state-in-context/costate) comonad transformer is
--   subject to the laws:
--   
--   
--   x = seek (pos x) x
--   y = pos (seek y x)
--   seek y x = seek y (seek z x)
--   
--   
--   Thanks go to Russell O'Connor and Daniel Peebles for their help
--   formulating and proving the laws for this comonad transformer.
module Control.Comonad.Trans.Store
type Store s = StoreT s Identity

-- | Create a Store using an accessor function and a stored value
store :: (s -> a) -> s -> Store s a
runStore :: Store s a -> (s -> a, s)
data StoreT s (w :: Type -> Type) a
StoreT :: w (s -> a) -> s -> StoreT s (w :: Type -> Type) a
runStoreT :: StoreT s w a -> (w (s -> a), s)

-- | Read the stored value
--   
--   
--   >>> pos $ store fst (1,5)
--   (1,5)
--   
pos :: forall s (w :: Type -> Type) a. StoreT s w a -> s

-- | Set the stored value
--   
--   
--   >>> pos . seek (3,7) $ store fst (1,5)
--   (3,7)
--   
--   
--   Seek satisfies the law
--   
--   
--   seek s = peek s . duplicate
--   
seek :: forall s (w :: Type -> Type) a. s -> StoreT s w a -> StoreT s w a

-- | Modify the stored value
--   
--   
--   >>> pos . seeks swap $ store fst (1,5)
--   (5,1)
--   
--   
--   Seeks satisfies the law
--   
--   
--   seeks f = peeks f . duplicate
--   
seeks :: forall s (w :: Type -> Type) a. (s -> s) -> StoreT s w a -> StoreT s w a

-- | Peek at what the current focus would be for a different stored value
--   
--   Peek satisfies the law
--   
--   
--   peek x . extend (peek y) = peek y
--   
peek :: forall (w :: Type -> Type) s a. Comonad w => s -> StoreT s w a -> a

-- | Peek at what the current focus would be if the stored value was
--   modified by some function
peeks :: forall (w :: Type -> Type) s a. Comonad w => (s -> s) -> StoreT s w a -> a

-- | Applies a functor-valued function to the stored value, and then uses
--   the new accessor to read the resulting focus.
--   
--   
--   >>> let f x = if x > 0 then Just (x^2) else Nothing
--   
--   >>> experiment f $ store (+1) 2
--   Just 5
--   
--   >>> experiment f $ store (+1) (-2)
--   Nothing
--   
experiment :: forall (w :: Type -> Type) f s a. (Comonad w, Functor f) => (s -> f s) -> StoreT s w a -> f a
instance (GHC.Internal.Base.Applicative w, GHC.Internal.Base.Monoid s) => GHC.Internal.Base.Applicative (Control.Comonad.Trans.Store.StoreT s w)
instance (Control.Comonad.ComonadApply w, GHC.Internal.Base.Semigroup s) => Control.Comonad.ComonadApply (Control.Comonad.Trans.Store.StoreT s w)
instance Control.Comonad.Hoist.Class.ComonadHoist (Control.Comonad.Trans.Store.StoreT s)
instance Control.Comonad.Comonad w => Control.Comonad.Comonad (Control.Comonad.Trans.Store.StoreT s w)
instance Control.Comonad.Trans.Class.ComonadTrans (Control.Comonad.Trans.Store.StoreT s)
instance GHC.Internal.Base.Functor w => GHC.Internal.Base.Functor (Control.Comonad.Trans.Store.StoreT s w)

-- | The trace comonad builds up a result by prepending monoidal values to
--   each other.
--   
--   This module specifies the traced comonad transformer (aka the cowriter
--   or exponential comonad transformer).
module Control.Comonad.Trans.Traced
type Traced m = TracedT m Identity
traced :: (m -> a) -> Traced m a
runTraced :: Traced m a -> m -> a
newtype TracedT m (w :: Type -> Type) a
TracedT :: w (m -> a) -> TracedT m (w :: Type -> Type) a
[runTracedT] :: TracedT m (w :: Type -> Type) a -> w (m -> a)
trace :: forall (w :: Type -> Type) m a. Comonad w => m -> TracedT m w a -> a
listen :: forall (w :: Type -> Type) m a. Functor w => TracedT m w a -> TracedT m w (a, m)
listens :: forall (w :: Type -> Type) m b a. Functor w => (m -> b) -> TracedT m w a -> TracedT m w (a, b)
censor :: forall (w :: Type -> Type) m a. Functor w => (m -> m) -> TracedT m w a -> TracedT m w a
instance GHC.Internal.Base.Applicative w => GHC.Internal.Base.Applicative (Control.Comonad.Trans.Traced.TracedT m w)
instance (Control.Comonad.ComonadApply w, GHC.Internal.Base.Monoid m) => Control.Comonad.ComonadApply (Control.Comonad.Trans.Traced.TracedT m w)
instance Control.Comonad.Hoist.Class.ComonadHoist (Control.Comonad.Trans.Traced.TracedT m)
instance (Control.Comonad.Comonad w, GHC.Internal.Base.Monoid m) => Control.Comonad.Comonad (Control.Comonad.Trans.Traced.TracedT m w)
instance GHC.Internal.Base.Monoid m => Control.Comonad.Trans.Class.ComonadTrans (Control.Comonad.Trans.Traced.TracedT m)
instance Data.Distributive.Distributive w => Data.Distributive.Distributive (Control.Comonad.Trans.Traced.TracedT m w)
instance GHC.Internal.Base.Functor w => GHC.Internal.Base.Functor (Control.Comonad.Trans.Traced.TracedT m w)
instance WithIndex.FunctorWithIndex i w => WithIndex.FunctorWithIndex (s, i) (Control.Comonad.Trans.Traced.TracedT s w)

module Control.Comonad.Traced.Class
class Comonad w => ComonadTraced m (w :: Type -> Type) | w -> m
trace :: ComonadTraced m w => m -> w a -> a
traces :: ComonadTraced m w => (a -> m) -> w a -> a
instance Control.Comonad.Traced.Class.ComonadTraced m w => Control.Comonad.Traced.Class.ComonadTraced m (Control.Comonad.Trans.Env.EnvT e w)
instance GHC.Internal.Base.Monoid m => Control.Comonad.Traced.Class.ComonadTraced m ((->) m)
instance Control.Comonad.Traced.Class.ComonadTraced m w => Control.Comonad.Traced.Class.ComonadTraced m (Control.Monad.Trans.Identity.IdentityT w)
instance Control.Comonad.Traced.Class.ComonadTraced m w => Control.Comonad.Traced.Class.ComonadTraced m (Control.Comonad.Trans.Store.StoreT s w)
instance (Control.Comonad.Comonad w, GHC.Internal.Base.Monoid m) => Control.Comonad.Traced.Class.ComonadTraced m (Control.Comonad.Trans.Traced.TracedT m w)

module Control.Comonad.Traced
class Comonad w => ComonadTraced m (w :: Type -> Type) | w -> m
trace :: ComonadTraced m w => m -> w a -> a
traces :: ComonadTraced m w => (a -> m) -> w a -> a
type Traced m = TracedT m Identity
traced :: (m -> a) -> Traced m a
runTraced :: Traced m a -> m -> a
newtype TracedT m (w :: Type -> Type) a
TracedT :: w (m -> a) -> TracedT m (w :: Type -> Type) a
[runTracedT] :: TracedT m (w :: Type -> Type) a -> w (m -> a)

module Control.Comonad.Store.Class
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
lowerPos :: forall t s (w :: Type -> Type) a. (ComonadTrans t, ComonadStore s w) => t w a -> s
lowerPeek :: forall t s (w :: Type -> Type) a. (ComonadTrans t, ComonadStore s w) => s -> t w a -> a
instance Control.Comonad.Store.Class.ComonadStore s w => Control.Comonad.Store.Class.ComonadStore s (Control.Comonad.Trans.Env.EnvT e w)
instance Control.Comonad.Store.Class.ComonadStore s w => Control.Comonad.Store.Class.ComonadStore s (Control.Monad.Trans.Identity.IdentityT w)
instance Control.Comonad.Comonad w => Control.Comonad.Store.Class.ComonadStore s (Control.Comonad.Trans.Store.StoreT s w)
instance (Control.Comonad.Store.Class.ComonadStore s w, GHC.Internal.Base.Monoid m) => Control.Comonad.Store.Class.ComonadStore s (Control.Comonad.Trans.Traced.TracedT m w)

module Control.Comonad.Store
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
type Store s = StoreT s Identity

-- | Create a Store using an accessor function and a stored value
store :: (s -> a) -> s -> Store s a
runStore :: Store s a -> (s -> a, s)
data StoreT s (w :: Type -> Type) a
StoreT :: w (s -> a) -> s -> StoreT s (w :: Type -> Type) a
runStoreT :: StoreT s w a -> (w (s -> a), s)

module Control.Comonad.Env.Class
class Comonad w => ComonadEnv e (w :: Type -> Type) | w -> e
ask :: ComonadEnv e w => w a -> e
asks :: ComonadEnv e w => (e -> e') -> w a -> e'
instance Control.Comonad.Env.Class.ComonadEnv e (Data.Semigroup.Arg e)
instance Control.Comonad.Comonad w => Control.Comonad.Env.Class.ComonadEnv e (Control.Comonad.Trans.Env.EnvT e w)
instance Control.Comonad.Env.Class.ComonadEnv e w => Control.Comonad.Env.Class.ComonadEnv e (Control.Monad.Trans.Identity.IdentityT w)
instance Control.Comonad.Env.Class.ComonadEnv e w => Control.Comonad.Env.Class.ComonadEnv e (Control.Comonad.Trans.Store.StoreT t w)
instance (Control.Comonad.Env.Class.ComonadEnv e w, GHC.Internal.Base.Monoid m) => Control.Comonad.Env.Class.ComonadEnv e (Control.Comonad.Trans.Traced.TracedT m w)
instance Control.Comonad.Env.Class.ComonadEnv e ((,) e)

-- | The Env comonad (aka the Coreader, Environment, or Product comonad)
--   
--   A co-Kleisli arrow in the Env comonad is isomorphic to a Kleisli arrow
--   in the reader monad.
--   
--   (a -> e -> m) ~ (a, e) -> m ~ Env e a -> m
module Control.Comonad.Env
class Comonad w => ComonadEnv e (w :: Type -> Type) | w -> e
ask :: ComonadEnv e w => w a -> e
asks :: ComonadEnv e w => (e -> e') -> w a -> e'

-- | Modifies the environment using the specified function.
local :: forall e e' (w :: Type -> Type) a. (e -> e') -> EnvT e w a -> EnvT e' w a
type Env e = EnvT e Identity

-- | Create an Env using an environment and a value
env :: e -> a -> Env e a
runEnv :: Env e a -> (e, a)
data EnvT e (w :: Type -> Type) a
EnvT :: e -> w a -> EnvT e (w :: Type -> Type) a
runEnvT :: EnvT e w a -> (e, w a)

module Data.Functor.Composition

-- | We often need to distinguish between various forms of Functor-like
--   composition in Haskell in order to please the type system. This lets
--   us work with these representations uniformly.
class Composition (o :: Type -> Type -> Type -> Type -> Type -> Type)
decompose :: Composition o => o f g x -> f (g x)
compose :: Composition o => f (g x) -> o f g x
instance Data.Functor.Composition.Composition Data.Functor.Compose.Compose
