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

Relax the restriction that list literals can only contain elements of type Type. #1120

Open
ocharles opened this issue Nov 26, 2020 · 4 comments

Comments

@ocharles
Copy link
Member

The type inference rules for list literals states

Note that the above rules forbid List elements that are Types. More generally, if the element type is not a Type then that is a type error.

Is there a good reason to have this restriction? What is the problem of changing

Γ ⊢ t : T₀   Γ ⊢ T₀ : Type   Γ ⊢ [ ts… ] : List T₁   T₀ ≡ T₁
────────────────────────────────────────────────────────────
Γ ⊢ [ t, ts… ] : List T₀

to

Γ ⊢ t : T₀   Γ ⊢ [ ts… ] : List T₁   T₀ ≡ T₁
────────────────────────────────────────────────────────────
Γ ⊢ [ t, ts… ] : List T₀

?

@ocharles
Copy link
Member Author

I suppose one follow-on complication is:

List is a function from a Type to another Type:

──────────────────────
Γ ⊢ List : Type → Type

Would no longer be true. Perhaps at this point we're stuck.

@Gabriella439
Copy link
Contributor

@ocharles: Yeah, the only way this would work is if List became a keyword that had to be saturated with the element type instead of a built-in

@ocharles
Copy link
Member Author

Well, that, or implicit arguments to specify the type of the type being applied to the list

@MonoidMusician
Copy link
Collaborator

what we need is ✨ universe polymorphism

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

No branches or pull requests

3 participants