in Data.Monoid
:
newtype Sum a = Sum { getSum :: a }
deriving ( Eq -- ^ @since 2.01
, Ord -- ^ @since 2.01
, Read -- ^ @since 2.01
, Show -- ^ @since 2.01
, Bounded -- ^ @since 2.01
, Generic -- ^ @since 4.7.0.0
, Generic1 -- ^ @since 4.7.0.0
, Num -- ^ @since 4.7.0.0
)
I don't understand how you could derive Num
and Bounded
on Sum
with Integer
, Float
etc... which are naturally not Bounded
(it's the same story for the Product
wrapper).
Thanks!
I'm fairly sure this makes Sum a
an instance of (say) Eq
whenever a
is an instance of Eq
.
instance (Eq a) => Eq (Sum a) where ...
And likewise for all the other classes.