Re: [Haskell'-private] StricterLabelledFieldSyntax

2009-08-13 Thread John Meacham
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/
___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime


Re: [Haskell'-private] StricterLabelledFieldSyntax

2009-08-13 Thread Ian Lynagh
On Wed, Aug 12, 2009 at 11:45:04PM -0700, John Meacham wrote:
 
 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 { .. }) | ...

You would not need these parentheses; nor would you need parentheses in

foo = Foo { ... }


Thanks
Ian

___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime


Re: [Haskell'-private] StricterLabelledFieldSyntax

2009-08-10 Thread Duncan Coutts
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

___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime