ekmett / bifunctors

Haskell 98 bifunctors, bifoldables and bitraversables
Other
57 stars 42 forks source link

Category cat => Monoid (Join cat a) #64

Open Icelandjack opened 6 years ago

Icelandjack commented 6 years ago
instance Category cat => Semigroup (Join cat a) where
  Join f <> Join g = Join (f . g)

instance Category cat => Monoid (Join cat a) where
  mempty  = Join id
  mappend = (<>)

This allows deriving Monoid (Kleisli m a a) and

newtype Endo a = Endo { appEndo :: Join (->) a }
  deriving 
    (Semigroup, Monoid)