Safe Haskell | None |
---|
Construct for decorating symbols or expressions with additional information
- data (expr :&: info) sig where
- mapDecor :: (sym1 sig -> sym2 sig) -> (info1 (DenResult sig) -> info2 (DenResult sig)) -> (sym1 :&: info1) sig -> (sym2 :&: info2) sig
- getDecor :: AST (sym :&: info) sig -> info (DenResult sig)
- updateDecor :: forall info sym a. (info a -> info a) -> ASTF (sym :&: info) a -> ASTF (sym :&: info) a
- liftDecor :: (expr s -> info (DenResult s) -> b) -> (expr :&: info) s -> b
- stripDecor :: AST (sym :&: info) sig -> AST sym sig
- stringTreeDecor :: forall info sym a. StringTree sym => (forall a. info a -> String) -> ASTF (sym :&: info) a -> Tree String
- showDecorWith :: StringTree sym => (forall a. info a -> String) -> ASTF (sym :&: info) a -> String
- drawDecorWith :: StringTree sym => (forall a. info a -> String) -> ASTF (sym :&: info) a -> IO ()
Documentation
data (expr :&: info) sig whereSource
Decorating symbols or expressions with additional information
One usage of :&:
is to decorate every node of a syntax tree. This is done
simply by changing
AST sym sig
to
AST (sym :&: info) sig
mapDecor :: (sym1 sig -> sym2 sig) -> (info1 (DenResult sig) -> info2 (DenResult sig)) -> (sym1 :&: info1) sig -> (sym2 :&: info2) sigSource
Map over a decoration
getDecor :: AST (sym :&: info) sig -> info (DenResult sig)Source
Get the decoration of the top-level node
updateDecor :: forall info sym a. (info a -> info a) -> ASTF (sym :&: info) a -> ASTF (sym :&: info) aSource
Update the decoration of the top-level node
stringTreeDecor :: forall info sym a. StringTree sym => (forall a. info a -> String) -> ASTF (sym :&: info) a -> Tree StringSource
Rendering of decorated syntax trees
showDecorWith :: StringTree sym => (forall a. info a -> String) -> ASTF (sym :&: info) a -> StringSource
Show an decorated syntax tree using ASCII art
drawDecorWith :: StringTree sym => (forall a. info a -> String) -> ASTF (sym :&: info) a -> IO ()Source
Print an decorated syntax tree using ASCII art