symantic-base-0.3.0.20211007: Basic symantics combinators for Embedded Domain-Specific Languages (EDSL)
Safe HaskellNone
LanguageHaskell2010

Symantic.Derive

Synopsis

Type family Derived

type family Derived (repr :: Type -> Type) :: Type -> Type Source #

The representation that (repr) derives to.

Instances

Instances details
type Derived View Source #

Unusual, but enables to leverage default definition of methods.

Instance details

Defined in Symantic.View

type Derived (SomeData repr) Source # 
Instance details

Defined in Symantic.Data

type Derived (SomeData repr) = repr
type Derived (Data able repr) Source # 
Instance details

Defined in Symantic.Data

type Derived (Data able repr) = repr
type Derived (FinalizeSharing _letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

type Derived (FinalizeSharing _letName repr) = repr
type Derived (ObserveSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

type Derived (ObserveSharing letName repr) = FinalizeSharing letName repr

Class Derivable

class Derivable repr where Source #

Derive an interpreter to a another interpreter determined by the Derived open type family. This is mostly useful when running the interpreter stack, but also when going back from an initial encoding to a final one.

Note that derive and liftDerived are not necessarily reciprocical functions.

Methods

derive :: repr a -> Derived repr a Source #

Instances

Instances details
Derivable (SomeData repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: SomeData repr a -> Derived (SomeData repr) a Source #

Semigroupable repr => Derivable (Data Semigroupable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Semigroupable repr a -> Derived (Data Semigroupable repr) a Source #

Emptyable repr => Derivable (Data Emptyable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Emptyable repr a -> Derived (Data Emptyable repr) a Source #

Maybeable repr => Derivable (Data Maybeable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Maybeable repr a -> Derived (Data Maybeable repr) a Source #

Listable repr => Derivable (Data Listable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Listable repr a -> Derived (Data Listable repr) a Source #

IfThenElseable repr => Derivable (Data IfThenElseable repr) Source # 
Instance details

Defined in Symantic.Data

Equalable repr => Derivable (Data Equalable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Equalable repr a -> Derived (Data Equalable repr) a Source #

Eitherable repr => Derivable (Data Eitherable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Eitherable repr a -> Derived (Data Eitherable repr) a Source #

Constantable c repr => Derivable (Data (Constantable c) repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data (Constantable c) repr a -> Derived (Data (Constantable c) repr) a Source #

Bottomable repr => Derivable (Data Bottomable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Bottomable repr a -> Derived (Data Bottomable repr) a Source #

Anythingable repr => Derivable (Data Anythingable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Anythingable repr a -> Derived (Data Anythingable repr) a Source #

Abstractable repr => Derivable (Data Abstractable repr) Source # 
Instance details

Defined in Symantic.Data

Methods

derive :: Data Abstractable repr a -> Derived (Data Abstractable repr) a Source #

Class LiftDerived

class LiftDerived repr where Source #

Lift the Derived interpreter of an interpreter, to that interpreter. This is mostly useful to give default values to class methods in order to skip their definition for interpreters where liftDerived can already apply the right semantic.

Note that derive and liftDerived are not necessarily reciprocical functions.

Methods

liftDerived :: Derived repr a -> repr a Source #

Instances

Instances details
LiftDerived View Source # 
Instance details

Defined in Symantic.View

Methods

liftDerived :: Derived View a -> View a Source #

(Eq letName, Hashable letName) => LiftDerived (FinalizeSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived :: Derived (FinalizeSharing letName repr) a -> FinalizeSharing letName repr a Source #

(Referenceable letName repr, MakeLetName letName, Eq letName, Hashable letName, Show letName) => LiftDerived (ObserveSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived :: Derived (ObserveSharing letName repr) a -> ObserveSharing letName repr a Source #

Class LiftDerived1

class LiftDerived1 repr where Source #

Convenient wrapper of derive and liftDerived for functions with a single argument.

Minimal complete definition

Nothing

Methods

liftDerived1 :: (Derived repr a -> Derived repr b) -> repr a -> repr b Source #

default liftDerived1 :: LiftDerived repr => Derivable repr => (Derived repr a -> Derived repr b) -> repr a -> repr b Source #

Instances

Instances details
(Eq letName, Hashable letName) => LiftDerived1 (FinalizeSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived1 :: (Derived (FinalizeSharing letName repr) a -> Derived (FinalizeSharing letName repr) b) -> FinalizeSharing letName repr a -> FinalizeSharing letName repr b Source #

(Referenceable letName repr, MakeLetName letName, Eq letName, Hashable letName, Show letName) => LiftDerived1 (ObserveSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived1 :: (Derived (ObserveSharing letName repr) a -> Derived (ObserveSharing letName repr) b) -> ObserveSharing letName repr a -> ObserveSharing letName repr b Source #

Class LiftDerived2

class LiftDerived2 repr where Source #

Convenient wrapper of derive and liftDerived for functions with two arguments. Note that the default instance relies upon LiftDerived, not LiftDerived1.

Minimal complete definition

Nothing

Methods

liftDerived2 :: (Derived repr a -> Derived repr b -> Derived repr c) -> repr a -> repr b -> repr c Source #

default liftDerived2 :: LiftDerived repr => Derivable repr => (Derived repr a -> Derived repr b -> Derived repr c) -> repr a -> repr b -> repr c Source #

Instances

Instances details
(Eq letName, Hashable letName) => LiftDerived2 (FinalizeSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived2 :: (Derived (FinalizeSharing letName repr) a -> Derived (FinalizeSharing letName repr) b -> Derived (FinalizeSharing letName repr) c) -> FinalizeSharing letName repr a -> FinalizeSharing letName repr b -> FinalizeSharing letName repr c Source #

(Referenceable letName repr, MakeLetName letName, Eq letName, Hashable letName, Show letName) => LiftDerived2 (ObserveSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived2 :: (Derived (ObserveSharing letName repr) a -> Derived (ObserveSharing letName repr) b -> Derived (ObserveSharing letName repr) c) -> ObserveSharing letName repr a -> ObserveSharing letName repr b -> ObserveSharing letName repr c Source #

Class LiftDerived3

class LiftDerived3 repr where Source #

Convenient wrapper of derive and liftDerived for functions with three arguments. Note that the default instance relies upon LiftDerived, not LiftDerived2.

Minimal complete definition

Nothing

Methods

liftDerived3 :: (Derived repr a -> Derived repr b -> Derived repr c -> Derived repr d) -> repr a -> repr b -> repr c -> repr d Source #

default liftDerived3 :: LiftDerived repr => Derivable repr => (Derived repr a -> Derived repr b -> Derived repr c -> Derived repr d) -> repr a -> repr b -> repr c -> repr d Source #

Instances

Instances details
(Eq letName, Hashable letName) => LiftDerived3 (FinalizeSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived3 :: (Derived (FinalizeSharing letName repr) a -> Derived (FinalizeSharing letName repr) b -> Derived (FinalizeSharing letName repr) c -> Derived (FinalizeSharing letName repr) d) -> FinalizeSharing letName repr a -> FinalizeSharing letName repr b -> FinalizeSharing letName repr c -> FinalizeSharing letName repr d Source #

(Referenceable letName repr, MakeLetName letName, Eq letName, Hashable letName, Show letName) => LiftDerived3 (ObserveSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived3 :: (Derived (ObserveSharing letName repr) a -> Derived (ObserveSharing letName repr) b -> Derived (ObserveSharing letName repr) c -> Derived (ObserveSharing letName repr) d) -> ObserveSharing letName repr a -> ObserveSharing letName repr b -> ObserveSharing letName repr c -> ObserveSharing letName repr d Source #

Class LiftDerived4

class LiftDerived4 repr where Source #

Convenient wrapper of derive and liftDerived for functions with three arguments. Note that the default instance relies upon LiftDerived, not LiftDerived3.

Minimal complete definition

Nothing

Methods

liftDerived4 :: (Derived repr a -> Derived repr b -> Derived repr c -> Derived repr d -> Derived repr e) -> repr a -> repr b -> repr c -> repr d -> repr e Source #

default liftDerived4 :: LiftDerived repr => Derivable repr => (Derived repr a -> Derived repr b -> Derived repr c -> Derived repr d -> Derived repr e) -> repr a -> repr b -> repr c -> repr d -> repr e Source #

Instances

Instances details
(Eq letName, Hashable letName) => LiftDerived4 (FinalizeSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived4 :: (Derived (FinalizeSharing letName repr) a -> Derived (FinalizeSharing letName repr) b -> Derived (FinalizeSharing letName repr) c -> Derived (FinalizeSharing letName repr) d -> Derived (FinalizeSharing letName repr) e) -> FinalizeSharing letName repr a -> FinalizeSharing letName repr b -> FinalizeSharing letName repr c -> FinalizeSharing letName repr d -> FinalizeSharing letName repr e Source #

(Referenceable letName repr, MakeLetName letName, Eq letName, Hashable letName, Show letName) => LiftDerived4 (ObserveSharing letName repr) Source # 
Instance details

Defined in Symantic.ObserveSharing

Methods

liftDerived4 :: (Derived (ObserveSharing letName repr) a -> Derived (ObserveSharing letName repr) b -> Derived (ObserveSharing letName repr) c -> Derived (ObserveSharing letName repr) d -> Derived (ObserveSharing letName repr) e) -> ObserveSharing letName repr a -> ObserveSharing letName repr b -> ObserveSharing letName repr c -> ObserveSharing letName repr d -> ObserveSharing letName repr e Source #

Type synonyms FromDerived*

type FromDerived sym repr = (LiftDerived repr, sym (Derived repr)) Source #

Convenient type synonym for using liftDerived on symantic class (sym).

type FromDerived1 sym repr = (LiftDerived1 repr, sym (Derived repr)) Source #

type FromDerived2 sym repr = (LiftDerived2 repr, sym (Derived repr)) Source #

type FromDerived3 sym repr = (LiftDerived3 repr, sym (Derived repr)) Source #

type FromDerived4 sym repr = (LiftDerived4 repr, sym (Derived repr)) Source #