haskell / deepseq

Deep evaluation of data structures
http://hackage.haskell.org/package/deepseq
Other
40 stars 29 forks source link

Add quantified superclasses to `NFData(1,2)` #88

Closed Icelandjack closed 1 year ago

Icelandjack commented 1 year ago

In line with base: Relax instances for Functor combinators; put superclass on Class1 to make non-breaking we should add superclasses to NFData(1,2)

class (forall a. NFData (f a)) => NFData1 f

class (forall a. NFData a => NFData1 (bi a)) => NFData2 bi
phadej commented 1 year ago

I'll wait until the above changed in base is released and ecosystem learned how well it works. (E.g. some weird code using constraints: We cannot have a Dict of forall a. NFData a, can we?)

Also this is technically a breaking change, so that's another good reason to not hurry.

Ericson2314 commented 1 year ago

I agree this looks like a good idea. Thanks for proposing, @Icelandjack!

Icelandjack commented 1 year ago

Hm with ImpredicativeTypes can we not have Dict (forall a. NFData a)?

phadej commented 1 year ago

@Icelandjack I let someone else experiment and figure out.