@@ -28,6 +28,12 @@ Applicative (Morphism r) where
2828Monad (Morphism r) where
2929 (Mor h) >>= f = Mor $ \r => applyMor (f $ h r) r
3030
31+Semigroup a => Semigroup (Morphism r a) where
32+ f <+> g = [| f <+> g |]
33+
34+Monoid a => Monoid (Morphism r a) where
35+ neutral = Mor $ const neutral
36+
3137Semigroup (Endomorphism a) where
3238 (Endo f) <+> (Endo g) = Endo $ g . f
3339
@@ -44,6 +50,13 @@ Applicative f => Applicative (Kleislimorphism f a) where
4450Monad f => Monad (Kleislimorphism f a) where
4551 (Kleisli f) >>= g = Kleisli $ \r => applyKleisli (g !(f r)) r
4652
53+-- Applicative is a bit too strong, but there is no suitable superclass
54+(Semigroup a, Applicative f) => Semigroup (Kleislimorphism f r a) where
55+ f <+> g = [| f <+> g |]
56+
57+(Monoid a, Applicative f) => Monoid (Kleislimorphism f r a) where
58+ neutral = Kleisli $ const $ pure neutral
59+
4760Cast (Endomorphism a) (Morphism a a) where
4861 cast (Endo f) = Mor f
4962