-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve unsolved class constraints during whnf
This requires some changes to the normalisation machinery and to the elaborator. * The whnf function is now parameterised by how it should handle unsolved class constraints. When typechecking, this parameter is the class instance elaborator. * The class instance elaborator is now parameterised by what it should do with constraints it still didn't manage to solve. When normalising, we want to keep the constraints as the `UnsolvedConstraint` global, since it allows the type of the constraint to contain bound variables. When generalising, we want to (like before) make the constraints `Exist` metavars, such that they are picked up as free vars that can be generalised. Fixes #48. The elaboration during normalisation will not take into account local constraints (e.g. stemming from `MyClass a =>` constraints in a type signature), but I believe this is not necessary since those constraints are still unknown and will not reduce further anyway. So I think it's OK to leave those for the full elaboration pass. (I might be wrong though...)
- Loading branch information
Showing
11 changed files
with
184 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Inference.Class where | ||
|
||
import Inference.Monad | ||
import Meta | ||
|
||
whnf :: AbstractM -> Infer AbstractM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.