let/where
Brian Boutel
brian@nzcs.org.nz
Thu, 20 Sep 2001 09:45:59 +1200
John Hughes wrote:
>
> That's the reason Haskell has two binding constructions.
>
Its a reason why it was a good decision to have both constructs.
There was some debate about which to have - it's a matter of personal
preference and style. The problem is that if you have both let and where
in the expression syntax, then
let a in b where c
is ambiguous unless you make an arbitrary decision about the precedence,
and that kind of arbitrariness is an opportunity for error - the
programmer mis-remembers the rule and gets a syntactically valid program
that does not do what was intended.
I always though that the resolution, allowing both but making where part
of the declaration syntax, thus both having a justification for the
parsing order and creating a means to write local definitions which span
guarded equations, was a very fine decision.
--brian