Proposal: Adding generics-based rnf-helper to `deepseq`

Herbert Valerio Riedel hvr at gnu.org
Tue Sep 25 10:23:53 CEST 2012


Simon Marlow <marlowsd at gmail.com> writes:

[...]

> So, just to make sure I've followed, the conclusion is that we don't
> want to modify the deepseq package because that would take it outside
> Haskell 98, and we don't want to have a conditional API (quite
> rightly). There's no disadvantage to having the generic functionality
> in a separate package, right?

Yeah, that sums it up about right (the way I perceived the discussion)

Originally, it seemed a bit overkill to me to create a separate package
containing just a few lines of codes

also, I thought that the current default (pure H98/H2010) implementation
for rnf provided by the NFData type-class, which is

| class NFData a where
|     rnf :: a -> ()
|     rnf a = a `seq` ()

could be changed to make use of the DefaultSignature extension at some
point in the future (which'd defintely leave the H98/H2010 featureset
and/or lead to a conditional API), for which having the `genericsRnf`
helper accessible to the `deepseq` package would be a requirement

However, the convenience of being able to write

| instance NFData Foo

instead of the more verbose

| instance NFData Foo where rnf = genericsRnf

isn't such a big deal either... it would have just been a nice use-case
for the DefaultSignature extension IMHO :-)

cheers,
  hvr



More information about the Libraries mailing list