symantic-base-0.5.0.20221211: Basic symantic combinators for Embedded Domain-Specific Languages (EDSL)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Symantic.Syntaxes.TuplesOfFunctions

Description

Tuples-of-Functions

Synopsis

Type ToF

type ToF a next = ToFIf (IsToF a) a next Source #

Type ToFIf

type family ToFIf t a next :: Type where ... Source #

Transform a type (a) to Tuples-of-Functions returning (next). The (t) parameter is to avoid overlapping instances of UnToFIf.

Equations

ToFIf 'True (a, b) next = ToF a (ToF b next) 
ToFIf 'True (Either l r) next = (ToF l next, ToF r next) 
ToFIf 'True () next = next 
ToFIf 'True (Endpoint end a) next = (next :~: end, a) 
ToFIf 'False a next = a -> next 

Type IsToF

type family IsToF a :: Bool where ... Source #

This Bool is added to ToFIf to avoid overlapping instances.

Equations

IsToF () = 'True 
IsToF (a, b) = 'True 
IsToF (Either l r) = 'True 
IsToF (Endpoint end a) = 'True 
IsToF a = 'False 

Type Endpoint

newtype Endpoint end a Source #

Constructors

Endpoint 

Fields

endpoint :: a -> ToF (Endpoint end a) end Source #

Type UnToF

type UnToF a = UnToFIf (IsToF a) a Source #

Class UnToFIf

class UnToFIf (t :: Bool) a where Source #

Methods

unToF :: ToFIf t a next -> a -> next Source #

Instances

Instances details
UnToFIf 'False a Source # 
Instance details

Defined in Symantic.Syntaxes.TuplesOfFunctions

Methods

unToF :: ToFIf 'False a next -> a -> next Source #

UnToFIf 'True () Source # 
Instance details

Defined in Symantic.Syntaxes.TuplesOfFunctions

Methods

unToF :: ToFIf 'True () next -> () -> next Source #

(UnToF a, UnToF b) => UnToFIf 'True (Either a b) Source # 
Instance details

Defined in Symantic.Syntaxes.TuplesOfFunctions

Methods

unToF :: ToFIf 'True (Either a b) next -> Either a b -> next Source #

(UnToF a, UnToF b) => UnToFIf 'True (a, b) Source # 
Instance details

Defined in Symantic.Syntaxes.TuplesOfFunctions

Methods

unToF :: ToFIf 'True (a, b) next -> (a, b) -> next Source #