You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type t = T {x: int}
let make_t_with_xy = T {x=1, y=2}
let main () =
let example_t = make_t_with_xy in
match example_t with
T rec -> rec -- rec loses y: int
This information loss occurs because type constructors don't carry any information about their arguments - they're used only to make type arrows that instantiate their parent type. This means that even though T {x=1, y=2} keeps the y: int in its row variable, going from T rec has no access to it. I think there are a couple of possibilities to solve this:
package type information with type constructors. How this gets propagated to the type might get really messy.
synthesize ADT type variables for the row variable in each record that exists in an ADT.
I think the latter is somewhat tractable but the larger question I have is: should we bother? Is preserving this information desirable? I suspect it is purely for consistency's sake but am curious as to others' opinions.
The text was updated successfully, but these errors were encountered:
Consider the following:
This information loss occurs because type constructors don't carry any information about their arguments - they're used only to make type arrows that instantiate their parent type. This means that even though
T {x=1, y=2}
keeps they: int
in its row variable, going fromT rec
has no access to it. I think there are a couple of possibilities to solve this:I think the latter is somewhat tractable but the larger question I have is: should we bother? Is preserving this information desirable? I suspect it is purely for consistency's sake but am curious as to others' opinions.
The text was updated successfully, but these errors were encountered: