[Haskell-cafe] ANN: generic-deepseq 1.0.0.0

Andres Löh andres.loeh at googlemail.com
Sat Feb 25 09:23:07 CET 2012


> Would you have an example of a type for which it would be useful to have
> a DeepSeq instance, and that would require a V1 instance? I cannot think
> of one now; I originaly thought it would be necessary to permit deriving
> DeepSeq instances for types tagged with "void" types, but as José
> explained, in that case, the V1 instance isn't needed because those void
> types don't show up in the representation.

While void datatypes are rare, it just doesn't make sense to exclude
them. It's an arbitrary restriction. Here's a constructed example:

data X a = C1 Int | C2 a
data Z -- empty

type Example = X Z

We're using Z as a parameter to X in order to exclude the use of the
C2 case. Without a V1 case, you cannot use deepSeq on values of type
Example.

Cheers,
  Andres



More information about the Haskell-Cafe mailing list