Skip to content
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

Support type aliases #1404

Merged
merged 17 commits into from
Jul 25, 2022
Merged

Support type aliases #1404

merged 17 commits into from
Jul 25, 2022

Conversation

janmasrovira
Copy link
Collaborator

@janmasrovira janmasrovira commented Jul 20, 2022

Fixes #1349 and #1342 and #1333.

this PR adds the ability to define type aliases. More generally, it adds limited normalization to the language.
The set of function definitions that support normalization are of the following form:

f : .. -> Type;
f x y z := ...;

More precisely, a function f supports normalization iff:

  1. It has a single clause.
  2. The return type is Type.
  3. It has no patterns matching implicit arguments (probably trivial to remove this restriction).
  4. All patterns are variables (allowing wildcards should be easy to add).

@janmasrovira janmasrovira linked an issue Jul 20, 2022 that may be closed by this pull request
@janmasrovira janmasrovira marked this pull request as draft July 20, 2022 19:08
@janmasrovira janmasrovira marked this pull request as ready for review July 21, 2022 16:18
@janmasrovira janmasrovira linked an issue Jul 21, 2022 that may be closed by this pull request
@janmasrovira janmasrovira added this to the 0.2.2 milestone Jul 21, 2022
@janmasrovira janmasrovira self-assigned this Jul 21, 2022
@janmasrovira janmasrovira added typechecking enhancement New feature or request labels Jul 21, 2022
jonaprieto
jonaprieto previously approved these changes Jul 22, 2022
src/Juvix/Syntax/MicroJuvix/Language/Extra.hs Outdated Show resolved Hide resolved
src/Juvix/Syntax/MicroJuvix/Language/Extra.hs Show resolved Hide resolved
@janmasrovira
Copy link
Collaborator Author

We need to fix positivity checking when the constructor types use type functions. Should we do it in this PR or in another one?

@jonaprieto jonaprieto merged commit 39a300e into main Jul 25, 2022
@jonaprieto jonaprieto deleted the 1349-type-aliases branch July 25, 2022 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request typechecking
Projects
None yet
2 participants