-
Notifications
You must be signed in to change notification settings - Fork 11
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
Feature/infer5 #153
Merged
Merged
Feature/infer5 #153
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
This removes hard-coded universe levels with universe operations UInc and UMax. Due to bootstrapping issues, these operations are implemented as Defs instead of axioms.
Also fixed restructre_free_var.thorin which actually had an incorrect level involved.
Also cleans up the Dep magic.
Not needed anymore as the is_uniform checks have been rewritten to always be fired in an "optimistic" spot.
Also refactored: * core::conv::s2s -> core::conv::s * core::conv::u2u -> core::conv::u Rationale: s2u and u2s doesn't make sense.
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.
Type Inference 2: Electric Boogaloo
Okay, lots of changes here and there are still plenty of loose ends but at some point I wanted to merge into master before the changes are getting out of hands. Here is a list of the most important ones:
Curried Functions
These are now working as expected:
Note, that all curried parameter groups are in direct style even for
.con
/.cn
/.Cn
. Here, only the last parameter makes up the continuation.Implicits and Type Inference
You can now mark a parameter group as implicit with a dot like this:
The argument will be automatically inferred by Thorin:
From the C++ API you can now use
World::call
/World::dcall
like this:I ported
core
,mem
, andmath
to make use of implicits and removed the now superfluous boilerplate from the dialect headers.We had some discussions in Discord about the syntax for
.
and!
. For now, I kept it like this because the other idea for using|
just looked really odd to me but we can still change this.In order to make this work, I'm using a class
Ref
that automatically looks throughInfer
s. We have to use theseRef
things even more aggressively, but for now I didn't want to have the diff going completely nuts.The IR keeps track of implicits with the help of
Def::meta
. This can now be a nested pair that mirrors the curried type and indicates where to place anInfer
.Right now, the type inference will be triggered as soon as a function with implicit arguments is fully invoked. More complex things, won't work for now, but I will work on that in the future.
UMax/UInc
The type level doesn't have to be a constant anymore and can be adjusted with the
umax
/uinc
operators. This is important for type inference and may be interesting for future universe polymorphism.Minor Changes
Def::dep
& friendsImpala
Impala branch here.