free-4.2: Monads for free

PortabilityGADTs, Rank2Types
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellNone

Control.Applicative.Free

Description

Applicative functors for free

Synopsis

Documentation

data Ap f a whereSource

The free Applicative for a Functor f.

Constructors

Pure :: a -> Ap f a 
Ap :: f a -> Ap f (a -> b) -> Ap f b 

Instances

Functor (Ap f) 
Typeable1 f => Typeable1 (Ap f) 
Applicative (Ap f) 
Apply (Ap f) 

runAp :: Applicative g => (forall x. f x -> g x) -> Ap f a -> g aSource

Given a natural transformation from f to g, this gives a canonical monoidal natural transformation from Ap f to g.

liftAp :: f a -> Ap f aSource

A version of lift that can be used with just a Functor for f.

hoistAp :: (forall a. f a -> g a) -> Ap f b -> Ap g bSource

Given a natural transformation from f to g this gives a monoidal natural transformation from Ap f to Ap g.

retractAp :: Applicative f => Ap f a -> f aSource