Records in Haskell

AntC anthony_clayden at
Thu Mar 1 08:05:15 CET 2012

wren ng thornton <wren <at>> writes:

> >
> > That's what SORF does: the String Kind
> >
> > No proposal is using a _type_-level string. Barney's confused you.
> I was under the impression that all the working proposals were using the 
> Has class, ...

Yes, but:

> a la:
>      someFunction :: Has "name" a => a -> Foo
>      someFunction x = ... (name x) ...

No! Have you read any of the proposals? Which bit of your anatomy did you use?

Note that that syntax is not valid H98. Also note that the `Has` class uses 
three arguments, and in a different sequence to what you show.

That syntax (with 3 args present) turns up in two places:
1. SPJ's SORF proposal
2. Barney Hilken's postings. Please ignore them, is all I can say.
   Neither I nor SPJ had anything to do with them.

The DORF syntax is:

      someFunction :: Has r Proxy_name t => r -> t

I prefer the sugar, which is the same for SORF and DORF (SPJ invented it, I 
stole it unashamedly):

      someFunction :: r{ name :: t } => r -> t

The difference between the desugarring is crucial:
- SORF desugars to a String Kind -- hence Has r "name" t => ...
    the "name" in quotes represents a String Kind

- DORF desugars to a (proxy) type, not some new-fangled Kind
     Has r Proxy_name t => ...
  That is H98 (with multi-param type classes).

I propose we use the sugar, so that the implementor can decide how to, um, 

> modulo the debate about the value-level syntax for records, and modulo 
> the debate about whether Has should be exposed to users or hidden inside 
> GHC. Is this no longer the case?

Was _never_ the case, you've been paying too much attention to the wrong 
postings. Look at the wiki pages: that's why I posted it.

I repeat: nobody is using a "type-level string". You (or someone) is making it 

This is beginning to exasperate me. Read the wikis: can you see "type-level 
string"? Certainly not on the DORF pages, I'm pretty sure not on the SORF 
pages. If you find it somewhere else, tell me and I'll get it changed.


More information about the Glasgow-haskell-users mailing list