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

-- | Kan extensions, Kan lifts, the Yoneda lemma, and (co)density (co)monads
--   
--   Kan extensions, Kan lifts, various forms of the Yoneda lemma, and
--   (co)density (co)monads.
@package kan-extensions
@version 5.2.7

-- | The co-Yoneda lemma for presheafs states that f is naturally
--   isomorphic to Coyoneda f.
module Data.Functor.Contravariant.Coyoneda

-- | A Contravariant functor (aka presheaf) suitable for Yoneda
--   reduction.
--   
--   http://ncatlab.org/nlab/show/Yoneda+reduction
data Coyoneda (f :: Type -> Type) a
[Coyoneda] :: forall a b (f :: Type -> Type). (a -> b) -> f b -> Coyoneda f a

-- | Coyoneda "expansion" of a presheaf
--   
--   
--   liftCoyoneda . lowerCoyoneda ≡ id
--   lowerCoyoneda . liftCoyoneda ≡ id
--   
liftCoyoneda :: f a -> Coyoneda f a

-- | Coyoneda reduction on a presheaf
lowerCoyoneda :: Contravariant f => Coyoneda f a -> f a

-- | Lift a natural transformation from f to g to a
--   natural transformation from Coyoneda f to Coyoneda
--   g.
hoistCoyoneda :: (forall a. () => f a -> g a) -> Coyoneda f b -> Coyoneda g b
instance Data.Functor.Contravariant.Adjunction.Adjunction f g => Data.Functor.Contravariant.Adjunction.Adjunction (Data.Functor.Contravariant.Coyoneda.Coyoneda f) (Data.Functor.Contravariant.Coyoneda.Coyoneda g)
instance Data.Functor.Contravariant.Contravariant (Data.Functor.Contravariant.Coyoneda.Coyoneda f)
instance Data.Functor.Contravariant.Rep.Representable f => Data.Functor.Contravariant.Rep.Representable (Data.Functor.Contravariant.Coyoneda.Coyoneda f)

-- | The Day convolution of two contravariant functors is a contravariant
--   functor.
--   
--   http://ncatlab.org/nlab/show/Day+convolution
module Data.Functor.Contravariant.Day

-- | The Day convolution of two contravariant functors.
data Day (f :: Type -> Type) (g :: Type -> Type) a
Day :: f b -> g c -> (a -> (b, c)) -> Day (f :: Type -> Type) (g :: Type -> Type) a

-- | Construct the Day convolution
--   
--   
--   day1 (day f g) = f
--   day2 (day f g) = g
--   
day :: f a -> g b -> Day f g (a, b)

-- | Break apart the Day convolution of two contravariant functors.
runDay :: (Contravariant f, Contravariant g) => Day f g a -> (f a, g a)

-- | Day convolution provides a monoidal product. The associativity of this
--   monoid is witnessed by assoc and disassoc.
--   
--   
--   assoc . disassoc = id
--   disassoc . assoc = id
--   contramap f . assoc = assoc . contramap f
--   
assoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day f (Day g h) a -> Day (Day f g) h a

-- | Day convolution provides a monoidal product. The associativity of this
--   monoid is witnessed by assoc and disassoc.
--   
--   
--   assoc . disassoc = id
--   disassoc . assoc = id
--   contramap f . disassoc = disassoc . contramap f
--   
disassoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day (Day f g) h a -> Day f (Day g h) a

-- | The monoid for Day convolution in Haskell is symmetric.
--   
--   
--   contramap f . swapped = swapped . contramap f
--   
swapped :: forall (f :: Type -> Type) (g :: Type -> Type) a. Day f g a -> Day g f a

-- | Proxy serves as the unit of Day convolution.
--   
--   
--   day1 . intro1 = id
--   contramap f . intro1 = intro1 . contramap f
--   
intro1 :: f a -> Day (Proxy :: Type -> Type) f a

-- | Proxy serves as the unit of Day convolution.
--   
--   
--   day2 . intro2 = id
--   contramap f . intro2 = intro2 . contramap f
--   
intro2 :: f a -> Day f (Proxy :: Type -> Type) a

-- | In Haskell we can do general purpose elimination, but in a more
--   general setting it is only possible to eliminate the unit.
--   
--   
--   day1 . intro1 = id
--   day1 = fst . runDay
--   contramap f . day1 = day1 . contramap f
--   
day1 :: forall f (g :: Type -> Type) a. Contravariant f => Day f g a -> f a

-- | In Haskell we can do general purpose elimination, but in a more
--   general setting it is only possible to eliminate the unit. 
--   day2 . intro2 = id day2 =
--   snd . runDay contramap f .
--   day2 = day2 . contramap f 
day2 :: forall g (f :: Type -> Type) a. Contravariant g => Day f g a -> g a

-- | Diagonalize the Day convolution:
--   
--   
--   day1 . diag = id
--   day2 . diag = id
--   runDay . diag = a -> (a,a)
--   contramap f . diag = diag . contramap f
--   
diag :: f a -> Day f f a

-- | Apply a natural transformation to the left-hand side of a Day
--   convolution.
--   
--   This respects the naturality of the natural transformation you
--   supplied:
--   
--   
--   contramap f . trans1 fg = trans1 fg . contramap f
--   
trans1 :: forall f g (h :: Type -> Type) a. (forall x. () => f x -> g x) -> Day f h a -> Day g h a

-- | Apply a natural transformation to the right-hand side of a Day
--   convolution.
--   
--   This respects the naturality of the natural transformation you
--   supplied:
--   
--   
--   contramap f . trans2 fg = trans2 fg . contramap f
--   
trans2 :: forall g h (f :: Type -> Type) a. (forall x. () => g x -> h x) -> Day f g a -> Day f h a
instance (Data.Functor.Contravariant.Adjunction.Adjunction f u, Data.Functor.Contravariant.Adjunction.Adjunction f' u') => Data.Functor.Contravariant.Adjunction.Adjunction (Data.Functor.Contravariant.Day.Day f f') (Data.Functor.Contravariant.Day.Day u u')
instance Data.Functor.Contravariant.Contravariant (Data.Functor.Contravariant.Day.Day f g)
instance (Data.Functor.Contravariant.Divisible.Divisible f, Data.Functor.Contravariant.Divisible.Divisible g) => Data.Functor.Contravariant.Divisible.Divisible (Data.Functor.Contravariant.Day.Day f g)
instance (Data.Functor.Contravariant.Rep.Representable f, Data.Functor.Contravariant.Rep.Representable g) => Data.Functor.Contravariant.Rep.Representable (Data.Functor.Contravariant.Day.Day f g)

module Data.Functor.Contravariant.Yoneda

-- | Yoneda embedding for a presheaf
newtype Yoneda (f :: Type -> Type) a
Yoneda :: (forall r. () => (r -> a) -> f r) -> Yoneda (f :: Type -> Type) a
[runYoneda] :: Yoneda (f :: Type -> Type) a -> forall r. () => (r -> a) -> f r

-- | 
--   liftYoneda . lowerYoneda ≡ id
--   lowerYoneda . liftYoneda ≡ id
--   
liftYoneda :: Contravariant f => f a -> Yoneda f a
lowerYoneda :: Yoneda f a -> f a
instance Data.Functor.Contravariant.Adjunction.Adjunction f g => Data.Functor.Contravariant.Adjunction.Adjunction (Data.Functor.Contravariant.Yoneda.Yoneda f) (Data.Functor.Contravariant.Yoneda.Yoneda g)
instance Data.Functor.Contravariant.Contravariant (Data.Functor.Contravariant.Yoneda.Yoneda f)
instance Data.Functor.Contravariant.Rep.Representable f => Data.Functor.Contravariant.Rep.Representable (Data.Functor.Contravariant.Yoneda.Yoneda f)

-- | Eitan Chatav first introduced me to this construction
--   
--   The Day convolution of two covariant functors is a covariant functor.
--   
--   Day convolution is usually defined in terms of contravariant functors,
--   however, it just needs a monoidal category, and Hask^op is also
--   monoidal.
--   
--   Day convolution can be used to nicely describe monoidal functors as
--   monoid objects w.r.t this product.
--   
--   http://ncatlab.org/nlab/show/Day+convolution
module Data.Functor.Day

-- | The Day convolution of two covariant functors.
data Day (f :: Type -> Type) (g :: Type -> Type) a
Day :: f b -> g c -> (b -> c -> a) -> Day (f :: Type -> Type) (g :: Type -> Type) a

-- | Construct the Day convolution
day :: f (a -> b) -> g a -> Day f g b

-- | Collapse via a monoidal functor.
--   
--   
--   dap (day f g) = f <*> g
--   
dap :: Applicative f => Day f f a -> f a

-- | Day convolution provides a monoidal product. The associativity of this
--   monoid is witnessed by assoc and disassoc.
--   
--   
--   assoc . disassoc = id
--   disassoc . assoc = id
--   fmap f . assoc = assoc . fmap f
--   
assoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day f (Day g h) a -> Day (Day f g) h a

-- | Day convolution provides a monoidal product. The associativity of this
--   monoid is witnessed by assoc and disassoc.
--   
--   
--   assoc . disassoc = id
--   disassoc . assoc = id
--   fmap f . disassoc = disassoc . fmap f
--   
disassoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day (Day f g) h a -> Day f (Day g h) a

-- | The monoid for Day convolution on the cartesian monoidal
--   structure is symmetric.
--   
--   
--   fmap f . swapped = swapped . fmap f
--   
swapped :: forall (f :: Type -> Type) (g :: Type -> Type) a. Day f g a -> Day g f a

-- | Identity is the unit of Day convolution
--   
--   
--   intro1 . elim1 = id
--   elim1 . intro1 = id
--   
intro1 :: f a -> Day Identity f a

-- | Identity is the unit of Day convolution
--   
--   
--   intro2 . elim2 = id
--   elim2 . intro2 = id
--   
intro2 :: f a -> Day f Identity a

-- | Identity is the unit of Day convolution
--   
--   
--   intro1 . elim1 = id
--   elim1 . intro1 = id
--   
elim1 :: Functor f => Day Identity f a -> f a

-- | Identity is the unit of Day convolution
--   
--   
--   intro2 . elim2 = id
--   elim2 . intro2 = id
--   
elim2 :: Functor f => Day f Identity a -> f a

-- | Apply a natural transformation to the left-hand side of a Day
--   convolution.
--   
--   This respects the naturality of the natural transformation you
--   supplied:
--   
--   
--   fmap f . trans1 fg = trans1 fg . fmap f
--   
trans1 :: forall f g (h :: Type -> Type) a. (forall x. () => f x -> g x) -> Day f h a -> Day g h a

-- | Apply a natural transformation to the right-hand side of a Day
--   convolution.
--   
--   This respects the naturality of the natural transformation you
--   supplied:
--   
--   
--   fmap f . trans2 fg = trans2 fg . fmap f
--   
trans2 :: forall g h (f :: Type -> Type) a. (forall x. () => g x -> h x) -> Day f g a -> Day f h a
cayley :: forall (f :: Type -> Type) (p :: Type -> Type -> Type) (g :: Type -> Type) (q :: Type -> Type -> Type) a b. Procompose (Cayley f p) (Cayley g q) a b -> Cayley (Day f g) (Procompose p q) a b

-- | Proposition 4.1 from Pastro and Street
dayley :: forall (p :: Type -> Type -> Type) (f :: Type -> Type) (g :: Type -> Type) a b. Category p => Procompose (Cayley f p) (Cayley g p) a b -> Cayley (Day f g) p a b
instance (Data.Functor.Adjunction.Adjunction f u, Data.Functor.Adjunction.Adjunction f' u') => Data.Functor.Adjunction.Adjunction (Data.Functor.Day.Day f f') (Data.Functor.Day.Day u u')
instance (GHC.Internal.Base.Applicative f, GHC.Internal.Base.Applicative g) => GHC.Internal.Base.Applicative (Data.Functor.Day.Day f g)
instance (Control.Comonad.ComonadApply f, Control.Comonad.ComonadApply g) => Control.Comonad.ComonadApply (Data.Functor.Day.Day f g)
instance (Control.Comonad.Comonad f, Control.Comonad.Comonad g) => Control.Comonad.Comonad (Data.Functor.Day.Day f g)
instance Control.Comonad.Comonad f => Control.Comonad.Trans.Class.ComonadTrans (Data.Functor.Day.Day f)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Distributive.Distributive (Data.Functor.Day.Day f g)
instance GHC.Internal.Base.Functor (Data.Functor.Day.Day f g)
instance (Data.Functor.Rep.Representable f, Data.Functor.Rep.Representable g) => Data.Functor.Rep.Representable (Data.Functor.Day.Day f g)

-- | 
--   Day f -| Curried f
--   
--   
--   Day f ~ Compose f when f preserves colimits /
--   is a left adjoint. (Due in part to the strength of all functors in
--   Hask.)
--   
--   So by the uniqueness of adjoints, when f is a left adjoint,
--   Curried f ~ Rift f
module Data.Functor.Day.Curried
newtype Curried (g :: Type -> Type) (h :: Type -> Type) a
Curried :: (forall r. () => g (a -> r) -> h r) -> Curried (g :: Type -> Type) (h :: Type -> Type) a
[runCurried] :: Curried (g :: Type -> Type) (h :: Type -> Type) a -> forall r. () => g (a -> r) -> h r

-- | The universal property of Curried
toCurried :: forall (g :: Type -> Type) k h a. (forall x. () => Day g k x -> h x) -> k a -> Curried g h a

-- | 
--   toCurried . fromCurried ≡ id
--   fromCurried . toCurried ≡ id
--   
fromCurried :: forall (f :: Type -> Type) k h b. Functor f => (forall a. () => k a -> Curried f h a) -> Day f k b -> h b

-- | This is the counit of the Day f -| Curried f adjunction
applied :: forall (f :: Type -> Type) g a. Functor f => Day f (Curried f g) a -> g a

-- | This is the unit of the Day f -| Curried f adjunction
unapplied :: forall g a (f :: Type -> Type). g a -> Curried f (Day f g) a

-- | Curried f Identity a is isomorphic to the right adjoint to
--   f if one exists.
--   
--   
--   adjointToCurried . curriedToAdjoint ≡ id
--   curriedToAdjoint . adjointToCurried ≡ id
--   
adjointToCurried :: forall (f :: Type -> Type) u a. Adjunction f u => u a -> Curried f Identity a

-- | Curried f Identity a is isomorphic to the right adjoint to
--   f if one exists.
curriedToAdjoint :: forall (f :: Type -> Type) u a. Adjunction f u => Curried f Identity a -> u a

-- | Curried f h a is isomorphic to the post-composition of the
--   right adjoint of f onto h if such a right adjoint
--   exists.
composedAdjointToCurried :: forall h (f :: Type -> Type) u a. (Functor h, Adjunction f u) => u (h a) -> Curried f h a

-- | Curried f h a is isomorphic to the post-composition of the
--   right adjoint of f onto h if such a right adjoint
--   exists.
--   
--   
--   curriedToComposedAdjoint . composedAdjointToCurried ≡ id
--   composedAdjointToCurried . curriedToComposedAdjoint ≡ id
--   
curriedToComposedAdjoint :: forall (f :: Type -> Type) u h a. Adjunction f u => Curried f h a -> u (h a)

-- | The natural isomorphism between f and Curried f f.
--    lowerCurried . liftCurried ≡ id
--   liftCurried . lowerCurried ≡ id 
--   
--   
--   lowerCurried (liftCurried x)     -- definition
--   lowerCurried (Curried (<*> x))   -- definition
--   (<*> x) (pure id)          -- beta reduction
--   pure id <*> x              -- Applicative identity law
--   x
--   
liftCurried :: Applicative f => f a -> Curried f f a

-- | Lower Curried by applying pure id to the
--   continuation.
--   
--   See liftCurried.
lowerCurried :: forall (f :: Type -> Type) g a. Applicative f => Curried f g a -> g a

-- | Indexed applicative composition of right Kan lifts.
rap :: forall (f :: Type -> Type) (g :: Type -> Type) a b (h :: Type -> Type). Functor f => Curried f g (a -> b) -> Curried g h a -> Curried f h b
instance (GHC.Internal.Base.Functor g, g GHC.Types.~ h) => GHC.Internal.Base.Applicative (Data.Functor.Day.Curried.Curried g h)
instance (GHC.Internal.Base.Functor g, g GHC.Types.~ h) => Data.Functor.Bind.Class.Apply (Data.Functor.Day.Curried.Curried g h)
instance GHC.Internal.Base.Functor g => GHC.Internal.Base.Functor (Data.Functor.Day.Curried.Curried g h)

-- | The Day convolution of two invariant functors is an invariant functor.
--   
--   http://ncatlab.org/nlab/show/Day+convolution
module Data.Functor.Invariant.Day

-- | The Day convolution of two invariant functors.
data Day (f :: Type -> Type) (g :: Type -> Type) a
Day :: f b -> g c -> (b -> c -> a) -> (a -> (b, c)) -> Day (f :: Type -> Type) (g :: Type -> Type) a

-- | Construct the Day convolution
day :: f a -> g b -> Day f g (a, b)

-- | Day convolution provides a monoidal product. The associativity of this
--   monoid is witnessed by assoc and disassoc.
--   
--   
--   assoc . disassoc = id
--   disassoc . assoc = id
--   invmap f g . assoc = assoc . invmap f g
--   
assoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day f (Day g h) a -> Day (Day f g) h a

-- | Day convolution provides a monoidal product. The associativity of this
--   monoid is witnessed by assoc and disassoc.
--   
--   
--   assoc . disassoc = id
--   disassoc . assoc = id
--   invmap f g . disassoc = disassoc . invmap f g
--   
disassoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day (Day f g) h a -> Day f (Day g h) a

-- | The monoid for Day convolution on the cartesian monoidal
--   structure is symmetric.
--   
--   
--   invmap f g . swapped = swapped . invmap f g
--   
swapped :: forall (f :: Type -> Type) (g :: Type -> Type) a. Day f g a -> Day g f a

-- | Identity is the unit of Day convolution
--   
--   
--   intro1 . elim1 = id
--   elim1 . intro1 = id
--   
intro1 :: f a -> Day Identity f a

-- | Identity is the unit of Day convolution
--   
--   
--   intro2 . elim2 = id
--   elim2 . intro2 = id
--   
intro2 :: f a -> Day f Identity a

-- | Identity is the unit of Day convolution
--   
--   
--   intro1 . elim1 = id
--   elim1 . intro1 = id
--   
elim1 :: Invariant f => Day Identity f a -> f a

-- | Identity is the unit of Day convolution
--   
--   
--   intro2 . elim2 = id
--   elim2 . intro2 = id
--   
elim2 :: Invariant f => Day f Identity a -> f a

-- | Apply a natural transformation to the left-hand side of a Day
--   convolution.
--   
--   This respects the naturality of the natural transformation you
--   supplied:
--   
--   
--   invmap f g . trans1 fg = trans1 fg . invmap f g
--   
trans1 :: forall f g (h :: Type -> Type) a. (forall x. () => f x -> g x) -> Day f h a -> Day g h a

-- | Apply a natural transformation to the right-hand side of a Day
--   convolution.
--   
--   This respects the naturality of the natural transformation you
--   supplied:
--   
--   
--   invmap f g . trans2 fg = trans2 fg . invmap f g
--   
trans2 :: forall g h (f :: Type -> Type) a. (forall x. () => g x -> h x) -> Day f g a -> Day f h a

-- | Drop the covariant part of the Day convolution.
toContravariant :: forall (f :: Type -> Type) (g :: Type -> Type) a. Day f g a -> Day f g a

-- | Drop the contravariant part of the Day convolution.
toCovariant :: forall (f :: Type -> Type) (g :: Type -> Type) a. Day f g a -> Day f g a
instance Data.Functor.Invariant.Invariant (Data.Functor.Invariant.Day.Day f g)

-- | Left Kan Extensions
module Data.Functor.Kan.Lan

-- | The left Kan extension of a Functor h along a
--   Functor g.
data Lan (g :: k -> Type) (h :: k -> Type) a
[Lan] :: forall {k} (g :: k -> Type) (b :: k) a (h :: k -> Type). (g b -> a) -> h b -> Lan g h a

-- | The universal property of a left Kan extension.
toLan :: forall {k} f h g b. Functor f => (forall (a :: k). () => h a -> f (g a)) -> Lan g h b -> f b

-- | fromLan and toLan witness a (higher kinded) adjunction
--   between Lan g and (Compose g)
--   
--   
--   toLan . fromLan ≡ id
--   fromLan . toLan ≡ id
--   
fromLan :: forall {k} g h f (b :: k). (forall a. () => Lan g h a -> f a) -> h b -> f (g b)

-- | This is the natural transformation that defines a Left Kan extension.
glan :: forall {k} h (a :: k) g. h a -> Lan g h (g a)

-- | composeLan and decomposeLan witness the natural
--   isomorphism from Lan f (Lan g h) and Lan (f o g)
--   h
--   
--   
--   composeLan . decomposeLan ≡ id
--   decomposeLan . composeLan ≡ id
--   
composeLan :: forall (compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. (Composition compose, Functor f) => Lan f (Lan g h) a -> Lan (compose f g) h a
decomposeLan :: forall (compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Composition compose => Lan (compose f g) h a -> Lan f (Lan g h) a

-- | 
--   adjointToLan . lanToAdjoint ≡ id
--   lanToAdjoint . adjointToLan ≡ id
--   
adjointToLan :: forall (f :: Type -> Type) g a. Adjunction f g => g a -> Lan f Identity a
lanToAdjoint :: forall (f :: Type -> Type) g a. Adjunction f g => Lan f Identity a -> g a
composedAdjointToLan :: forall (f :: Type -> Type) g h a. Adjunction f g => h (g a) -> Lan f h a

-- | lanToComposedAdjoint and composedAdjointToLan witness
--   the natural isomorphism between Lan f h and Compose h
--   g given f -| g
--   
--   
--   composedAdjointToLan . lanToComposedAdjoint ≡ id
--   lanToComposedAdjoint . composedAdjointToLan ≡ id
--   
lanToComposedAdjoint :: forall h (f :: Type -> Type) g a. (Functor h, Adjunction f g) => Lan f h a -> h (g a)
instance (GHC.Internal.Base.Functor g, GHC.Internal.Base.Applicative h) => GHC.Internal.Base.Applicative (Data.Functor.Kan.Lan.Lan g h)
instance (GHC.Internal.Base.Functor g, Data.Functor.Bind.Class.Apply h) => Data.Functor.Bind.Class.Apply (Data.Functor.Kan.Lan.Lan g h)
instance forall k (f :: k -> *) (g :: k -> *). GHC.Internal.Base.Functor (Data.Functor.Kan.Lan.Lan f g)

-- | Coyoneda f is the "free functor" over f. The
--   co-Yoneda lemma for a covariant Functor f states that
--   Coyoneda f is naturally isomorphic to f.
module Data.Functor.Coyoneda

-- | A covariant Functor suitable for Yoneda reduction
data Coyoneda (f :: Type -> Type) a
[Coyoneda] :: forall b a (f :: Type -> Type). (b -> a) -> f b -> Coyoneda f a

-- | Yoneda "expansion"
--   
--   
--   liftCoyoneda . lowerCoyoneda ≡ id
--   lowerCoyoneda . liftCoyoneda ≡ id
--   
--   
--   
--   lowerCoyoneda (liftCoyoneda fa) = -- by definition
--   lowerCoyoneda (Coyoneda id fa)  = -- by definition
--   fmap id fa                      = -- functor law
--   fa
--   
--   
--   
--   lift = liftCoyoneda
--   
liftCoyoneda :: f a -> Coyoneda f a

-- | Yoneda reduction lets us walk under the existential and apply
--   fmap.
--   
--   Mnemonically, "Yoneda reduction" sounds like and works a bit like
--   β-reduction.
--   
--   http://ncatlab.org/nlab/show/Yoneda+reduction
--   
--   You can view Coyoneda as just the arguments to fmap
--   tupled up.
--   
--   
--   lower = lowerM = lowerCoyoneda
--   
lowerCoyoneda :: Functor f => Coyoneda f a -> f a

-- | Yoneda reduction given a Monad lets us walk under the
--   existential and apply liftM.
--   
--   You can view Coyoneda as just the arguments to liftM
--   tupled up.
--   
--   
--   lower = lowerM = lowerCoyoneda
--   
lowerM :: Monad f => Coyoneda f a -> f a

-- | Lift a natural transformation from f to g to a
--   natural transformation from Coyoneda f to Coyoneda
--   g.
hoistCoyoneda :: (forall a. () => f a -> g a) -> Coyoneda f b -> Coyoneda g b

-- | Coyoneda f is the left Kan extension of f along the
--   Identity functor.
--   
--   Coyoneda f is always a functor, even if f is not. In
--   this case, it is called the free functor over f. Note
--   the following categorical fine print: If f is not a functor,
--   Coyoneda f is actually not the left Kan extension of
--   f along the Identity functor, but along the inclusion
--   functor from the discrete subcategory of Hask which contains
--   only identity functions as morphisms to the full category Hask.
--   (This is because f, not being a proper functor, can only be
--   interpreted as a categorical functor by restricting the source
--   category to only contain identities.)
--   
--   
--   coyonedaToLan . lanToCoyoneda ≡ id
--   lanToCoyoneda . coyonedaToLan ≡ id
--   
coyonedaToLan :: forall (f :: Type -> Type) a. Coyoneda f a -> Lan Identity f a
lanToCoyoneda :: forall (f :: Type -> Type) a. Lan Identity f a -> Coyoneda f a
instance Data.Functor.Adjunction.Adjunction f g => Data.Functor.Adjunction.Adjunction (Data.Functor.Coyoneda.Coyoneda f) (Data.Functor.Coyoneda.Coyoneda g)
instance Data.Functor.Alt.Alt f => Data.Functor.Alt.Alt (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Base.Alternative f => GHC.Internal.Base.Alternative (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Base.Applicative f => GHC.Internal.Base.Applicative (Data.Functor.Coyoneda.Coyoneda f)
instance Data.Functor.Bind.Class.Apply f => Data.Functor.Bind.Class.Apply (Data.Functor.Coyoneda.Coyoneda f)
instance Data.Functor.Bind.Class.Bind m => Data.Functor.Bind.Class.Bind (Data.Functor.Coyoneda.Coyoneda m)
instance Control.Comonad.Comonad w => Control.Comonad.Comonad (Data.Functor.Coyoneda.Coyoneda w)
instance Control.Comonad.Trans.Class.ComonadTrans Data.Functor.Coyoneda.Coyoneda
instance Data.Distributive.Distributive f => Data.Distributive.Distributive (Data.Functor.Coyoneda.Coyoneda f)
instance Data.Functor.Classes.Eq1 f => Data.Functor.Classes.Eq1 (Data.Functor.Coyoneda.Coyoneda f)
instance (Data.Functor.Classes.Eq1 f, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Functor.Coyoneda.Coyoneda f a)
instance Data.Functor.Extend.Extend w => Data.Functor.Extend.Extend (Data.Functor.Coyoneda.Coyoneda w)
instance Data.Foldable1.Foldable1 f => Data.Foldable1.Foldable1 (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Data.Foldable.Foldable f => GHC.Internal.Data.Foldable.Foldable (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Base.Functor (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Data.Functor.Coyoneda.Coyoneda m)
instance GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Base.MonadPlus f => GHC.Internal.Base.MonadPlus (Data.Functor.Coyoneda.Coyoneda f)
instance Control.Monad.Trans.Class.MonadTrans Data.Functor.Coyoneda.Coyoneda
instance Data.Functor.Classes.Ord1 f => Data.Functor.Classes.Ord1 (Data.Functor.Coyoneda.Coyoneda f)
instance (Data.Functor.Classes.Ord1 f, GHC.Classes.Ord a) => GHC.Classes.Ord (Data.Functor.Coyoneda.Coyoneda f a)
instance Data.Functor.Plus.Plus f => Data.Functor.Plus.Plus (Data.Functor.Coyoneda.Coyoneda f)
instance Data.Functor.Classes.Read1 f => Data.Functor.Classes.Read1 (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Read.Read (f a) => GHC.Internal.Read.Read (Data.Functor.Coyoneda.Coyoneda f a)
instance Data.Functor.Rep.Representable f => Data.Functor.Rep.Representable (Data.Functor.Coyoneda.Coyoneda f)
instance (GHC.Internal.Base.Functor f, Data.Functor.Classes.Show1 f) => Data.Functor.Classes.Show1 (Data.Functor.Coyoneda.Coyoneda f)
instance (GHC.Internal.Base.Functor f, Data.Functor.Classes.Show1 f, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Data.Functor.Coyoneda.Coyoneda f a)
instance Data.Semigroup.Traversable.Class.Traversable1 f => Data.Semigroup.Traversable.Class.Traversable1 (Data.Functor.Coyoneda.Coyoneda f)
instance GHC.Internal.Data.Traversable.Traversable f => GHC.Internal.Data.Traversable.Traversable (Data.Functor.Coyoneda.Coyoneda f)

-- | The Density Comonad for a Functor (aka the
--   'Comonad generated by a Functor) The Density term dates
--   back to Dubuc''s 1974 thesis. The term Monad generated by a
--   Functor dates back to 1972 in Street''s ''Formal Theory of
--   Monads''.
--   
--   The left Kan extension of a Functor along itself
--   (Lan f f) forms a Comonad. This is that
--   Comonad.
module Control.Comonad.Density
data Density (k1 :: k -> Type) a
[Density] :: forall {k} (k1 :: k -> Type) (b :: k) a. (k1 b -> a) -> k1 b -> Density k1 a

-- | The natural transformation from a Comonad w to the
--   Comonad generated by w (forwards).
--   
--   This is merely a right-inverse (section) of lower, rather than
--   a full inverse.
--   
--   
--   lower . liftDensity ≡ id
--   
liftDensity :: Comonad w => w a -> Density w a

-- | The Density Comonad of a left adjoint is isomorphic to the
--   Comonad formed by that Adjunction.
--   
--   This isomorphism is witnessed by densityToAdjunction and
--   adjunctionToDensity.
--   
--   
--   densityToAdjunction . adjunctionToDensity ≡ id
--   adjunctionToDensity . densityToAdjunction ≡ id
--   
densityToAdjunction :: Adjunction f g => Density f a -> f (g a)
adjunctionToDensity :: Adjunction f g => f (g a) -> Density f a
densityToLan :: forall {k} (f :: k -> Type) a. Density f a -> Lan f f a

-- | The Density Comonad of a Functor f is
--   obtained by taking the left Kan extension (Lan) of f
--   along itself. This isomorphism is witnessed by lanToDensity and
--   densityToLan
--   
--   
--   lanToDensity . densityToLan ≡ id
--   densityToLan . lanToDensity ≡ id
--   
lanToDensity :: forall {k} (f :: k -> Type) a. Lan f f a -> Density f a
instance GHC.Internal.Base.Applicative f => GHC.Internal.Base.Applicative (Control.Comonad.Density.Density f)
instance Data.Functor.Bind.Class.Apply f => Data.Functor.Bind.Class.Apply (Control.Comonad.Density.Density f)
instance forall k (f :: k -> *). Control.Comonad.Comonad (Control.Comonad.Density.Density f)
instance Control.Comonad.Trans.Class.ComonadTrans Control.Comonad.Density.Density
instance forall k (f :: k -> *). Data.Functor.Extend.Extend (Control.Comonad.Density.Density f)
instance forall k (f :: k -> *). GHC.Internal.Base.Functor (Control.Comonad.Density.Density f)

-- | Monads from Comonads
--   
--   http://comonad.com/reader/2011/monads-from-comonads/
--   
--   Co can be viewed as a right Kan lift along a Comonad.
--   
--   In general you can "sandwich" a monad in between two halves of an
--   adjunction. That is to say, if you have an adjunction F -| G : C
--   -> D  then not only does GF form a monad, but
--   GMF forms a monad for M a monad in D.
--   Therefore if we have an adjunction F -| G : Hask ->
--   Hask^op then we can lift a Comonad in Hask which
--   is a Monad in Hask^op to a Monad in
--   Hask.
--   
--   For any r, the Contravariant functor / presheaf
--   (-> r) :: Hask^op -> Hask is adjoint to the "same"
--   Contravariant functor (-> r) :: Hask ->
--   Hask^op. So we can sandwich a Monad in Hask^op in the middle to
--   obtain w (a -> r-) -> r+, and then take a coend over
--   r to obtain forall r. w (a -> r) -> r. This
--   gives rise to Co. If we observe that we didn't care what the
--   choices we made for r were to finish this construction, we
--   can upgrade to forall r. w (a -> m r) -> m r in a
--   manner similar to how ContT is constructed yielding
--   CoT.
--   
--   We could consider unifying the definition of Co and
--   Rift, but there are many other arguments for which
--   Rift can form a Monad, and this wouldn't give rise to
--   CoT.
module Control.Monad.Co
type Co (w :: Type -> Type) = CoT w Identity
co :: Functor w => (forall r. () => w (a -> r) -> r) -> Co w a
runCo :: Functor w => Co w a -> w (a -> r) -> r

-- | 
--   Co w a ~ Rift w Identity a
--   
newtype CoT (w :: Type -> Type) (m :: k -> Type) a
CoT :: (forall (r :: k). () => w (a -> m r) -> m r) -> CoT (w :: Type -> Type) (m :: k -> Type) a
[runCoT] :: CoT (w :: Type -> Type) (m :: k -> Type) a -> forall (r :: k). () => w (a -> m r) -> m r
liftCoT0 :: forall {k} w s (m :: k -> Type). Comonad w => (forall a. () => w a -> s) -> CoT w m s
liftCoT0M :: (Comonad w, Monad m) => (forall a. () => w a -> m s) -> CoT w m s
lowerCoT0 :: (Functor w, Monad m) => CoT w m s -> w a -> m s
lowerCo0 :: Functor w => Co w s -> w a -> s
liftCoT1 :: forall {k} w (m :: k -> Type). (forall a. () => w a -> a) -> CoT w m ()
liftCoT1M :: Monad m => (forall a. () => w a -> m a) -> CoT w m ()
lowerCoT1 :: (Functor w, Monad m) => CoT w m () -> w a -> m a
lowerCo1 :: Functor w => Co w () -> w a -> a
diter :: Functor f => a -> (a -> f a) -> Density (Cofree f) a
dctrlM :: forall {k} m w. Monad m => (forall (a :: k). () => w a -> m (w a)) -> CoT (Density w) m ()
posW :: forall {k} s (w :: Type -> Type) (m :: k -> Type). ComonadStore s w => CoT w m s
peekW :: forall {k} s (w :: Type -> Type) (m :: k -> Type). ComonadStore s w => s -> CoT w m ()
peeksW :: forall {k} s (w :: Type -> Type) (m :: k -> Type). ComonadStore s w => (s -> s) -> CoT w m ()
askW :: forall {k} e (w :: Type -> Type) (m :: k -> Type). ComonadEnv e w => CoT w m e
asksW :: forall {k} e (w :: Type -> Type) a (m :: k -> Type). ComonadEnv e w => (e -> a) -> CoT w m a
traceW :: forall {k} e (w :: Type -> Type) (m :: k -> Type). ComonadTraced e w => e -> CoT w m ()
instance forall k (w :: * -> *) (m :: k -> *). Control.Comonad.Comonad w => GHC.Internal.Base.Applicative (Control.Monad.Co.CoT w m)
instance forall k (w :: * -> *) (m :: k -> *). Data.Functor.Extend.Extend w => Data.Functor.Bind.Class.Apply (Control.Monad.Co.CoT w m)
instance forall k (w :: * -> *) (m :: k -> *). Data.Functor.Extend.Extend w => Data.Functor.Bind.Class.Bind (Control.Monad.Co.CoT w m)
instance forall k (w :: * -> *) (m :: k -> *). GHC.Internal.Base.Functor w => GHC.Internal.Base.Functor (Control.Monad.Co.CoT w m)
instance forall k (w :: * -> *) (m :: k -> *). Control.Comonad.Comonad w => GHC.Internal.Base.Monad (Control.Monad.Co.CoT w m)
instance (Control.Comonad.Comonad w, Control.Monad.Error.Class.MonadError e m) => Control.Monad.Error.Class.MonadError e (Control.Monad.Co.CoT w m)
instance (Control.Comonad.Comonad w, GHC.Internal.Control.Monad.Fail.MonadFail m) => GHC.Internal.Control.Monad.Fail.MonadFail (Control.Monad.Co.CoT w m)
instance (Control.Comonad.Comonad w, Control.Monad.IO.Class.MonadIO m) => Control.Monad.IO.Class.MonadIO (Control.Monad.Co.CoT w m)
instance (Control.Comonad.Comonad w, Control.Monad.Reader.Class.MonadReader e m) => Control.Monad.Reader.Class.MonadReader e (Control.Monad.Co.CoT w m)
instance (Control.Comonad.Comonad w, Control.Monad.State.Class.MonadState s m) => Control.Monad.State.Class.MonadState s (Control.Monad.Co.CoT w m)
instance Control.Comonad.Comonad w => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Co.CoT w)
instance (Control.Comonad.Comonad w, Control.Monad.Writer.Class.MonadWriter e m) => Control.Monad.Writer.Class.MonadWriter e (Control.Monad.Co.CoT w m)

-- | 
--   
- Right Kan Extensions
--   
module Data.Functor.Kan.Ran

-- | The right Kan extension of a Functor h along a Functor
--   g.
--   
--   We can define a right Kan extension in several ways. The definition
--   here is obtained by reading off the definition in of a right Kan
--   extension in terms of an End, but we can derive an equivalent
--   definition from the universal property.
--   
--   Given a Functor h : C -> D and a Functor
--   g : C -> C', we want to extend h back
--   along g to give Ran g h : C' -> D, such that the
--   natural transformation gran :: Ran g h (g a) -> h a
--   exists.
--   
--   In some sense this is trying to approximate the inverse of g
--   by using one of its adjoints, because if the adjoint and the inverse
--   both exist, they match!
--   
--   
--   Hask -h-> Hask
--     |       +
--     g      /
--     |    Ran g h
--     v    /
--   Hask -'
--   
--   
--   The Right Kan extension is unique (up to isomorphism) by taking this
--   as its universal property.
--   
--   That is to say given any K : C' -> D such that we have a
--   natural transformation from k.g to h (forall x.
--   k (g x) -> h x) there exists a canonical natural
--   transformation from k to Ran g h. (forall x. k x
--   -> Ran g h x).
--   
--   We could literally read this off as a valid Rank-3 definition for
--   Ran:
--   
--   
--   data Ran' g h a = forall z. Functor z => Ran' (forall x. z (g x) -> h x) (z a)
--   
--   
--   This definition is isomorphic the simpler Rank-2 definition we use
--   below as witnessed by the
--   
--   
--   ranIso1 :: Ran g f x -> Ran' g f x
--   ranIso1 (Ran e) = Ran' e id
--   
--   
--   
--   ranIso2 :: Ran' g f x -> Ran g f x
--   ranIso2 (Ran' h z) = Ran $ \k -> h (k <$> z)
--   
--   
--   
--   ranIso2 (ranIso1 (Ran e)) ≡ -- by definition
--   ranIso2 (Ran' e id) ≡       -- by definition
--   Ran $ \k -> e (k <$> id)    -- by definition
--   Ran $ \k -> e (k . id)      -- f . id = f
--   Ran $ \k -> e k             -- eta reduction
--   Ran e
--   
--   
--   The other direction is left as an exercise for the reader.
newtype Ran (g :: k -> Type) (h :: k -> Type) a
Ran :: (forall (b :: k). () => (a -> g b) -> h b) -> Ran (g :: k -> Type) (h :: k -> Type) a
[runRan] :: Ran (g :: k -> Type) (h :: k -> Type) a -> forall (b :: k). () => (a -> g b) -> h b

-- | The universal property of a right Kan extension.
toRan :: forall {k1} k2 g h b. Functor k2 => (forall (a :: k1). () => k2 (g a) -> h a) -> k2 b -> Ran g h b

-- | toRan and fromRan witness a higher kinded adjunction.
--   from (`Compose' g) to Ran g
--   
--   
--   toRan . fromRan ≡ id
--   fromRan . toRan ≡ id
--   
fromRan :: forall {k1} k2 g h (b :: k1). (forall a. () => k2 a -> Ran g h a) -> k2 (g b) -> h b

-- | This is the natural transformation that defines a Right Kan extension.
gran :: forall {k} g h (a :: k). Ran g h (g a) -> h a

-- | 
--   composeRan . decomposeRan ≡ id
--   decomposeRan . composeRan ≡ id
--   
composeRan :: forall (compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Composition compose => Ran f (Ran g h) a -> Ran (compose f g) h a
decomposeRan :: forall (compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. (Composition compose, Functor f) => Ran (compose f g) h a -> Ran f (Ran g h) a

-- | 
--   adjointToRan . ranToAdjoint ≡ id
--   ranToAdjoint . adjointToRan ≡ id
--   
adjointToRan :: forall f (g :: Type -> Type) a. Adjunction f g => f a -> Ran g Identity a
ranToAdjoint :: forall f (g :: Type -> Type) a. Adjunction f g => Ran g Identity a -> f a
composedAdjointToRan :: forall f (g :: Type -> Type) h a. (Adjunction f g, Functor h) => h (f a) -> Ran g h a

-- | 
--   composedAdjointToRan . ranToComposedAdjoint ≡ id
--   ranToComposedAdjoint . composedAdjointToRan ≡ id
--   
ranToComposedAdjoint :: forall f (g :: Type -> Type) h a. Adjunction f g => Ran g h a -> h (f a)
repToRan :: forall (u :: Type -> Type) a. Representable u => Rep u -> a -> Ran u Identity a
ranToRep :: forall (u :: Type -> Type) a. Representable u => Ran u Identity a -> (Rep u, a)
composedRepToRan :: forall (u :: Type -> Type) h a. (Representable u, Functor h) => h (Rep u, a) -> Ran u h a
ranToComposedRep :: forall (u :: Type -> Type) h a. Representable u => Ran u h a -> h (Rep u, a)
instance forall k (g :: k -> *) (h :: k -> *). GHC.Internal.Base.Functor (Data.Functor.Kan.Ran.Ran g h)

module Control.Monad.Codensity

-- | Codensity f is the Monad generated by taking the right
--   Kan extension of any Functor f along itself (Ran f
--   f).
--   
--   This can often be more "efficient" to construct than f itself
--   using repeated applications of (>>=).
--   
--   See "Asymptotic Improvement of Computations over Free Monads" by Janis
--   Voigtländer for more information about this type.
--   
--   
--   https://www.janis-voigtlaender.eu/papers/AsymptoticImprovementOfComputationsOverFreeMonads.pdf
newtype Codensity (m :: k -> TYPE rep) a
Codensity :: (forall (b :: k). () => (a -> m b) -> m b) -> Codensity (m :: k -> TYPE rep) a
[runCodensity] :: Codensity (m :: k -> TYPE rep) a -> forall (b :: k). () => (a -> m b) -> m b

-- | This serves as the *left*-inverse (retraction) of lift.
--   
--   
--   lowerCodensity . lift ≡ id
--   
--   
--   In general this is not a full 2-sided inverse, merely a retraction, as
--   Codensity m is often considerably "larger" than
--   m.
--   
--   e.g. Codensity ((->) s)) a ~ forall r. (a -> s ->
--   r) -> s -> r could support a full complement of
--   MonadState s actions, while (->) s is
--   limited to MonadReader s actions.
lowerCodensity :: Applicative f => Codensity f a -> f a

-- | The Codensity monad of a right adjoint is isomorphic to the
--   monad obtained from the Adjunction.
--   
--   
--   codensityToAdjunction . adjunctionToCodensity ≡ id
--   adjunctionToCodensity . codensityToAdjunction ≡ id
--   
codensityToAdjunction :: Adjunction f g => Codensity g a -> g (f a)
adjunctionToCodensity :: Adjunction f g => g (f a) -> Codensity g a

-- | The Codensity Monad of a Functor g is
--   the right Kan extension (Ran) of g along itself.
--   
--   
--   codensityToRan . ranToCodensity ≡ id
--   ranToCodensity . codensityToRan ≡ id
--   
codensityToRan :: forall {k} (g :: k -> Type) a. Codensity g a -> Ran g g a
ranToCodensity :: forall {k} (g :: k -> Type) a. Ran g g a -> Codensity g a

-- | The Codensity monad of a representable Functor is
--   isomorphic to the monad obtained from the Adjunction for which
--   that Functor is the right adjoint.
--   
--   
--   codensityToComposedRep . composedRepToCodensity ≡ id
--   composedRepToCodensity . codensityToComposedRep ≡ id
--   
--   
--   
--   codensityToComposedRep = ranToComposedRep . codensityToRan
--   
codensityToComposedRep :: Representable u => Codensity u a -> u (Rep u, a)

-- | 
--   composedRepToCodensity = ranToCodensity . composedRepToRan
--   
composedRepToCodensity :: Representable u => u (Rep u, a) -> Codensity u a

-- | Wrap the remainder of the Codensity action using the given
--   function.
--   
--   This function can be used to register cleanup actions that will be
--   executed at the end. Example:
--   
--   
--   wrapCodensity (`finally` putStrLn "Done.")
--   
wrapCodensity :: (forall (a :: k). () => m a -> m a) -> Codensity m ()

-- | Right associate all binds in a computation that generates a free monad
--   
--   This can improve the asymptotic efficiency of the result, while
--   preserving semantics.
--   
--   See "Asymptotic Improvement of Computations over Free Monads" by Janis
--   Voightländer for more information about this combinator.
--   
--   http://www.iai.uni-bonn.de/~jv/mpc08.pdf
improve :: forall (f :: Type -> Type) a. Functor f => (forall (m :: Type -> Type). MonadFree f m => m a) -> Free f a

-- | reset m delimits the continuation of any shift
--   inside m.
--   
--   
--   
- 
reset (return m) = return m

--   
reset :: forall (m :: Type -> Type) a. Monad m => Codensity m a -> Codensity m a

-- | shift f captures the continuation up to the nearest
--   enclosing reset and passes it to f:
--   
--   
--   
- 
reset (shift f >>= k) = reset (f
--   (lowerCodensity . k))

--   
shift :: Applicative m => (forall b. () => (a -> m b) -> Codensity m b) -> Codensity m a
instance forall k (v :: k -> *) (v' :: * -> *). (v GHC.Types.~~ v', Data.Functor.Alt.Alt v') => Data.Functor.Alt.Alt (Control.Monad.Codensity.Codensity v)
instance forall k (v :: k -> *) (v' :: * -> *). (v GHC.Types.~~ v', GHC.Internal.Base.Alternative v') => GHC.Internal.Base.Alternative (Control.Monad.Codensity.Codensity v)
instance forall k (f :: k -> *). GHC.Internal.Base.Applicative (Control.Monad.Codensity.Codensity f)
instance forall k (f :: k -> *). Data.Functor.Bind.Class.Apply (Control.Monad.Codensity.Codensity f)
instance forall j (k :: j -> *). GHC.Internal.Base.Functor (Control.Monad.Codensity.Codensity k)
instance forall k (f :: k -> *). GHC.Internal.Base.Monad (Control.Monad.Codensity.Codensity f)
instance forall k (f :: k -> *) (f' :: * -> *). (f GHC.Types.~~ f', GHC.Internal.Control.Monad.Fail.MonadFail f') => GHC.Internal.Control.Monad.Fail.MonadFail (Control.Monad.Codensity.Codensity f)
instance forall k (m :: k -> *) (m' :: * -> *) (f :: * -> *). (m GHC.Types.~~ m', GHC.Internal.Base.Functor f, Control.Monad.Free.Class.MonadFree f m') => Control.Monad.Free.Class.MonadFree f (Control.Monad.Codensity.Codensity m)
instance forall k (m :: k -> *) (m' :: * -> *). (m GHC.Types.~~ m', Control.Monad.IO.Class.MonadIO m') => Control.Monad.IO.Class.MonadIO (Control.Monad.Codensity.Codensity m)
instance forall k (v :: k -> *) (v' :: * -> *). (v GHC.Types.~~ v', GHC.Internal.Base.Alternative v') => GHC.Internal.Base.MonadPlus (Control.Monad.Codensity.Codensity v)
instance forall k (m :: k -> *) (m' :: * -> *) r. (m GHC.Types.~~ m', Control.Monad.Reader.Class.MonadReader r m') => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Codensity.Codensity m)
instance forall k (m :: k -> *) (m' :: * -> *) r. (m GHC.Types.~~ m', Control.Monad.Reader.Class.MonadReader r m') => Control.Monad.State.Class.MonadState r (Control.Monad.Codensity.Codensity m)
instance Control.Monad.Trans.Class.MonadTrans Control.Monad.Codensity.Codensity
instance forall k (v :: k -> *) (v' :: * -> *). (v GHC.Types.~~ v', Data.Functor.Plus.Plus v') => Data.Functor.Plus.Plus (Control.Monad.Codensity.Codensity v)

-- | The covariant form of the Yoneda lemma states that f is
--   naturally isomorphic to Yoneda f.
--   
--   This is described in a rather intuitive fashion by Dan Piponi in
--   
--   http://blog.sigfpe.com/2006/11/yoneda-lemma.html
module Data.Functor.Yoneda

-- | Yoneda f a can be viewed as the partial application of
--   fmap to its second argument.
newtype Yoneda (f :: Type -> Type) a
Yoneda :: (forall b. () => (a -> b) -> f b) -> Yoneda (f :: Type -> Type) a
[runYoneda] :: Yoneda (f :: Type -> Type) a -> forall b. () => (a -> b) -> f b

-- | The natural isomorphism between f and Yoneda
--   f given by the Yoneda lemma is witnessed by liftYoneda and
--   lowerYoneda
--   
--   
--   liftYoneda . lowerYoneda ≡ id
--   lowerYoneda . liftYoneda ≡ id
--   
--   
--   
--   lowerYoneda (liftYoneda fa) =         -- definition
--   lowerYoneda (Yoneda (f -> fmap f a)) -- definition
--   (f -> fmap f fa) id                  -- beta reduction
--   fmap id fa                            -- functor law
--   fa
--   
--   
--   
--   lift = liftYoneda
--   
liftYoneda :: Functor f => f a -> Yoneda f a
lowerYoneda :: Yoneda f a -> f a
maxF :: forall (f :: Type -> Type) a. (Functor f, Ord (f a)) => Yoneda f a -> Yoneda f a -> Yoneda f a
minF :: forall (f :: Type -> Type) a. (Functor f, Ord (f a)) => Yoneda f a -> Yoneda f a -> Yoneda f a
maxM :: forall (m :: Type -> Type) a. (Monad m, Ord (m a)) => Yoneda m a -> Yoneda m a -> Yoneda m a
minM :: forall (m :: Type -> Type) a. (Monad m, Ord (m a)) => Yoneda m a -> Yoneda m a -> Yoneda m a

-- | Yoneda f can be viewed as the right Kan extension of
--   f along the Identity functor.
--   
--   
--   yonedaToRan . ranToYoneda ≡ id
--   ranToYoneda . yonedaToRan ≡ id
--   
yonedaToRan :: forall (f :: Type -> Type) a. Yoneda f a -> Ran Identity f a
ranToYoneda :: forall (f :: Type -> Type) a. Ran Identity f a -> Yoneda f a
instance Data.Functor.Adjunction.Adjunction f g => Data.Functor.Adjunction.Adjunction (Data.Functor.Yoneda.Yoneda f) (Data.Functor.Yoneda.Yoneda g)
instance Data.Functor.Alt.Alt f => Data.Functor.Alt.Alt (Data.Functor.Yoneda.Yoneda f)
instance GHC.Internal.Base.Alternative f => GHC.Internal.Base.Alternative (Data.Functor.Yoneda.Yoneda f)
instance GHC.Internal.Base.Applicative f => GHC.Internal.Base.Applicative (Data.Functor.Yoneda.Yoneda f)
instance Data.Functor.Bind.Class.Apply f => Data.Functor.Bind.Class.Apply (Data.Functor.Yoneda.Yoneda f)
instance Data.Functor.Bind.Class.Bind m => Data.Functor.Bind.Class.Bind (Data.Functor.Yoneda.Yoneda m)
instance Control.Comonad.Trans.Class.ComonadTrans Data.Functor.Yoneda.Yoneda
instance Control.Comonad.Comonad w => Control.Comonad.Comonad (Data.Functor.Yoneda.Yoneda w)
instance Data.Distributive.Distributive f => Data.Distributive.Distributive (Data.Functor.Yoneda.Yoneda f)
instance Data.Functor.Classes.Eq1 f => Data.Functor.Classes.Eq1 (Data.Functor.Yoneda.Yoneda f)
instance (Data.Functor.Classes.Eq1 f, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Functor.Yoneda.Yoneda f a)
instance Data.Functor.Extend.Extend w => Data.Functor.Extend.Extend (Data.Functor.Yoneda.Yoneda w)
instance Data.Foldable1.Foldable1 f => Data.Foldable1.Foldable1 (Data.Functor.Yoneda.Yoneda f)
instance GHC.Internal.Data.Foldable.Foldable f => GHC.Internal.Data.Foldable.Foldable (Data.Functor.Yoneda.Yoneda f)
instance GHC.Internal.Base.Functor (Data.Functor.Yoneda.Yoneda f)
instance GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Monad.Fix.MonadFix (Data.Functor.Yoneda.Yoneda m)
instance (GHC.Internal.Base.Functor f, Control.Monad.Free.Class.MonadFree f m) => Control.Monad.Free.Class.MonadFree f (Data.Functor.Yoneda.Yoneda m)
instance GHC.Internal.Base.MonadPlus m => GHC.Internal.Base.MonadPlus (Data.Functor.Yoneda.Yoneda m)
instance Control.Monad.Trans.Class.MonadTrans Data.Functor.Yoneda.Yoneda
instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monad (Data.Functor.Yoneda.Yoneda m)
instance Data.Functor.Classes.Ord1 f => Data.Functor.Classes.Ord1 (Data.Functor.Yoneda.Yoneda f)
instance (Data.Functor.Classes.Ord1 f, GHC.Classes.Ord a) => GHC.Classes.Ord (Data.Functor.Yoneda.Yoneda f a)
instance Data.Functor.Plus.Plus f => Data.Functor.Plus.Plus (Data.Functor.Yoneda.Yoneda f)
instance (Data.Functor.Classes.Read1 f, GHC.Internal.Base.Functor f) => Data.Functor.Classes.Read1 (Data.Functor.Yoneda.Yoneda f)
instance (GHC.Internal.Base.Functor f, GHC.Internal.Read.Read (f a)) => GHC.Internal.Read.Read (Data.Functor.Yoneda.Yoneda f a)
instance Data.Functor.Rep.Representable g => Data.Functor.Rep.Representable (Data.Functor.Yoneda.Yoneda g)
instance Data.Functor.Classes.Show1 f => Data.Functor.Classes.Show1 (Data.Functor.Yoneda.Yoneda f)
instance GHC.Internal.Show.Show (f a) => GHC.Internal.Show.Show (Data.Functor.Yoneda.Yoneda f a)
instance Data.Semigroup.Traversable.Class.Traversable1 f => Data.Semigroup.Traversable.Class.Traversable1 (Data.Functor.Yoneda.Yoneda f)
instance GHC.Internal.Data.Traversable.Traversable f => GHC.Internal.Data.Traversable.Traversable (Data.Functor.Yoneda.Yoneda f)
