
12 Jul
2011
12 Jul
'11
11:21 a.m.
My proposal is qiute straightforward. The patch is attached and it's essence is in these lines:
instance NFData a => NFData (Data.Sequence.Seq a) where rnf = rnf . Foldable.toList
[Discussion part] I choosed toList method to keep the code style, but I'm not sure it's efficient to create cons'es when we could just fold:
rnfFoldable :: (NFData a, Foldable f) => f a -> () rnfFoldable = Foldable.foldMap rnf
Or it's better to do this with foldl (while not so nice at is was with using () as monoid):
rnfFoldable = Foldable.foldl (const rnf) ()
There was a proposal to add strict folds to Foldable type class, so we can use foldl' there. My proposal is to add the instance in either way.