More advanced desugar rules are currently not implemented and would require duplicating much application logic in the desugar stage which is already present in the type checker.
Proposed change
The type checker has a deeper understanding of the structure of the application and depending on the structure of the application can easily modify it such that the desugar stage is trivial.
This would made possible by returning a new AST during each inference step.
We opted to have a pass before the inference (or in future generate constraint stage).
The same application logic can also be used for another pass after this stage.
The type checker is now as follows:
build context
modify AST based on context new
infer types (in future generate constraints and annotate all nodes with types)
Relevant issues
163
Summary of the current issue
More advanced desugar rules are currently not implemented and would require duplicating much application logic in the desugar stage which is already present in the type checker.
Proposed change
The type checker has a deeper understanding of the structure of the application and depending on the structure of the application can easily modify it such that the desugar stage is trivial.
This would made possible by returning a new
AST
during each inference step.