forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split patterns into "value patterns" and "computation patterns"
Value patterns match on a value (the result of computation), while computation patterns handle the effects (hint hint) of a computation. The only forms of computation patterns in OCaml today are value patterns and exception patterns (exception p). The sub-pattern `p` of the `lazy p` construction should be a computation pattern, rather than a value pattern. This pull-request does not make this change. Most of the changes in this PR are boilerplate -- it really is a lot of work now to add a new syntactic category to the typed-tree syntax. This boilerplate is fairly automatic and should be easy to review. There is a subtle part to the patch, though: the implementation of the pattern type-checking. It now has to reconstruct the value/computation distinction (absent from the parse-tree), and return values from two different types. Instead of splitting the type-checker in several functions (which risked code duplications), I choose to use a GADT to have the same [type_pat] function return two different types depending on the caller. This is the least invasive way to adapt this part of the codebase, whose inherent complexity is so large (unfortunately) that adding a GADT to the mix barely makes a difference.
- Loading branch information
Showing
25 changed files
with
695 additions
and
445 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
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
Oops, something went wrong.