Records in Haskell

wren ng thornton wren at
Mon Jan 9 07:15:11 CET 2012

On 12/30/11 10:58 PM, Matthew Farkas-Dyck wrote:
> On 30/12/2011, Andriy Polischuk<quuxity at>  wrote:
>> Consider this example:
>> quux (y . (foo>.<  bar).baz (f . g)) moo
>> It's not that easy to distinguish from
>> quux (y . (foo>.<  bar) . baz (f . g)) moo
> Yeah, that's why I dislike dot as compose operator (^_~)

Me too. Though I've been told repeatedly that we're in the losing camp :(

Given that we want to apply selectors to entire expressions, it seems 
more sensible to consider the selector syntax to be a prefix onto the 
selector name. Thus, the selector would be named ".baz" (or ":baz", 
"#baz", "@baz",...), and conversely any name beginning with the special 
character would be known to be a selector. Therefore, a space preceding 
the special character would be optional, while spaces following the 
special character are forbidden. This has a nice analogy to the use of 
":" as a capital letter for symbolic names: function names beginning 
with the special character for record selectors just indicate that they 
are postfix functions with some mechanism to handle overloading (whether 
that be TDNR or whathaveyou).

Live well,

More information about the Glasgow-haskell-users mailing list