
On 09 March 2006 22:56, Ian Lynagh wrote:
On Thu, Mar 09, 2006 at 04:53:52PM -0000, Simon Marlow wrote:
On 09 March 2006 14:40, Simon Marlow wrote:
But ISTR I later discovered a reason that counting brackets wouldn't work so well, but for now it escapes me. I'll try to dig it up.
I remember now: the problem is that 'let' does not always have a matching 'in', e.g. when it is used in 'do', pattern guards or list comprehensions. So you can't consistently treat let/in as brackets. I don't know a way around this.
Right, I mentioned that in my earlier mail.
So you did, sorry, I skimmed it too quickly. Ben's mail pretty much covers the problems with this idea, I think. It's unfortunate, because it almost works. Here's another couple that just occurred to me: f x | let y = x = y f x = case x of _ | let y = x -> y granted these are unlikely to occur in practice. Cheers, Simon

"Simon Marlow"
Here's another couple that just occurred to me:
f x | let y = x = y f x = case x of _ | let y = x -> y
granted these are unlikely to occur in practice.
Are these Haskell'98? I'm afraid I don't understand how a let binding (without "in") can occur in a guard for a function decl or case branch. In Ben's examples, the vertical bar was not a guard, but the separator in a comprehension (although he omitted to show the surrounding brackets...) [ ... | let x, y :: T x = 3 y = 4, ... ] [ ... | let x = 3, ... ] Regards, Malcolm
participants (2)
-
Malcolm Wallace
-
Simon Marlow