Safe Haskell | None |
---|---|
Language | Haskell2010 |
"Syntactic sugar"
For details, see "Combining Deep and Shallow Embedding for EDSL" (TFP 2013, http://www.cse.chalmers.se/~emax/documents/svenningsson2013combining.pdf).
- class Syntactic a where
- resugar :: (Syntactic a, Syntactic b, Domain a ~ Domain b, Internal a ~ Internal b) => a -> b
- class SyntacticN f internal | f -> internal where
- sugarSym :: (Signature sig, fi ~ SmartFun sup sig, sig ~ SmartSig fi, sup ~ SmartSym fi, SyntacticN f fi, sub :<: sup) => sub sig -> f
- sugarSymTyped :: (Signature sig, fi ~ SmartFun (Typed sup) sig, sig ~ SmartSig fi, Typed sup ~ SmartSym fi, SyntacticN f fi, sub :<: sup, Typeable (DenResult sig)) => sub sig -> f
Documentation
resugar :: (Syntactic a, Syntactic b, Domain a ~ Domain b, Internal a ~ Internal b) => a -> b Source #
Syntactic type casting
class SyntacticN f internal | f -> internal where Source #
N-ary syntactic functions
desugarN
has any type of the form:
desugarN :: ( Syntactic a , Syntactic b , ... , Syntactic x , Domain a ~ sym , Domain b ~ sym , ... , Domain x ~ sym ) => (a -> b -> ... -> x) -> ( ASTF sym (Internal a) -> ASTF sym (Internal b) -> ... -> ASTF sym (Internal x) )
...and vice versa for sugarN
.
sugarSym :: (Signature sig, fi ~ SmartFun sup sig, sig ~ SmartSig fi, sup ~ SmartSym fi, SyntacticN f fi, sub :<: sup) => sub sig -> f Source #
"Sugared" symbol application
sugarSym
has any type of the form:
sugarSym :: ( sub :<: AST sup , Syntactic a , Syntactic b , ... , Syntactic x , Domain a ~ Domain b ~ ... ~ Domain x ) => sub (Internal a :-> Internal b :-> ... :-> Full (Internal x)) -> (a -> b -> ... -> x)
sugarSymTyped :: (Signature sig, fi ~ SmartFun (Typed sup) sig, sig ~ SmartSig fi, Typed sup ~ SmartSym fi, SyntacticN f fi, sub :<: sup, Typeable (DenResult sig)) => sub sig -> f Source #
"Sugared" symbol application
sugarSymTyped
has any type of the form:
sugarSymTyped :: ( sub :<: AST (Typed sup) , Syntactic a , Syntactic b , ... , Syntactic x , Domain a ~ Domain b ~ ... ~ Domain x , Typeable (Internal x) ) => sub (Internal a :-> Internal b :-> ... :-> Full (Internal x)) -> (a -> b -> ... -> x)