+1<br><br>I would just suggest calling the exported function `genericRnf`.<br><br><br>Cheers,<br>Pedro<br><br><div class="gmail_quote">On Fri, Sep 21, 2012 at 10:21 AM, Herbert Valerio Riedel <span dir="ltr">&lt;<a href="mailto:hvr@gnu.org" target="_blank">hvr@gnu.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Simon (et al.),<br>
<br>
Some time ago, the `generic-deepseq` package was announced to the<br>
haskell-cafe list, and some discussion took place[1], and the suggestion<br>
came up that it might useful to be included to `deepseq` somehow.<br>
<br>
IMHO, a least introduing way (which I&#39;ve been using myself) would be to<br>
add something along the code below to the `Control.DeepSeq` module (only<br>
`genericsRnf` shall be exported, thus avoiding a PVP-major-bump):<br>
<br>
<br>
    -- | Generics-based &#39;rnf&#39; implementation<br>
    genericsRnf :: (Generic a, GNFData (Rep a)) =&gt; a -&gt; ()<br>
    genericsRnf = grnf_ . from<br>
    {-# INLINE genericRnf #-}<br>
<br>
    -- | Hidden type-class, /not/ exported<br>
    class GNFData f where<br>
        grnf_ :: f a -&gt; ()<br>
<br>
    instance GNFData U1 where<br>
        grnf_ !U1 = ()<br>
        {-# INLINE grnf_ #-}<br>
<br>
    instance NFData a =&gt; GNFData (K1 i a) where<br>
        grnf_ = rnf . unK1<br>
        {-# INLINE grnf_ #-}<br>
<br>
    instance GNFData a =&gt; GNFData (M1 i c a) where<br>
        grnf_ = grnf_ . unM1<br>
        {-# INLINE grnf_ #-}<br>
<br>
    instance (GNFData a, GNFData b) =&gt; GNFData (a :*: b) where<br>
        grnf_ (x :*: y) = grnf_ x `seq` grnf_ y<br>
        {-# INLINE grnf_ #-}<br>
<br>
    instance (GNFData a, GNFData b) =&gt; GNFData (a :+: b) where<br>
        grnf_ (L1 x) = grnf_ x<br>
        grnf_ (R1 x) = grnf_ x<br>
        {-# INLINE grnf_ #-}<br>
<br>
<br>
<br>
this way, the client code can then chose to use a Generics-derived `rnf`<br>
implementation expliclity by simply declaring:<br>
<br>
    instance NFData FooBar where rnf = genericsRnf<br>
<br>
<br>
...does this sound sensible?<br>
<br>
<br>
cheers,<br>
  hvr<br>
<br>
 [1]: <a href="http://www.haskell.org/pipermail/haskell-cafe/2012-February/099551.html" target="_blank">http://www.haskell.org/pipermail/haskell-cafe/2012-February/099551.html</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</font></span></blockquote></div><br>