Open
Description
Consider the following code:
type Foo = { x :: Number }
data Bar:
| bar(ref y :: Foo)
end
a = bar({x: 2})
b = cases(Bar) a:
| bar(_) => 2
end
This fails with the error "Cases on ref field needs to use ref
", which can be fixed by changing the pattern in the cases
expression to bar(ref _)
. This seems silly, since (unless I'm mistaken) using an underscore at this position means, "I don't care what this value is". As such, it seems silly to force users to explicitly annotate that they're ignoring a reference instead of ignoring a value.
Maybe I'm missing some semantic or pedagogical point here, but it seems strange.