Records in Haskell

Matthew Farkas-Dyck strake888 at gmail.com
Thu Jan 19 04:29:16 CET 2012


On 18/01/2012, Gábor Lehel <illissius at gmail.com> wrote:
> (I *am*, however, uncomfortable with using straight-up type level
> strings, without consideration for any particular alternative. If
> nothing else they should at least be opaque symbols which can be
> passed around and used in the supported contexts but not manipulated
> as strings. String-based hackery should be left to Template Haskell,
> and out of the type system. I can't really express at the moment why
> in particular I think it would be bad, but it feels like it would be
> bad.)
>

I strongly agree; plus, it's awkward (and ugly) that a selector be
desugarred to a type-level string of its key identifier, as if it were
some perverse quasiliteral.

The trouble is, if they were opaque, then how could a function be
polymorphic over all records with a certain member, with defined
semantics? How could one tell the compiler that the semantics of all
such members are the same? One must define a name, and then the
problem of namespace non-interoperability that is now a great bother
would be a greater bother yet.



More information about the Glasgow-haskell-users mailing list