No, that's not legal. You'll get an unbound variable error on the use of 'a' in the definition of 'b'. This doesn't really have anything to do with layout. Consider the following definition:
f x = case x of Nothing -> ... Just (y,z) -> let Just q = z in b where b = g q
does it really make sense to let the where clause look that deep into an expression to pull out a variable? And what if you use the name 'q' multiple times in the expression? -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Mon, 17 Mar 2003, Matt Hellige wrote:
[Hal Daume III <hdaume@ISI.EDU>]
It is not. Lets are expressions. Wheres are part of declarations. In a grammar sense, you have something like:
funcdef ::= name = expr (where decls)? expr ::= let decls in expr
so the declarations inside a let are internal to the expression and can't go outside into the where clause.
Shouldn't the layout rule make this apparent? Is the following really OK?
In the function body (rhs):
let { a = (e1) } in (e2) where { b = f a }
I'd say that's pretty misleading, and maybe should be illegal layout...?
Matt
-- Matt Hellige matt@immute.net http://matt.immute.net _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell