-
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
General inductive parameters #2506
Conversation
commit c7236f96b3f95783e9853893258fe767d1035817 Author: Jan Mas Rovira <[email protected]> Date: Fri Sep 8 01:55:03 2023 +0200 relax type restriction of inductive params wip
- Closes #2362 This pr implements a new typechecking algorithm. This algorithm can be activated using the global flag `--new-typechecker`. This flag will only take effect on the compilation pipeline but not the repl. The main difference between the new and old algorithm is that the new one inserts holes during typechecking. Thus, it does not require the arity checker pass. The new algorithm does not yet implement default arguments. The plan is to make the change in the following steps: 1. Merge this pr. 2. Merge #2506. 3. Implement default arguments for the new algorithm. 4. Remove the arity checker and the old algorithm. --------- Co-authored-by: Łukasz Czajka <[email protected]>
Shortly, we can merge this PR since it does not replace the default typechecker. However, we need to address the positivity checker separately. I added two examples below to make it clear that there is an issue, although it is not straightforward to me at the moment how to solve it.
First, the
The above produces the following error,
The message is a bit difficult to understand, at least to me, so we must fix it too. Similarly as with
We can include these examples in a future PR fixing the pos. checker. @rokopt could get benefit of being able to typecheck this |
Yes, that's right! |
This pr allows inductive type parameters to be any type. Until now, they had to be exactly
Type
. This allows us to define more general traits such as theMonad
andFunctor
, as shown in the new test.This is only supported under the temporary
--new-typechecker
flag.Pending work:
Update the positivity checker if necessary (@jonaprieto).
Update the necessary compilation steps in Core (@lukaszcz).
Add compilation tests.