forked from tweag/nickel
-
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.
Do not evaluate types away (tweag#1954)
Before this change, types used in a term would be evaluated away to their corresponding contract (a function) automatically. Note that the only meaningful usage of types right now is to pass them as argument for `std.contract.apply`. This eager conversion loses information; either for error messages (for example, using a type in the wrong place will complain that something has type "function" and might point to inside Nickel internals instead of the actual user-written type). Moreover, in preparation for boolean combinators for contracts, we want to be able to remember the original form of a type as much as possible. Finally, it might be useful for users to introspect types as well, for example to implement custom contract combinators. For all these reasons, and because there's no apparent drawback, this commit makes type normal values, that aren't evaluated further. A new case in the `%contrat/apply%` primop simply performs the conversion to contract lazily, once they are actually applied, instead of where they are defined. `%typeof%` and `std.typeof` are updated accordingly with the new `'Type` tag.
- Loading branch information
Showing
6 changed files
with
13 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3367,6 +3367,7 @@ | |
'Array, | ||
'Record, | ||
'ForeignId, | ||
'Type, | ||
'Other | ||
|] | ||
| doc m%" | ||
|