Records in Haskell

Ian Lynagh igloo at earth.li
Fri Mar 2 00:48:19 CET 2012


On Thu, Mar 01, 2012 at 10:46:27PM +0000, AntC wrote:
> 
> Also this would be ambiguous:
> 
>     object.SubObject.Field.subField

Well, we'd have to either define what it means, or use something other
than '.'.

> In terms of scope control, I think (I'm guessing rather) you do get similar 
> behaviour to DORF, with the added inconvenience of:
> * an extra arg to Has (how does the constraint sugar cope?)

You can infer ft from the f.

>     r{ field :: Int } => ...
>     r{ Field :: Int } => ...               -- ? does that look odd

Well, it's new syntax.

>                   -- suppose I have two private namespaces
>     r{ Field :: Int ::: Field1 } => ...     -- ??
>     r{ (Field ::: Field2) :: Int } => ...   -- ???

You've lost me again.

> > But I think you are agreeing that (leaving aside the issue of whether
> > the design is reasonable) the above variant would indeed allow the user
> > to choose the behaviour of either SORF or DORF.
> > 
> 
> No, not the "user to choose", but the implementor. We can't possibly try to 
> support both approaches.

I don't follow. You agreed above that "you do get similar behaviour to
DORF", and if you just use lowercase field names then the behaviour is
the same as SORF. Therefore both are supported.


Thanks
Ian




More information about the Glasgow-haskell-users mailing list