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

Symantic.Semantics.ToFer

Synopsis

Type TuplesOfFunctions

data ToFer sem a Source #

The ToFer intermediate interpreter return Tuples-of-Functions instead of Eithers-of-Tuples.

In other words, if transforms SumFunctor into functions returning (sem next) and ProductFunctor into arguments of those functions.

This is like using an extension parameter introduced in https://okmij.org/ftp/typed-formatting/index.html#DSL-FIn but here only a single type parameter (a) is exposed instead of two.

Useful to avoid declaring and pattern-matching an algebraic datatype of type (a), as the corresponding function will be called directly, given as arguments the terms that would have been pattern-matched from a constructor of such algebraic datatype.

Constructors

ToFer 

Fields

Instances

Instances details
Functor sem => Dataable (ToFer sem) Source # 
Instance details

Defined in Symantic.Semantics.ToFer

Methods

data_ :: (Generic a, RepOfEoT a, UnToF a) => ToFer sem (EoT (ADT a)) -> ToFer sem a Source #

(Optionable sem, Functor sem) => Optionable (ToFer sem) Source # 
Instance details

Defined in Symantic.Semantics.ToFer

Methods

optional :: ToFer sem a -> ToFer sem (Maybe a) Source #

(ProductFunctor sem, Monad sem) => ProductFunctor (ToFer sem) Source # 
Instance details

Defined in Symantic.Semantics.ToFer

Methods

(<.>) :: ToFer sem a -> ToFer sem b -> ToFer sem (a, b) Source #

(<.) :: ToFer sem a -> ToFer sem () -> ToFer sem a Source #

(.>) :: ToFer sem () -> ToFer sem a -> ToFer sem a Source #

(SumFunctor sem, AlternativeFunctor sem) => SumFunctor (ToFer sem) Source # 
Instance details

Defined in Symantic.Semantics.ToFer

Methods

(<+>) :: ToFer sem a -> ToFer sem b -> ToFer sem (Either a b) Source #