Ian Lynagh wrote:
On Mon, Nov 30, 2009 at 11:12:36AM +0000, Duncan Coutts wrote:
On Mon, 2009-11-30 at 09:16 +0000, Simon Marlow wrote:
On 29/11/2009 19:40, Duncan Coutts wrote:
Here's the main one it cannot cope with that bothers me:
foo x = case bar x of
Pattern1 -> ...
Pattern1 -> ...
where
baz = ...
The new layout requires it to be:
foo x = case bar x of
Pattern1 -> ...
Pattern1 -> ...
where
baz = ...
When I saw this, it took me a few minutes (because I was thinking about
it in this abstract context) to figure out what the first version even
meant. I'd say the latter is preferable style and it's okay for a new
layout rule to require it.
Out of interest, without trying it, what do you think this program
should print (the only difference between the 3 functions is the
indentation of the "where" line)?:
...so I agree with Ian's presenting this example... (although the
scoping of where-clause vs. function-argument-binding is not something
that I usually have to know, so the example might be better with 'x'
defined at module-level rather than as function-argument).
(I predict the standard layout rule would yield ten ten six.)
main = do print $ f1 1
print $ f2 1
print $ f3 1
f1 x = x + case () of
() -> x
where x = 5
f2 x = x + case () of
() -> x
where x = 5
f3 x = x + case () of
() -> x
where x = 5
Thanks
Ian
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc