free-functors-1.0.1: Free functors, adjoint to functors that forget class constraints.

LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Functor.HFree

Description

A free functor is left adjoint to a forgetful functor. In this package the forgetful functor forgets class constraints.

Compared to Data.Functor.Free we're going up a level. These free functors go between categories of functors and the natural transformations between them.

Synopsis

Documentation

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

Natural transformations.

newtype HFree c f a Source #

The higher order free functor for constraint c.

Constructors

HFree 

Fields

Instances
(forall (x :: Type -> Type). c x => Monad x) => Monad (HFree c f) Source #

The free monad of a functor.

Instance details

Defined in Data.Functor.HFree

Methods

(>>=) :: HFree c f a -> (a -> HFree c f b) -> HFree c f b #

(>>) :: HFree c f a -> HFree c f b -> HFree c f b #

return :: a -> HFree c f a #

fail :: String -> HFree c f a #

(forall (x :: Type -> Type). c x => Functor x) => Functor (HFree c f) Source # 
Instance details

Defined in Data.Functor.HFree

Methods

fmap :: (a -> b) -> HFree c f a -> HFree c f b #

(<$) :: a -> HFree c f b -> HFree c f a #

(forall (x :: Type -> Type). c x => Applicative x) => Applicative (HFree c f) Source # 
Instance details

Defined in Data.Functor.HFree

Methods

pure :: a -> HFree c f a #

(<*>) :: HFree c f (a -> b) -> HFree c f a -> HFree c f b #

liftA2 :: (a -> b -> c0) -> HFree c f a -> HFree c f b -> HFree c f c0 #

(*>) :: HFree c f a -> HFree c f b -> HFree c f b #

(<*) :: HFree c f a -> HFree c f b -> HFree c f a #

(forall (x :: Type -> Type). c x => Contravariant x) => Contravariant (HFree c f) Source # 
Instance details

Defined in Data.Functor.HFree

Methods

contramap :: (a -> b) -> HFree c f b -> HFree c f a #

(>$) :: b -> HFree c f b -> HFree c f a #

(forall (x :: Type -> Type). c x => Alternative x) => Alternative (HFree c f) Source # 
Instance details

Defined in Data.Functor.HFree

Methods

empty :: HFree c f a #

(<|>) :: HFree c f a -> HFree c f a -> HFree c f a #

some :: HFree c f a -> HFree c f [a] #

many :: HFree c f a -> HFree c f [a] #

(forall (x :: Type -> Type). c x => Divisible x) => Divisible (HFree c f) Source # 
Instance details

Defined in Data.Functor.HFree

Methods

divide :: (a -> (b, c0)) -> HFree c f b -> HFree c f c0 -> HFree c f a #

conquer :: HFree c f a #

(forall (x :: Type -> Type). c x => Decidable x) => Decidable (HFree c f) Source # 
Instance details

Defined in Data.Functor.HFree

Methods

lose :: (a -> Void) -> HFree c f a #

choose :: (a -> Either b c0) -> HFree c f b -> HFree c f c0 -> HFree c f a #

unit :: f :~> HFree c f Source #

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

counit :: c f => HFree c f :~> f Source #

counit = rightAdjunct id

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

leftAdjunct f = f . unit

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

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

bind :: (f :~> HFree c g) -> HFree c f :~> HFree c g Source #

liftFree :: f a -> HFree c f a Source #

lowerFree :: c f => HFree c f a -> f a Source #

convert :: (c (t f), Monad f, MonadTrans t) => HFree c f a -> t f a Source #

iter :: c Identity => (forall b. f b -> b) -> HFree c f a -> a Source #

wrap :: f (HFree Monad f a) -> HFree Monad f a Source #