Skip to content

Commit a1470da

Browse files
author
Melanie Phoenix
committed
change superclasses for Data.Functor.{Sum, Product, Compose}
Addresses #93.
1 parent ae1ac1c commit a1470da

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Control/DeepSeq.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,25 +500,26 @@ instance (NFData1 f, NFData1 g) => NFData1 (Compose f g) where
500500
liftRnf r = liftRnf (liftRnf r) . getCompose
501501

502502
-- | @since 1.4.3.0
503-
instance (NFData1 f, NFData1 g, NFData a) => NFData (Compose f g a) where
504-
rnf = rnf1
503+
instance (NFData (f (g a))) => NFData (Compose f g a) where
504+
rnf (Compose fga) = rnf fga
505505

506506
-- | @since 1.4.3.0
507507
instance (NFData1 f, NFData1 g) => NFData1 (Functor.Sum f g) where
508508
liftRnf rnf0 (Functor.InL l) = liftRnf rnf0 l
509509
liftRnf rnf0 (Functor.InR r) = liftRnf rnf0 r
510510

511511
-- | @since 1.4.3.0
512-
instance (NFData1 f, NFData1 g, NFData a) => NFData (Functor.Sum f g a) where
513-
rnf = rnf1
512+
instance (NFData (f a), NFData (g a)) => NFData (Functor.Sum f g a) where
513+
rnf (Functor.InL fa) = rnf fa
514+
rnf (Functor.InR ga) = rnf ga
514515

515516
-- | @since 1.4.3.0
516517
instance (NFData1 f, NFData1 g) => NFData1 (Functor.Product f g) where
517518
liftRnf rnf0 (Functor.Pair f g) = liftRnf rnf0 f `seq` liftRnf rnf0 g
518519

519520
-- | @since 1.4.3.0
520-
instance (NFData1 f, NFData1 g, NFData a) => NFData (Functor.Product f g a) where
521-
rnf = rnf1
521+
instance (NFData (f a), NFData (g a)) => NFData (Functor.Product f g a) where
522+
rnf (Functor.Pair fa ga) = rnf fa `seq` rnf ga
522523

523524
instance NFData a => NFData (Ratio a) where
524525
rnf x = rnf (numerator x, denominator x)

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
* Add quantified superclasses to NFData(1,2)
66
([#88](https://github.com/haskell/deepseq/issues/88))
7+
* Alter superclasses for Data.Functor.{Sum, Product}
8+
([#95])(https://github.com/haskell/deepseq/pull/95)
79
* Drop support for GHC < 8.6
810
([#94](https://github.com/haskell/deepseq/pull/94))
911

0 commit comments

Comments
 (0)