Proposal: Make `NFData` a fundamental/primitive type-class (by making `deepseq` a GHC-boot package)

Simon Marlow marlowsd at gmail.com
Thu Aug 25 12:04:43 CEST 2011


On 25/08/2011 08:12, Simon Peyton-Jones wrote:
> | Make `NFData` a fundamental/primitive type-class
> | (by making `deepseq` a GHC-boot package)
>
> The goals are good, but I don't follow the proposed design.  In particular, why does the deepseq package need to be in base?

The proposal is to make deepseq a boot package, not to move anything 
into base.

> In principle, you can do this:
>
> * Implement deepseq
>
> * Add instances for GHC types and container types; these instances
>    wouldn't be orphans because they'd be in the module defining the
>    NFData class

That's what we have right now, the problem is that deepseq can't define 
a good instance for NFData Map, because it can't see enough of the 
internals of Map.

> The main objection seems to be this:
>
> * deepseq would thereby depend on 'containers' (say), whereas a random
>    customer of deepseq might find that odd.  And it might increase the size
>    of his binaries.
>
> The solution to that is to make containers depend on deepseq.  That would induce the inverse dependency: every user of containers would get deepseq willy-nilly.  Perhaps that is less bad.
>
> And it would make 'deepseq' into a GHC boot package, which is probably fine.

Exactly, that's the proposal!

(+1 from me, BTW)

Cheers,
	Simon



More information about the Libraries mailing list