deeqSeq proposal

John Meacham john at
Fri Mar 31 01:50:19 EST 2006

On Thu, Mar 30, 2006 at 02:12:29PM -0800, Andy Gill wrote:
>  - How easy is this to add to the compilers? It looks pretty simple  
> to me,

jhc already has it by accident, it uses DrIFT for implementing its
deriving methods which has had deepSeq deriving for a while. (though, it
calls it 'rnf' for reduce to normal form)

>    and would provide huge bang-for-buck for Galois.

out of curiosity, do you use tools like DrIFT or TH to auto-generate
DeepSeq instances for you?

>  - Any alternatives to the key concern; stomping on space leaks.
>    (This proposal is orthogonal to the seq/Class discussion)

One thing, in order to deepSeq arbitrary types, it would mean heap
locations need to be self-describing, which is not true in general for
some haskell implementations. (the tag might have been unboxed away for
instance, or you only have an opaque code pointer representation)

requiring a typeclass DeepSeq a => would solve this problem as the
"shape" of the type will be carried in the typeclass, either as a
method(ghc) or a type parameter (in jhc) or discarded on implementations
that don't need it. (yhc I am guessing?)

So what I'd like to see is for the compiler to be able to auto-derive a
DeepSeq instance so compilers are free to choose the best implementation
method. incidentally, I'd like to see the same thing for Typeable.


John Meacham - ⑆⑆john⑈

More information about the Haskell-prime mailing list