[Haskell-cafe] deepSeq vs rnf

Cale Gibbard cgibbard at gmail.com
Fri Nov 24 14:15:41 EST 2006


On 24/11/06, Ross Paterson <ross at soi.city.ac.uk> wrote:
> On Fri, Nov 24, 2006 at 02:53:45PM +0000, Malcolm Wallace wrote:
> > Ross Paterson <ross at soi.city.ac.uk> wrote:
> > > Perhaps it would make sense to move all the NFData material to a new
> > > module called, say, Control.NormalForm, and maybe add a deepSeq
> > > function there.  Control.Parallel.Strategies is a somewhat surprising
> > > place to find normal form functions, and most of the people who are
> > > using them aren't thinking about parallelism.
> >
> > Agreed.  [ Bikeshed time:  Control.Evaluation.Strategies anyone? ]
>
> The suggestion is a module containing just class NFData, instances for
> Prelude types, and perhaps
>
>         deepSeq :: NFData a => a -> b -> b
>         deepSeq x y = rnf x `seq` y
>
> Shouldn't it have something like NF in the name?

Well, it shouldn't just have that. There's more in
Control.Parallel.Strategies which would be useful in general (e.g.
seqList). Perhaps the hierarchy should flip into:
Control.Strategies.Sequential
Control.Strategies.Parallel

Control.Strategies could reexport both.

Another thing is that the library is presently under-documented as far
as Haddock is concerned (what's the difference between >| and >||).
It'd be nice if at least a short comment was added to each function.


More information about the Libraries mailing list