[Haskell-cafe] ANN: generic-deepseq 1.0.0.0

Maxime Henrion mhenrion at gmail.com
Sat Feb 25 12:06:46 CET 2012


On Sat, 2012-02-25 at 11:38 +0100, José Pedro Magalhães wrote:
> 2012/2/25 Andres Löh <andres.loeh at googlemail.com>
>         > 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.
> 
> Yes, I agree. There should be a V1 instance, and it should return
> `undefined`. This gives the expected behavior of `seq` on an empty
> datatype, I think. If there is no V1 instance, you'll get a
> type-checking error (no instance for V1), preventing generic deepseq
> on any datatype that happens to use an empty datatype in its
> definition.

Thanks for all the input guys. I have just released generic-deepseq
2.0.1.0 to hackage, with fixed U1 and V1 instances per this discussion.

Cheers,
Maxime

-------------- 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/af04ec42/attachment.pgp>


More information about the Haskell-Cafe mailing list