Marcin 'Qrczak' Kowalczyk wrote:
>
> [...]
>
> In general I don't quite like the fact that records are getting more
> anonymous. Magical instances of basic classes? How inelegant.
>
> If I want the record type to have an identity, it will have to be
> wrapped in a newtype, so I must think at the beginning if I will ever
> want to write specialized insances for it and then all the code will
> depend on the decision. Currently a datatype with named fields has
> both an identity and convenient syntax of field access. (And why
> newtype is not mentioned in section 5.1?)
>
> I like name equivalence where it increases type safety. Extensible
> records promote structural equivalence.
>
> Unfortunately the proposal seems to increase the number of
> irregularities and inelegant rules...
>
> If expr.Constructor for a multiparameter constructor yields a tuple,
> then for an unary constructor it should give a 1-tuple, no? I know
> it would be extremely inconvenient, especially as newtypes are more
> used, so I don't propose it, but it is getting less regular. What
> about nullary constructors - empty tuple? :-)
>
> I don't say that I don't like the proposal at all, or that I never
> wanted to have several types with the same field names. But it is
> not clean for me, it's a compromise between usability and elegance,
> and from the elegance point of view I like current records more.
>
> Maybe it would be helpful to show how to translate a program with
> extensible records to a program without them (I guess it's possible
> in a quite natural way, but requires global transformation of the
> whole program).
Dear all,
[Just a short advertisement]
An alternative approach to flexible records in Haskell can be found in
O'Haskell. O'Haskell records promote name (in)equivalence, extensibility
on the type (but not on the term) level, declared subtyping with variances,
a treatment of selectors that closely follows the treatment of data
constructors, type inference, and a succinct notation.
A language overview, several examples, as well as further pointers can be
found at
http://www.cs.chalmers.se/~nordland/ohaskell/
Kind regards,
Johan