free-functors-1.2.1: Free functors, adjoint to functors that forget class constraints.
LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Functor.HHCofree

Description

A cofree functor is right adjoint to a forgetful functor. In this package the forgetful functor forgets class constraints.

Compared to Data.Functor.HCofree we have 2 two parameters.

Synopsis

Documentation

type (:~~>) f g = forall c d. f c d -> g c d Source #

Natural transformations.

data HHCofree c g a b where Source #

The higher order cofree functor for constraint c.

Constructors

HHCofree :: c f => (f :~~> g) -> f a b -> HHCofree c g a b 

Instances

Instances details
ProfunctorComonad (HHCofree c) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

proextract :: forall (p :: Type -> Type -> Type). Profunctor p => HHCofree c p :-> p

produplicate :: forall (p :: Type -> Type -> Type). Profunctor p => HHCofree c p :-> HHCofree c (HHCofree c p)

BifunctorComonad (HHCofree c :: (Type -> Type -> Type) -> Type -> Type -> Type) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

biextract :: forall (p :: k -> k1 -> Type). HHCofree c p :-> p

biextend :: forall (p :: k -> k1 -> Type) (q :: k -> k1 -> Type). (HHCofree c p :-> q) -> HHCofree c p :-> HHCofree c q

biduplicate :: forall (p :: k -> k1 -> Type). HHCofree c p :-> HHCofree c (HHCofree c p)

ProfunctorFunctor (HHCofree c :: (Type -> Type -> Type) -> Type -> Type -> Type) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

promap :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type). Profunctor p => (p :-> q) -> HHCofree c p :-> HHCofree c q

BifunctorFunctor (HHCofree c :: (Type -> Type -> Type) -> Type -> Type -> Type) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

bifmap :: forall (p :: k -> k1 -> Type) (q :: k -> k1 -> Type). (p :-> q) -> HHCofree c p :-> HHCofree c q

(c ~=> Bifunctor, c (HHCofree c a)) => Bifunctor (HHCofree c a) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

bimap :: (a0 -> b) -> (c0 -> d) -> HHCofree c a a0 c0 -> HHCofree c a b d #

first :: (a0 -> b) -> HHCofree c a a0 c0 -> HHCofree c a b c0 #

second :: (b -> c0) -> HHCofree c a a0 b -> HHCofree c a a0 c0 #

(c ~=> Choice, c (HHCofree c a)) => Choice (HHCofree c a) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

left' :: HHCofree c a a0 b -> HHCofree c a (Either a0 c0) (Either b c0)

right' :: HHCofree c a a0 b -> HHCofree c a (Either c0 a0) (Either c0 b)

(c ~=> Closed, c (HHCofree c a)) => Closed (HHCofree c a) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

closed :: HHCofree c a a0 b -> HHCofree c a (x -> a0) (x -> b)

(c ~=> Strong, c (HHCofree c a)) => Strong (HHCofree c a) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

first' :: HHCofree c a a0 b -> HHCofree c a (a0, c0) (b, c0)

second' :: HHCofree c a a0 b -> HHCofree c a (c0, a0) (c0, b)

(c ~=> Profunctor, c (HHCofree c a)) => Profunctor (HHCofree c a) Source # 
Instance details

Defined in Data.Functor.HHCofree

Methods

dimap :: (a0 -> b) -> (c0 -> d) -> HHCofree c a b c0 -> HHCofree c a a0 d

lmap :: (a0 -> b) -> HHCofree c a b c0 -> HHCofree c a a0 c0

rmap :: (b -> c0) -> HHCofree c a a0 b -> HHCofree c a a0 c0

(#.) :: forall a0 b c0 q. Coercible c0 b => q b c0 -> HHCofree c a a0 b -> HHCofree c a a0 c0

(.#) :: forall a0 b c0 q. Coercible b a0 => HHCofree c a b c0 -> q a0 b -> HHCofree c a a0 c0

deriveHHCofreeInstance :: Name -> Q [Dec] Source #

Derive the instance of HHCofree c a for the class c.

For example:

deriveHHCofreeInstance ''Profunctor

leftAdjunct :: c f => (f :~~> g) -> f :~~> HHCofree c g Source #

unit :: c g => g :~~> HHCofree c g Source #

unit = leftAdjunct id

rightAdjunct :: (f :~~> HHCofree c g) -> f :~~> g Source #

rightAdjunct f = counit . f

transform :: (forall r. c r => (r :~~> f) -> r :~~> g) -> HHCofree c f :~~> HHCofree c g Source #

hfmap :: (f :~~> g) -> HHCofree c f :~~> HHCofree c g Source #