deepseq: instance NFData (a -> b)

Ryan Scott at
Fri May 6 15:56:45 UTC 2016

I'm tentatively +1 on the idea of removing the NFData (a -> b) instance.

Henning raises a good point that there are probably folks who rely on
that instance to make automatic deriving of NFData. (Disclaimer: the
phrase "folks" includes myself.) A similar scenario arises when
deriving Show instances, for which a compromise was made by putting
the Text.Show.Functions module in base, which does nothing but export
an orphan Show (a -> b) instance.

Perhaps, if we wanted to retain the ability to use the NFData (a -> b)
instance in limited scenarios (e.g., when you're writing an
application and there's no risk of leaking orphan instances to other
users), then we could also introduce a Control.DeepSeq.Functions
module that exports an orphan NFData (a -> b) instance, and put a
giant warning at the top stating that such an instance should be used
responsibly. What say ye?

Ryan S.

More information about the Libraries mailing list