Code generation for tagged unions currently works only when they have at least two cases (otherwise, it generates invalid code). However, tagged unions with fewer than two cases are used in our code and can make sense.
Specifically, we sometimes use them to represent error types for uniformity with those with more cases: one case for a single kind of error, zero if the route cannot give errors.
Code generation for tagged unions currently works only when they have at least two cases (otherwise, it generates invalid code). However, tagged unions with fewer than two cases are used in our code and can make sense.
Specifically, we sometimes use them to represent error types for uniformity with those with more cases: one case for a single kind of error, zero if the route cannot give errors.
Metarpheus generates the usual model:
The zero-case variant (empty
values
) could possibly be just a synonym fornever
.From https://github.com/buildo/retro/issues/107.