[Haskell] Extensible records: Static duck typing
Cale Gibbard
cgibbard at gmail.com
Tue Feb 5 06:21:43 EST 2008
On 05/02/2008, Barney Hilken <b.hilken at ntlworld.com> wrote:
>
> Should {label := "Hi", color := blue} and {color := blue, label :=
> "Hi"} have the same type?
>
The scoped labels paper has an interesting feature in this regard:
labels with different names can be swapped at will, but labels having
the same name (which is allowed) maintain their order. The types are
equivalent in either case though.
This is part of the general means by which the system avoids the need
for lacks-predicates, and as a bonus, allows each field name of a
record to act a bit like a stack.
- Cale
More information about the Haskell
mailing list