Safe Haskell | None |
---|
Construct for decorating expressions with additional information
- data Decor info expr sig where
- getInfo :: AST (Decor info dom) sig -> info (DenResult sig)
- updateDecor :: forall info dom a. (info a -> info a) -> ASTF (Decor info dom) a -> ASTF (Decor info dom) a
- liftDecor :: (expr s -> info (DenResult s) -> b) -> Decor info expr s -> b
- collectInfo :: (forall sig. info sig -> b) -> AST (Decor info dom) sig -> [b]
- stringTreeDecor :: forall info dom a. StringTree dom => (forall a. info a -> String) -> ASTF (Decor info dom) a -> Tree String
- showDecorWith :: StringTree dom => (forall a. info a -> String) -> ASTF (Decor info dom) a -> String
- drawDecorWith :: StringTree dom => (forall a. info a -> String) -> ASTF (Decor info dom) a -> IO ()
- stripDecor :: AST (Decor info dom) sig -> AST dom sig
Decoration
data Decor info expr sig whereSource
Decorating symbols with additional information
One usage of Decor
is to decorate every node of a syntax tree. This is done
simply by changing
AST dom sig
to
AST (Decor info dom) sig
Project sub sup => Project sub (Decor info sup) | |
Equality expr => Equality (Decor info expr) | |
StringTree expr => StringTree (Decor info expr) | |
Render expr => Render (Decor info expr) | |
Eval expr => Eval (Decor info expr) | |
Constrained expr => Constrained (Decor info expr) | |
EvalBind dom => EvalBind (Decor info dom) | |
AlphaEq sub sub dom env => AlphaEq (Decor info sub) (Decor info sub) dom env |
getInfo :: AST (Decor info dom) sig -> info (DenResult sig)Source
Get the decoration of the top-level node
updateDecor :: forall info dom a. (info a -> info a) -> ASTF (Decor info dom) a -> ASTF (Decor info dom) aSource
Update the decoration of the top-level node
collectInfo :: (forall sig. info sig -> b) -> AST (Decor info dom) sig -> [b]Source
Collect the decorations of all nodes
stringTreeDecor :: forall info dom a. StringTree dom => (forall a. info a -> String) -> ASTF (Decor info dom) a -> Tree StringSource
Rendering of decorated syntax trees
showDecorWith :: StringTree dom => (forall a. info a -> String) -> ASTF (Decor info dom) a -> StringSource
Show an decorated syntax tree using ASCII art
drawDecorWith :: StringTree dom => (forall a. info a -> String) -> ASTF (Decor info dom) a -> IO ()Source
Print an decorated syntax tree using ASCII art