Proposal: deepseq should not depend on containers
Christian.Maeder at dfki.de
Wed Dec 29 14:41:39 CET 2010
Am 29.12.2010 12:23, schrieb Johan Tibell:
> On Tue, Dec 28, 2010 at 11:03 PM, Alexander Dunlap
> <alexander.dunlap at gmail.com> wrote:
>> It seems like a huge number of packages depend on containers, and
>> almost everyone seems to have it installed anyway, so I don't see what
>> we gain by removing the dependency on containers.
> Problems with the current state of affairs:
> * The current NFData instances for the containers data types are
> inefficient, as deepseq don't have access to the internals of the
> containers package. For example, here's the Map instance
> instance (NFData k, NFData a) => NFData (Data.Map.Map k a) where
> rnf = rnf . Data.Map.toList
> This causes unnecessary allocation of list cells.
I wonder which other instances need access to the internal map data type
and possibly allow to observe different results for "equal" maps.
Even the Data instances use "toList" and "fromList". So these instances
could also be defined elsewhere as "orphaned"!
I don't think, that orphaned instances can be avoided in the long run.
Therefore I would rather see a separate package for the NFData instances
of container types.
More information about the Libraries