Proposal: Make Semigroup and Monoid instances for Data.Functor.Compose

Keith keith.wygant at gmail.com
Thu Jul 25 16:02:53 UTC 2019


With the Monoid 'First' and 'Last' newtypes going away, it would be nice to have equivalent Functor and Applicative instances.

This works if Compose uses its components' instances:

instance Semigroup (m (n a)) ⇒ Semigroup (Compose m n a) where
  Compose mnx <> Compose mny = Compose (mnx <> mny)

instance Monoid (m (n a)) ⇒ Monoid (Compose m n a) where
  mempty = Compose mempty

–Keith
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190725/d3b819a6/attachment.html>


More information about the Libraries mailing list