[Haskell-cafe] ANN: generic-deepseq

Maxime Henrion mhenrion at gmail.com
Sat Feb 25 01:52:26 CET 2012

On Thu, 2012-02-23 at 23:24 +0100, Bas van Dijk wrote:
> Some nitpicking:
> * In the instance:
> instance GDeepSeq U1 where grnf _ = ()
> I think it makes sense to pattern match on the U1 constructor, as in:
> grnf U1 = ().
> I haven't checked if that's necessary but my fear is that assuming:
> data Unit = Unit deriving Generic; instance DeepSeq Unit
> rnf (⊥ :: Unit) would equal: () while I would expect it to equal ⊥.

I just tested this and you were right; I have corrected the code in the
mercurial repository.

> * Why do you have the instance:
> instance GDeepSeq V1 where grnf _ = ()
> The only way to construct values of a void type is using ⊥. And I
> would expect that rnf ⊥ = ⊥, not (). I think the best thing is to just
> remove the V1 instance.

I have confirmed what Jos explained, and V1 instances are indeed not
necessary for the use case I originally intended them for, that is for
types tagged with void types. I have removed the V1 instance for now.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120225/b761c773/attachment.pgp>

More information about the Haskell-Cafe mailing list