[Haskell'-private] StricterLabelledFieldSyntax

John Meacham john at repetae.net
Thu Aug 13 02:45:04 EDT 2009


On Sun, Jul 26, 2009 at 02:34:59AM +0100, Ian Lynagh wrote:
> 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 don't like this not only because it would make a lot of code more
unwieldy, but it muddles the interpretation of how one interprets
braces.

Right now, we have a very simple rule, braces always bind to the left,
no matter where they are used, you can always tell what they mean by the
thing immediately preceeding them. Whether it is 'let', 'do', 'where', a
constructor, or an expression, you have a simple rule to remember which
is nice.

Also, what about data declarations? Would we need something like below?
It seems odd to apply such a rule sometimes but not others.

> data Foo = (Foo { .. }) | ...


        John



-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/


More information about the Haskell-prime mailing list