Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Language.Giml.Rewrites.PostInfer.RemoveAnn
Description
Remove annotations from the AST
This rewrite will remove annotations from the AST, this makes it easier to test ASTs when comparing to hand written ASTs.
We'll use uniplate, which provides traversal and manipulation functions on ADTs that have instances of the Data typeclass.
for example,
transform :: Data on => (on -> on) -> on -> on
Will run a function on all nodes of on
from the bottom up.
transformBi :: (Data to, Data from) => (to -> to) -> from -> from
is a variant of transform
that does that to every node of
to
inside a larger type from
.
For us, to
will be Expr a
and from
will be File a
,
because we want to remove all of the EAnnotated
nodes.