[Haskell-cafe] let vs. where

Neil Mitchell ndmitchell at gmail.com
Wed Nov 14 04:22:02 EST 2007


Hi Chris,

> this could be captured nicely in a where clause:
>
> exp = (fst blah, snd blah) where blah = gg 1000
>
> But a let would have to be placed in both elements of the tuple
>
> exp = (let blah = g 1000 in fst blah, let blah = g 1000 in snd blah)

Why not:

exp = let blah = g 1000
         in (fst blah, snd blah)

Where's always get desugared to let's, so where's are never more efficient.

Thanks

Neil


More information about the Haskell-Cafe mailing list