[Haskell-cafe] ANN: generic-deepseq 22.214.171.124
mhenrion at gmail.com
Fri Feb 24 09:50:06 CET 2012
On Fri, 2012-02-24 at 09:32 +0100, Jos Pedro Magalhes wrote:
> 2012/2/24 Maxime Henrion <mhenrion at gmail.com>
> On Fri, 2012-02-24 at 07:49 +0100, Jos Pedro Magalhes wrote:
> > Hi,
> > 2012/2/23 Maxime Henrion <mhenrion at gmail.com>
> > > * 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.
> > This would have the consequence that any type tagged
> with a
> > phantom type
> > (for whatever reason) couldn't be used with deepseq,
> it would
> > return
> > bottom. What if I want to deepseq a 2-3 finger tree
> > with a
> > type-level natural that ensures the proper shape of
> the tree
> > statically?
> > It seemed to me that I should be able to do that;
> this is why
> > I added
> > this V1 instance.
> > I'm not sure I understand your comment... V1 should only be
> used for
> > datatypes without constructors, such as `data Empty`.
> Yes, such as the usual type-level naturals (not using
> data Z
> data S n
> Those can be used to tag a type which also contains actual
> values that
> you would want to deepseq? For example, a length-type vector?
> But in those cases they are used as tags, not as values, and hence do
> not show up in the generic representation. So if all you want is to be
> able to deepseq a value of a type like
> data Proxy t = Proxy
> even if your value is of type `Proxy Ze`, you shouldn't need a `V1`
Oh, ok; in that case, I probably don't need that V1 instance indeed. I
should probably write QuickCheck tests using the ChasingBottoms package
in order to ensure correct behaviour of this code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 834 bytes
Desc: This is a digitally signed message part
More information about the Haskell-Cafe