[Haskell-cafe] Re: extending bang proposal Re: strict Haskell
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Tue Feb 7 15:33:21 EST 2006
Brian Hulley wrote:
> One motivation seems to be that in the absence of whole program
> optimization, the strictness annotations on a function's type can allow
> the compiler to avoid creating thunks at the call site for cross-module
> calls whereas using seq in the function body itself means that the thunk
> still has to be created at the call site because the compiler can't
> possibly know that it's going to be immediately evaluated by seq.
GHC solves this with the worker-wrapper transformation: the code for the
wrapper is exported as part of the module's interface and inlined at
external call sites. It handles seq, unboxing, and so on and calls the
worker via a private interface.
Not that I think strictness information in the type system is a bad idea.
More information about the Haskell-Cafe