[Haskell-cafe] Non-recursive let

Andreas Abel andreas.abel at ifi.lmu.de
Thu Jul 11 23:09:41 CEST 2013


Note that for non-recursive lets

   let' x1 = e1
        x2 = e2

is sequential and *not* the same as the parallel

   let' (x1, x2) = (e1, e2)

The first is

   (\ x1 -> (\x2 -> ...) e2) e1

and the second is

   (\ (x1,x2) -> ...) (e1, e2)

On 11.07.2013 13:36, Doug McIlroy wrote:
> 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
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY

andreas.abel at ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/



More information about the Haskell-Cafe mailing list