Closed
Description
This is OK:
type t = | Array(array<int>) | Record({x:int})
But this is wrong:
@unboxed
type t = Record({x: int}) | Array(array<int>)
let classify = v =>
switch v {
| Record({x}) => x
| Array(a) => a[0]
}
function classify(v) {
if (typeof v === "object") {
return v.x;
} else {
return Caml_array.get(v, 0);
}
}
Metadata
Metadata
Assignees
Labels
No labels