Open cartazio opened 4 years ago
Annoyingly, fixing this warning will require a breaking API change. This is because the current Semigroup
and Monoid
instances for MooreT
are:
If we define mappend = (<>)
, however, then the Monoid
instance will fail to compile on pre-8.4 GHCs, since Semigroup
was not a superclass of Monoid
back then. We can repair the instance by doing something like this:
instance ( Applicative m, Monoid b
#if !(MIN_VERSION_base(4,11,0))
, Semigroup b
#endif
) => Monoid (MooreT m a b) where
mempty = pure mempty
{-# INLINE mempty #-}
mappend = (<>)
{-# INLINE mappend #-}
But that constitutes a breaking change on pre-8.4 GHCs. This is probably the right thing to do, but it might be worth waiting until there is another breaking change we can make at the same time to avoid major version churn.
Sounds reasonable to me
On Sat, Mar 7, 2020 at 8:59 AM Ryan Scott notifications@github.com wrote:
Annoyingly, fixing this warning will require a breaking API change. This is because the current Semigroup and Monoid instances for MooreT are:
If we define mappend = (<>), however, then the Monoid instance will fail to compile on pre-8.4 GHCs, since Semigroup was not a superclass of Monoid back then. We can repair the instance by doing something like this:
instance ( Applicative m, Monoid b#if !(MIN_VERSION_base(4,11,0)) , Semigroup b#endif ) => Monoid (MooreT m a b) where mempty = pure mempty {-# INLINE mempty #-} mappend = (<>) {-# INLINE mappend #-}
But that constitutes a breaking change on pre-8.4 GHCs. This is probably the right thing to do, but it might be worth waiting until there is another breaking change we can make at the same time to avoid major version churn.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ekmett/machines/issues/109?email_source=notifications&email_token=AAABBQXMJUD2PRUXIML247TRGJHMNA5CNFSM4LDMG7K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOD2EGY#issuecomment-596091419, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABBQWXJWQPJN456ZGA6EDRGJHMNANCNFSM4LDMG7KQ .
cc @RyanGlScott @davean