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

Constructors as first-class citizen #16

Open
abooij opened this issue Oct 8, 2015 · 2 comments
Open

Constructors as first-class citizen #16

abooij opened this issue Oct 8, 2015 · 2 comments

Comments

@abooij
Copy link
Contributor

abooij commented Oct 8, 2015

module test where
import nat
suc' : nat -> nat = suc

yields:

Type checking failed: expected a data type for the constructor suc but got Pi (nat) ((\(_ : nat) -> nat))

The workaround is to lambda-abstract suc:

suc' : nat -> nat = \(n : nat) -> suc n
File loaded.

I tried to end this message in a pun about "pointless" but I can't seem to hit the spot.

@abooij abooij changed the title Constructors as first-class function Constructors as first-class citizen Oct 8, 2015
@mortberg
Copy link
Owner

mortberg commented Oct 8, 2015

I implemented this for an earlier version of cubical where abstractions were not typed simply by eta-expanding the constructors sufficiently much. This was really easy to implement as I only needed to know how many arguments were missing in the application of the constructor. However with typed abstraction this becomes a little bit more complicated as I need to know what types are expected for the abstractions that I create while eta expanding (and this might be tricky to get right in the presence of dependent types...). Because of this I never bothered implementing this for cubicaltt. So for now the user has to eta expand by hand when necessary.

A possible way for solving this would be to do typed conversion. This would have the additional benefit that we can have untyped applications again and my old code for eta-expanding constructors should work.

@mortberg
Copy link
Owner

mortberg commented Oct 8, 2015

Oh, one more thing. My previous solution for this was for a version without any HITs and I'm not sure if the presence of path constructors could complicate things...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants