
Simon Marlow wrote:
Interesting. You're absolutely right, GHC doesn't respect the report, on something as basic as sections! The translation we use is
(e op) ==> (op) e
once upon a time, when the translation in the report was originally written (before seq was added) this would have been exactly identical to \x -> e op x, so the definition in the report was probably used for consistency with left sections.
We could make GHC respect the report, but we'd have to use
(e op) ==> let z = e in \x -> z op x
to retain sharing without relying on full laziness.
We should keep in mind that this was changed deliberately in ghc 6.6, in order to support "postfix" operators. http://www.haskell.org/ghc/docs/6.6/html/users_guide/release-6-6.html The motivating example was the factorial operator which can currently be written as (n !) in ghc-Haskell. Cheers, Bertram