concat-examples-0.3.0.0: Some examples of compiling to categories
Maintainerconal@conal.net
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

ConCat.Demand

Description

Demand algebra

Synopsis

Documentation

data Demand :: * -> * where Source #

Demand pattern

Constructors

NoneD :: Demand a 
(:***) :: Demand a -> Demand b -> Demand (a :* b) 
(:+++) :: Demand a -> Demand b -> Demand (a :+ b) 
(:~>) :: Demand a -> Demand b -> Demand (a -> b) 
AllD :: Demand a 

Instances

Instances details
Show (Demand a) Source # 
Instance details

Defined in ConCat.Demand

demand :: Demand a -> Unop a Source #

Semantic function. Extract just the demanded information.

split :: Demand a -> (Unop a, Unop a) Source #

Alternative Semantic function. Splits into needed info and complement.

_split :: Demand a -> (Unop a, Unop a) Source #

lift2Split :: (Unop a -> Unop b -> c) -> Demand a -> Demand b -> (c, c) Source #

complementD :: Unop (Demand a) Source #

Complement of Demand

(*:) :: Demand a -> Demand b -> Demand (a :* b) Source #

Product demand

(+:) :: Demand a -> Demand b -> Demand (a :+ b) Source #

Sum demand

(>:) :: Demand a -> Demand b -> Demand (a -> b) Source #

Function demand

combineD :: Unop (Demand a -> Demand b -> Demand (a `op` b)) Source #

Building block for smart constructor, assuming that NoneD op NoneD == NoneD and AllD op AllD == AllD.

pairD :: (Demand a :* Demand b) -> Demand (a :* b) Source #

inUnpairD :: ((Demand a' :* Demand b') -> Demand a :* Demand b) -> Demand (a' :* b') -> Demand (a :* b) Source #

plusD :: (Demand a, Demand b) -> Demand (a :+ b) Source #

unplusD :: Demand (a :+ b) -> (Demand a, Demand b) Source #

inUnplusD :: ((Demand a' :* Demand b') -> Demand a :* Demand b) -> Demand (a' :+ b') -> Demand (a :+ b) Source #

funD :: (Demand a, Demand b) -> Demand (a -> b) Source #

unfunD :: Demand (a -> b) -> (Demand a, Demand b) Source #

inUnfunD :: ((Demand a, Demand b) -> (Demand a', Demand b')) -> Demand (a -> b) -> Demand (a' -> b') Source #

mergeD :: Demand (a :* a) -> Demand a Source #

lubD :: Demand a -> Demand a -> Demand a Source #

Least upper bound on demands. Specification: demand (ra lubD rb) == demand ra lub demand rb.

glbD :: Demand a -> Demand a -> Demand a Source #

Greatest lower bound on demands. Specification: demand (ra glbD rb) == demand ra glb demand rb.

newtype a :-? b infixr 1 Source #

Demand flow category, running counter to value flow

Constructors

RX (Demand b -> Demand a) 

Instances

Instances details
BoolCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

BraidedPCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

Methods

swapP :: Ok2 (:-?) a b => Prod (:-?) a b :-? Prod (:-?) b a Source #

BraidedSCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

Methods

swapS :: Ok2 (:-?) a b => Coprod (:-?) a b :-? Coprod (:-?) b a Source #

Category (:-?) Source # 
Instance details

Defined in ConCat.Demand

Associated Types

type Ok (:-?) :: Type -> Constraint Source #

Methods

id :: Ok (:-?) a => a :-? a Source #

(.) :: forall b c a. Ok3 (:-?) a b c => (b :-? c) -> (a :-? b) -> a :-? c Source #

CoproductCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

Methods

inl :: Ok2 (:-?) a b => a :-? Coprod (:-?) a b Source #

inr :: Ok2 (:-?) a b => b :-? Coprod (:-?) a b Source #

jam :: Ok (:-?) a => Coprod (:-?) a a :-? a Source #

MonoidalPCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

Methods

(***) :: Ok4 (:-?) a b c d => (a :-? c) -> (b :-? d) -> Prod (:-?) a b :-? Prod (:-?) c d Source #

first :: forall a a' b. Ok3 (:-?) a b a' => (a :-? a') -> Prod (:-?) a b :-? Prod (:-?) a' b Source #

second :: Ok3 (:-?) a b b' => (b :-? b') -> Prod (:-?) a b :-? Prod (:-?) a b' Source #

MonoidalSCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

Methods

(+++) :: Ok4 (:-?) a b c d => (c :-? a) -> (d :-? b) -> Coprod (:-?) c d :-? Coprod (:-?) a b Source #

left :: forall a a' b. Oks (:-?) '[a, b, a'] => (a :-? a') -> Coprod (:-?) a b :-? Coprod (:-?) a' b Source #

right :: Oks (:-?) '[a, b, b'] => (b :-? b') -> Coprod (:-?) a b :-? Coprod (:-?) a b' Source #

ProductCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

Methods

exl :: Ok2 (:-?) a b => Prod (:-?) a b :-? a Source #

exr :: Ok2 (:-?) a b => Prod (:-?) a b :-? b Source #

dup :: Ok (:-?) a => a :-? Prod (:-?) a a Source #

TerminalCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

Methods

it :: Ok (:-?) a => a :-? Unit (:-?) Source #

UnitCat (:-?) Source # 
Instance details

Defined in ConCat.Demand

ConstCat (:-?) a Source # 
Instance details

Defined in ConCat.Demand

EnumCat (->) a => EnumCat (:-?) a Source # 
Instance details

Defined in ConCat.Demand

Methods

succC :: a :-? a Source #

predC :: a :-? a Source #

EqCat (->) a => EqCat (:-?) a Source # 
Instance details

Defined in ConCat.Demand

FloatingCat (->) a => FloatingCat (:-?) a Source # 
Instance details

Defined in ConCat.Demand

Methods

expC :: a :-? a Source #

logC :: a :-? a Source #

cosC :: a :-? a Source #

sinC :: a :-? a Source #

sqrtC :: a :-? a Source #

tanhC :: a :-? a Source #

FractionalCat (->) a => FractionalCat (:-?) a Source # 
Instance details

Defined in ConCat.Demand

Methods

recipC :: a :-? a Source #

divideC :: Prod (:-?) a a :-? a Source #

NumCat (->) a => NumCat (:-?) a Source # 
Instance details

Defined in ConCat.Demand

Ord a => OrdCat (:-?) a Source # 
Instance details

Defined in ConCat.Demand

RealFracCat (->) a b => RealFracCat (:-?) a b Source # 
Instance details

Defined in ConCat.Demand

Methods

floorC :: a :-? b Source #

ceilingC :: a :-? b Source #

truncateC :: a :-? b Source #

BottomCat (:-?) (a :: Type) (b :: Type) Source # 
Instance details

Defined in ConCat.Demand

Methods

bottomC :: a :-? b Source #

FromIntegralCat (->) a b => FromIntegralCat (:-?) (a :: Type) (b :: Type) Source # 
Instance details

Defined in ConCat.Demand

Newtype (a :-? b) Source # 
Instance details

Defined in ConCat.Demand

Associated Types

type O (a :-? b) Source #

Methods

pack :: O (a :-? b) -> a :-? b Source #

unpack :: (a :-? b) -> O (a :-? b) Source #

type Ok (:-?) Source # 
Instance details

Defined in ConCat.Demand

type Ok (:-?) = Yes1 :: Type -> Constraint
type O (a :-? b) Source # 
Instance details

Defined in ConCat.Demand

type O (a :-? b) = Demand b -> Demand a