CakeML / CakeML/cakeml

Better translator support for recursion under type constructors

Open
#901 0 comments 0 reactions 0 assignees View on GitHub
enhancement translator
Dominant language
Standard ML
Stars
1.2k
Forks
104
Avg merge
2d 21h
Merged PRs (30d)
16

Description

The translator currently only supports recursion under type constructors for a few hard-coded types `pair`, `option` and `list`.

For a minimal example, consider these types:

```
Datatype:
container = Container 'a
End

Datatype:
thing = NonThing | Thing (thing container)
End

Datatype:
thing2 = NonThing2 | Thing2 (thing2 option)
End
```

`register_type` accepts `thing2`, but not `thing`.

The first place where it fails is a `tDefine` somewhere deep in `define_ref_inv`, where unless the type constructor is in {`pair`,`option`,`list`}, the recursive invocation of `THING_TYPE` is not eta-expanded properly before being passed to `tDefine`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.