Question about scope of 'let' and 'where'

Hal Daume III hdaume@ISI.EDU
Mon, 17 Mar 2003 08:51:58 -0800 (PST)


Hi,

>  f x = let ...
>        in
>           ...
>           where
>              ...
> 
> Assuming that all the ...s are legal, is this OK? Should it be? It
> really makes the 'where' clause look like it's inside the 'let', when
> in fact it can't be.

Ah, sorry.  Yes, this is legal.  However, if you think about 'where's
attaching to declarations, not expressions, I don't think you get too
confused about it being indented "too much."  Again, this is because the
where clause (include its layout rules) doesn't care at all what your
function body expression looks like.

Personally, I don't often mix top-level lets and wheres, unless I have a
good reason to do so.  Though not for this reason, it does clean this up.