Oops.. Probably I get why toList is preferred method for making instances :) My rnfFoldable does not work. <br>But this version must be correct:<br><br>&gt; rnfFoldable :: (NFData a, Foldable f) =&gt; f a -&gt; ()<br>&gt; rnfFoldable = Foldable.foldl (\z x -&gt; rnf x `seq` z) ()<br>
<br><br><div class="gmail_quote">On Tue, Jul 12, 2011 at 6:21 PM, Alexey Karakulov <span dir="ltr">&lt;<a href="mailto:ankarakulov@gmail.com">ankarakulov@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
My proposal is qiute straightforward. The patch is attached and it&#39;s essence  is in these lines:<br><br>&gt; instance NFData a =&gt; NFData (Data.Sequence.Seq a) where<br>&gt;    rnf = rnf . Foldable.toList<br><br>[Discussion part]<br>

<br>I choosed  toList method to keep the code style, but I&#39;m not sure it&#39;s efficient to create cons&#39;es when we could just fold:<br><br>&gt; rnfFoldable :: (NFData a, Foldable f) =&gt; f a -&gt; ()<br>&gt; rnfFoldable = Foldable.foldMap rnf<br>

<br>Or it&#39;s better to do this with foldl (while not so nice at is was with using () as monoid):<br><br>&gt; rnfFoldable = Foldable.foldl (const rnf) ()<br><br>There was a proposal to add strict folds to Foldable type class, so we can use foldl&#39; there.<br>

<br>My proposal is to add the instance in either way. <br>
</blockquote></div><br>