-
Notifications
You must be signed in to change notification settings - Fork 57
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
Qualified constructors #3337
Draft
janmasrovira
wants to merge
34
commits into
main
Choose a base branch
from
qualified-constructors
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.
Draft
Qualified constructors #3337
+3,656
−2,355
Conversation
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
108d6aa
to
a2d623c
Compare
This was referenced Feb 24, 2025
9c1bfcc
to
b230296
Compare
lukaszcz
reviewed
Feb 25, 2025
@@ -8,6 +8,8 @@ type Nat := | |||
| zero | |||
| suc Nat; | |||
|
|||
open Nat using {zero; suc} public; | |||
|
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.
I think for Nat
it would be reasonable to have zero
and suc
qualified. They aren't used very often. But we don't need to change this in this PR.
lukaszcz
reviewed
Feb 25, 2025
caa36c1
to
de840b5
Compare
de840b5
to
50f9597
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pr makes an important breaking change to the Juvix scoper. Previously, when defining a type, the constructors were put into the current scope. After this pr, they must be accessed through the type module that is generated.
E.g.
Additionally, this pr adds the option
--migration
to thejuvix format
command. This option takes the identity of some migration we want to apply. For the purposes of migrating the existing codebase, I've added theexport-constructors
migration. When this option is given, the juvix formatter automatically adds anopen
statement after each type definition.E.g. Run
juvix format --migration export-constructors Example.juvix
.Result:
Using this method to migrate is not guaranteed to succeed, and manual adjustments might need to be made.
open
statements:I created a fish script for this: