syntactic-2.0: Generic representation and manipulation of abstract syntax

Safe HaskellNone

Data.Syntactic.Sugar

Description

Synopsis

Documentation

class Syntactic a whereSource

It is usually assumed that (desugar (sugar a)) has the same meaning as a.

Associated Types

type Domain a :: * -> *Source

type Internal a Source

Methods

desugar :: a -> ASTF (Domain a) (Internal a)Source

sugar :: ASTF (Domain a) (Internal a) -> aSource

Instances

(Syntactic a, ~ (* -> *) (Domain a) dom, Syntactic b, ~ (* -> *) (Domain b) dom, :<: Binding dom) => Syntactic (a -> b) 
(Syntactic a, ~ (* -> *) (Domain a) dom, Syntactic b, ~ (* -> *) (Domain b) dom, :<: BindingT dom, Typeable (Internal a)) => Syntactic (a -> b) 
Syntactic (ASTF sym a) 
(Syntactic a, ~ (* -> *) (Domain a) sym, :<: Binding sym, :<: (MONAD m) sym, Monad m) => Syntactic (Remon sym m a) 
(Syntactic a, ~ (* -> *) (Domain a) sym, :<: BindingT sym, :<: (MONAD m) sym, Monad m, Typeable (Internal a)) => Syntactic (Remon sym m a) 

resugar :: (Syntactic a, Syntactic b, Domain a ~ Domain b, Internal a ~ Internal b) => a -> bSource

Syntactic type casting

class SyntacticN f internal | f -> internal whereSource

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.

Methods

desugarN :: f -> internalSource

sugarN :: internal -> fSource

Instances

(Syntactic f, ~ (* -> *) (Domain f) sym, ~ * fi (AST sym (Full (Internal f)))) => SyntacticN f fi 
(Syntactic a, ~ (* -> *) (Domain a) sym, ~ * ia (Internal a), SyntacticN f fi) => SyntacticN (a -> f) (AST sym (Full ia) -> fi) 

sugarSym :: (Signature sig, fi ~ SmartFun sup sig, sig ~ SmartSig fi, sup ~ SmartSym fi, SyntacticN f fi, sub :<: sup) => sub sig -> fSource

"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)