functor-combinators-0.3.1.0: Tools for functor combinator-based program design

Copyright(c) Justin Le 2019
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Functor.Contravariant.Divisible.Free

Description

Provides free structures for the various typeclasses of the Divisible hierarchy.

Since: 0.3.0.0

Synopsis

Documentation

data Div :: (Type -> Type) -> Type -> Type where Source #

The free Divisible. Used to sequence multiple contravariant consumers, splitting out the input across all consumers.

Note that Div f is essentially ListF (Coyoneda f), or just ListF f in the case that f is already contravariant. However, this is left in here because it can be more convenient to use if you are working with an intermediate f that isn't Contravariant.

Constructors

Conquer :: Div f a 
Divide :: (a -> (b, c)) -> f b -> Div f c -> Div f a 
Instances
Inject Div Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: f ~> Div f Source #

FreeOf Divisible Div Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Div :: (Type -> Type) -> Constraint Source #

HFunctor Div Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: (f ~> g) -> Div f ~> Div g Source #

Divisible f => Interpret Div (f :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

retract :: Div f ~> f Source #

interpret :: (g ~> f) -> Div g ~> f Source #

Contravariant (Div f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

contramap :: (a -> b) -> Div f b -> Div f a #

(>$) :: b -> Div f b -> Div f a #

Divisible (Div f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

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

conquer :: Div f a #

Invariant (Div f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

invmap :: (a -> b) -> (b -> a) -> Div f a -> Div f b #

Divise (Div f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

divise :: (a -> (b, c)) -> Div f b -> Div f c -> Div f a Source #

type FreeFunctorBy Div Source # 
Instance details

Defined in Data.HFunctor.Final

hoistDiv :: forall f g. (f ~> g) -> Div f ~> Div g Source #

Map over the undering context in a Div.

liftDiv :: f ~> Div f Source #

Inject a single action in f into a Div f.

runDiv :: forall f g. Divisible g => (f ~> g) -> Div f ~> g Source #

Interpret a Div into a context g, provided g is Divisible.

divListF :: forall f. Contravariant f => Div f ~> ListF f Source #

Div is isomorphic to ListF for contravariant f. This witnesses one way of that isomorphism.

Be aware that this is essentially O(n^2).

listFDiv :: ListF f ~> Div f Source #

Div is isomorphic to ListF for contravariant f. This witnesses one way of that isomorphism.

This direction is O(n), unlike divListF.

data Div1 :: (Type -> Type) -> Type -> Type where Source #

The free Divise: a non-empty version of Div.

Note that Div1 f is essentially NonEmptyF (Coyoneda f), or just NonEmptyF f in the case that f is already contravariant. However, it can be more convenient to use if you are working with an intermediate f that isn't Contravariant.

Constructors

Div1 :: (a -> (b, c)) -> f b -> Div f c -> Div1 f a 
Instances
Inject Div1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: f ~> Div1 f Source #

FreeOf Divise Div1 Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Div1 :: (Type -> Type) -> Constraint Source #

HFunctor Div1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: (f ~> g) -> Div1 f ~> Div1 g Source #

Divise f => Interpret Div1 (f :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

retract :: Div1 f ~> f Source #

interpret :: (g ~> f) -> Div1 g ~> f Source #

Contravariant (Div1 f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

contramap :: (a -> b) -> Div1 f b -> Div1 f a #

(>$) :: b -> Div1 f b -> Div1 f a #

Invariant (Div1 f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

invmap :: (a -> b) -> (b -> a) -> Div1 f a -> Div1 f b #

Divise (Div1 f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

divise :: (a -> (b, c)) -> Div1 f b -> Div1 f c -> Div1 f a Source #

type FreeFunctorBy Div1 Source # 
Instance details

Defined in Data.HFunctor.Final

hoistDiv1 :: (f ~> g) -> Div1 f ~> Div1 g Source #

Map over the undering context in a Div1.

liftDiv1 :: f ~> Div1 f Source #

Inject a single action in f into a Div f.

toDiv :: Div1 f a -> Div f a Source #

A Div1 is a "non-empty" Div; this function "forgets" the non-empty property and turns it back into a normal Div.

runDiv1 :: Divise g => (f ~> g) -> Div1 f ~> g Source #

Interpret a Div1 into a context g, provided g is Divise.

div1NonEmptyF :: Contravariant f => Div1 f ~> NonEmptyF f Source #

Div1 is isomorphic to NonEmptyF for contravariant f. This witnesses one way of that isomorphism.

Be aware that this is essentially O(n^2).

nonEmptyFDiv1 :: NonEmptyF f ~> Div1 f Source #

Div1 is isomorphic to NonEmptyF for contravariant f. This witnesses one way of that isomorphism.

This direction is O(n), unlike div1NonEmptyF.

data Dec :: (Type -> Type) -> Type -> Type where Source #

The free Decide. Used to aggregate multiple possible consumers, directing the input into an appropriate consumer.

Constructors

Lose :: (a -> Void) -> Dec f a 
Choose :: (a -> Either b c) -> f b -> Dec f c -> Dec f a 
Instances
Inject Dec Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: f ~> Dec f Source #

FreeOf Conclude Dec Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Dec :: (Type -> Type) -> Constraint Source #

HFunctor Dec Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: (f ~> g) -> Dec f ~> Dec g Source #

Conclude f => Interpret Dec (f :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

retract :: Dec f ~> f Source #

interpret :: (g ~> f) -> Dec g ~> f Source #

Contravariant (Dec f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

contramap :: (a -> b) -> Dec f b -> Dec f a #

(>$) :: b -> Dec f b -> Dec f a #

Invariant (Dec f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

invmap :: (a -> b) -> (b -> a) -> Dec f a -> Dec f b #

Decide (Dec f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

decide :: (a -> Either b c) -> Dec f b -> Dec f c -> Dec f a Source #

Conclude (Dec f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

conclude :: (a -> Void) -> Dec f a Source #

type FreeFunctorBy Dec Source # 
Instance details

Defined in Data.HFunctor.Final

hoistDec :: forall f g. (f ~> g) -> Dec f ~> Dec g Source #

Map over the undering context in a Dec.

liftDec :: f ~> Dec f Source #

Inject a single action in f into a Dec f.

runDec :: forall f g. Conclude g => (f ~> g) -> Dec f ~> g Source #

Interpret a Dec into a context g, provided g is Conclude.

data Dec1 :: (Type -> Type) -> Type -> Type where Source #

The free Decide: a non-empty version of Dec.

Constructors

Dec1 :: (a -> Either b c) -> f b -> Dec f c -> Dec1 f a 
Instances
Inject Dec1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

inject :: f ~> Dec1 f Source #

FreeOf Decide Dec1 Source #

Since: 0.3.0.0

Instance details

Defined in Data.HFunctor.Final

Associated Types

type FreeFunctorBy Dec1 :: (Type -> Type) -> Constraint Source #

HFunctor Dec1 Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

hmap :: (f ~> g) -> Dec1 f ~> Dec1 g Source #

Decide f => Interpret Dec1 (f :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

retract :: Dec1 f ~> f Source #

interpret :: (g ~> f) -> Dec1 g ~> f Source #

Contravariant (Dec1 f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

contramap :: (a -> b) -> Dec1 f b -> Dec1 f a #

(>$) :: b -> Dec1 f b -> Dec1 f a #

Invariant (Dec1 f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

invmap :: (a -> b) -> (b -> a) -> Dec1 f a -> Dec1 f b #

Decide (Dec1 f) Source # 
Instance details

Defined in Data.Functor.Contravariant.Divisible.Free

Methods

decide :: (a -> Either b c) -> Dec1 f b -> Dec1 f c -> Dec1 f a Source #

type FreeFunctorBy Dec1 Source # 
Instance details

Defined in Data.HFunctor.Final

hoistDec1 :: forall f g. (f ~> g) -> Dec1 f ~> Dec1 g Source #

Map over the undering context in a Dec1.

liftDec1 :: f ~> Dec1 f Source #

Inject a single action in f into a Dec1 f.

toDec :: Dec1 f a -> Dec f a Source #

A Dec1 is a "non-empty" Dec; this function "forgets" the non-empty property and turns it back into a normal Dec.

runDec1 :: Decide g => (f ~> g) -> Dec1 f ~> g Source #

Interpret a Dec1 into a context g, provided g is Decide.