[Haskell'-private] StricterLabelledFieldSyntax

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Aug 10 20:50:01 EDT 2009


On Sun, 2009-07-26 at 02:34 +0100, Ian Lynagh wrote:
> Hi all,
> 
> I've made a ticket and proposal page for making the labelled field
> syntax stricter, e.g. making this illegal:
> 
>     data A = A {x :: Int}
> 
>     y :: Maybe A
>     y = Just A {x = 5}
> 
> and requiring this instead:
> 
>     data A = A {x :: Int}
> 
>     y :: Maybe A
>     y = Just (A {x = 5})

I think I don't like it. It makes the "labelled function argument" trick
much less nice syntactically.

... <- createProcess proc { cwd = Just "blah" }

This is especially so if the labelled function argument is not the final
parameter since then one cannot use $, you'd have to put the whole thing
in ()'s.

The labelled argument technique is one I think we should be making
greater use of (eg look at the proliferation of openFile variants) so I
don't think we should be changing the syntax to make it harder / uglier.

Duncan



More information about the Haskell-prime mailing list