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

Fix #1704 #1711

Merged

Conversation

janmasrovira
Copy link
Collaborator

@janmasrovira janmasrovira commented Jan 9, 2023

@janmasrovira janmasrovira self-assigned this Jan 9, 2023
@janmasrovira janmasrovira added this to the 0.2.9 milestone Jan 9, 2023
@janmasrovira janmasrovira changed the title 1704 type synonyms are not always unfolded during type checking Fix #1704 Jan 9, 2023
@janmasrovira janmasrovira marked this pull request as ready for review January 10, 2023 00:13
@jonaprieto jonaprieto force-pushed the 1704-type-synonyms-are-not-always-unfolded-during-type-checking branch from 44f6d92 to e6b86a2 Compare January 10, 2023 11:50
Copy link
Collaborator

@lukaszcz lukaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't entirely solve the problem. The synonyms are still sometimes not unfolded, e.g., when type-checking a function application.

Checking the module:

module church;

open import Stdlib.Prelude;

Num : Type;
Num := {A : Type}  (A  A)  A  A;

czero : Num;
czero {_} f x := x;

csuc : Num  Num;
csuc n {_} f := f ∘ n f;

end;

results in an error:

Type error near church.juvix:12:21-24.
In the expression:
  n f
the expression n is expected to have a function type but has type:
  Num

@janmasrovira janmasrovira force-pushed the 1704-type-synonyms-are-not-always-unfolded-during-type-checking branch from e6b86a2 to 19a3638 Compare January 10, 2023 13:48
@janmasrovira janmasrovira force-pushed the 1704-type-synonyms-are-not-always-unfolded-during-type-checking branch from 19a3638 to 96bbd9f Compare January 10, 2023 13:50
@janmasrovira
Copy link
Collaborator Author

janmasrovira commented Jan 10, 2023

The above is now solved, however, you need to provide the implicit argument of n explicitly (due to arity and type checking being in separate stages):

csuc : Num → Num;
csuc n {_} f := f ∘ n {_} f;

Copy link
Collaborator

@lukaszcz lukaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, seems to be working now. I can do Church numerals with type synonyms.

@lukaszcz lukaszcz merged commit f1ca889 into main Jan 10, 2023
@lukaszcz lukaszcz deleted the 1704-type-synonyms-are-not-always-unfolded-during-type-checking branch January 10, 2023 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type synonyms are not always unfolded during type checking
3 participants