Open Marwes opened 7 years ago
Why do we strip annotations in core? I would have thought keeping them around was a good idea?
Types are kept so that any core expression always knows its type. type definitions (ie Expr::TypeBindings
) are stripped however as those are no longer necessary in compilation.
type Test = Int
f 1
// ==>
f 1
We could keep them around if it becomes necessary but as it is right now they don't affect the rest of the compilation so there was no reason to keep them around.
This should be useful for
So the implementation should ideally be fairly flexible so it can be reused. It should probably run on the parser AST rather than core AST since type definitions are stripped in the core AST (otherwise core would be the better choice since it's simpler).
EDIT: There is an old graph implementation which I used to calculate dependencies in https://github.com/Marwes/haskell-compiler/blob/master/src/graph.rs . Probably better to use something with more features like https://crates.io/crates/petgraph however.