Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Mutually recursive types #197

Open
SquidDev opened this issue Oct 15, 2019 · 1 comment
Open

Mutually recursive types #197

SquidDev opened this issue Oct 15, 2019 · 1 comment
Labels
enhancement TC Issues/PRs relating to something else in the TC

Comments

@SquidDev
Copy link
Member

I've been meaning to file this for a year, but better late than never I guess...

While we haven't encountered a need so far, we need a way to represent mutually-recursive types[1]. I'm assuming we can just go for the normal OCaml/SML:

type odd 'z = 
| OddS : even 'n -> odd (S 'n)
and even 'z = 
| EvenZ : even Z 
| EvenS : odd 'n -> even (S 'n)

I assume, while doing this, it may also be useful to add support for mutually-recursive class instances.

[1] So technically you can represent mutually-recursive types as an inductive type indexed by a "which type is this" type, but I'd rather not.

@SquidDev SquidDev added enhancement TC Issues/PRs relating to something else in the TC labels Oct 15, 2019
@plt-amy
Copy link
Member

plt-amy commented Oct 17, 2019

We also need mutually recursive type functions which is going to be a bit more complicated to write..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement TC Issues/PRs relating to something else in the TC
Projects
None yet
Development

No branches or pull requests

2 participants