syntax
syntax copied to clipboard
Express list literal variants
In OCaml and Reason this code is valid, is there a way to express in ReScript? Any intent to support?
type t('a) =
| []
| ::('a, t('a))
There's currently no way to express this in ReScript. Is this urgent? What's your use case?
Not urgent - we have some code that uses this to create a heterogeneous list but can keep that in .ml for now.
Something like:
type rec t<'a> =
| Empty
| Cons('a, t<'a>)
The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.