
26 Jul
2015
26 Jul
'15
11:34 p.m.
Sorry for the terrible title, but I think we should add something like the following to Data.Monoid (I already mentioned this in the discussion of a Monoid instance for ZipList). newtype Appl f m = Appl (f m) instance (Applicative f, Monoid m) => Monoid (Appl f m) where mempty = Appl $ pure mempty mplus (Appl x) (Appl y) = Appl $ liftA2 mplus x y It may be possible to use coercions to improve mplus; I haven't tried it. This type is the same as WrappedApplicative from semigroupoids, do it might be best just to give it that name.