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

Inductive families/indexed types #4

Closed
ollef opened this issue Oct 19, 2017 · 1 comment
Closed

Inductive families/indexed types #4

ollef opened this issue Oct 19, 2017 · 1 comment

Comments

@ollef
Copy link
Owner

ollef commented Oct 19, 2017

So we can do more dependently typed goodness. If this is done, we can potentially also allow e.g.:

type Vector n a where
  Nil : Vector Zero a
  Cons : forall n. a -> Vector n a -> Vector (Succ n) a

Note that there's no Ptr on the tail of the Cons, meaning that this is an inductive definition of a flat vector. To get there, we can use pattern-matching on indices in the generated size-computing function for Vector. That function should be something like:

Vector Zero a = unitTypeRep
Vector (Succ n) a = productTypeRep a (Vector n a)

This also relies on adopting detagging (a la Edwin Brady) to remove the need for constructor tags (since we know what constructor we have just from the n index) and doing forcing to remove the n argument to the Cons constructor (since it can be recovered from the index).

@ollef
Copy link
Owner Author

ollef commented Feb 21, 2019

Preliminary support was added in #133.

@ollef ollef closed this as completed Feb 21, 2019
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

1 participant