[Haskell-cafe] Non-recursive let

Doug McIlroy doug at cs.dartmouth.edu
Thu Jul 11 13:36:39 CEST 2013


By analogy to ML, which has "let" and "let rec", where the latter
corresponds to Haskell's "let", one is led to "let nonrec". I
would definitely not like "shadow", for it means that new
variable does NOT cast a shadow on its definining expression.

I fear also that "let nonrec" by any name would introduce another
attractive nuisance, just as insidious as the one it is intended
to correct. For example
    x = ...
    let nonrec { x = someFunction x
                 xsq = x^2} in ...
won't do what was probably intended. In my own code, this idiom
is more likely than the one that sparked the discussion.

Doug



More information about the Haskell-Cafe mailing list