jtdaugherty/vty

Why is `Eq v` necessary for the `Semigroup` and `Monoid` for the `MaybeDefault` datatype

KommuSoft opened this issue · 1 comments

I'm wondering why we need as type constraint Eq v for the instances of Semigroup and Monoid. While we will likely eventually need the Eq instance, at the instance level of Semigroup and Monoid, we do not make use of any function that is defined in Eq.

instance Eq v => Semigroup (MaybeDefault v) where
_ <> v@(SetTo _) = v
x <> KeepCurrent = x
_ <> Default = Default
instance Eq v => Monoid ( MaybeDefault v ) where
mempty = KeepCurrent
#if !(MIN_VERSION_base(4,11,0))
mappend = (<>)
#endif

It turns out we don't! Those constraints are redundant, probably made so by some recent changes. I removed them in abf7fc4 just now. Thanks for mentioning this!