[Haskell-cafe] Re: Use of abbreviations in Haskell
Achim Schneider
barsoap at web.de
Fri Jan 2 14:16:33 EST 2009
"Felix Martini" <fmartini at gmail.com> wrote:
> [..]
>
> data QualifiedName = QualifiedName {
> name :: String
> uri :: Maybe String
> prefix :: Maybe String
> }
>
> but the global scope of the record field names doesn't allow that and
> therefore all kinds of abbreviations are inserted in front of the
> record field names which are hard to remember. So a better record
> syntax would be welcome. Perhaps the constructor could be used to
> limit the scope of the record field name e.g. QualifiedName.prefix?
>
/me votes for introducing
> data Attribute = Attribute {
> Attribute.key :: QualifiedName
> Attribute.value :: String
> }
It's surely gonna be used, and iff it becomes exceedingly wide-spread,
it can be made default (in 10 years or so).
OTOH, I don't like the idea of having to write "Attribute" all the
time, and neither want to write pages of
attrKey = Attribute.key
for 1000-element records (or TH to tackle standard language problems,
for that matter), so there has to be some way for library users to
shorten code without being masochistic, somewhat like this:
A = Attribute
, that is, allow definition of data constructors in usual declarations,
up to some limits.
--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.
More information about the Haskell-Cafe
mailing list