A few helpers to work with the AST annotations
- removeAnnotations :: Traversable t => t a -> t ()
- reannotate :: Traversable t => (a -> b) -> t a -> t b
- addExtraAnnotationField :: Traversable t => b -> t a -> t (a, b)
- removeExtraAnnotationField :: Traversable t => t (a, b) -> t a
- assignUniqueIds :: Traversable t => Int -> t a -> (t (a, Int), Int)
- class HasAnnotation a where
- withAnnotation :: HasAnnotation a => (b -> b) -> a b -> a b
Changes all the labels in the tree to another one, given by a function.
add an extra field to the AST labels (the label would look like
(a, b) )
Assigns unique numeric (Int) ids to each node in the AST. Returns a pair: the tree annotated with UID's and the last ID that was assigned.
Things that have annotations -- for example, nodes in a syntax tree
Returns the annotation of the root of the tree
Sets the annotation of the root of the tree