-
Notifications
You must be signed in to change notification settings - Fork 12
forbid kind loops #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gelisam
wants to merge
8
commits into
main
Choose a base branch
from
gelisam/forbid-kind-loops
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
forbid kind loops #251
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9373076
forbid kind loops
gelisam 16e2cec
drop support for ghc-8.10.7
gelisam b80f2e9
occurs-check tests
gelisam 2d9915d
kind-level occurs-check
gelisam 77d1889
TypeOperators is now required for type equality (~)
gelisam 75e7928
typo in kind-level occurs-check
gelisam 897dff9
Renumber
gelisam ca74546
SchemeVar newtype
gelisam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,2 @@ | ||
| Infinite kind detected: | ||
| (KindVar 55708) = (META(KindVar 55708) → META(KindVar 55701)) |
This file contains hidden or 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,17 @@ | ||
| #lang "prelude.kl" | ||
|
|
||
| (datatype (Phantom A) | ||
| (mk-phantom)) | ||
|
|
||
| -- causes the kind equality ?1 ~ ?2 to be unified twice, which previously | ||
| -- caused ?2 to point to itself, thus causing zonking ?2 to run forever. | ||
| -- should be accepted. | ||
| (example | ||
| (with-unknown-type [A] | ||
| (the (Phantom A) | ||
| (mk-phantom)))) | ||
|
|
||
| -- causes the kind equality ?1 ~ (-> ?1 *). | ||
| -- should be accepted by the occurs-check. | ||
| (datatype (InfiniteKind A) | ||
| (mk-infinite-kind (Phantom (A A)))) |
This file contains hidden or 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 @@ | ||
| Infinite type detected: (MetaPtr 57868) = (List META(MetaPtr 57868)) |
This file contains hidden or 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,13 @@ | ||
| #lang "prelude.kl" | ||
|
|
||
| -- accepted, thanks to let-generalization | ||
| (example | ||
| (let [xs (nil)] | ||
| (:: xs -- (the (List A) xs) | ||
| xs -- (the (List (List A)) xs) | ||
| ))) | ||
|
|
||
| -- causes the type equality ?1 ~ List ?1, which must be rejected by the | ||
| -- occurs-check. | ||
| (defun infinite-type (xs) | ||
| (:: xs xs)) |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider renaming variable
tytokfor clarityIn the
ppfunction forKindOccursCheckFailed, consider renaming the variabletytokorkindto better reflect that it represents a kind, not a type.Apply this diff to improve clarity:
pp env (KindOccursCheckFailed ptr ty) = hang 2 $ group $ vsep [ text "Infinite kind detected:" - , group (vsep [viaShow ptr, "=", pp env ty]) + , group (vsep [viaShow ptr, "=", pp env k]) ]