git.iko.soy/semi-iso-optics
on master help sign in
Implement Products and Coproducts for (->).
8a6f530Paweł Nowak
Control/Category/Structures.hs+6
@@ -50,6 +50,9 @@ class Category cat => Products cat where
50instance Monad m => Products (Kleisli m) where
50instance Monad m => Products (Kleisli m) where
51 (***) = (BadArrow.***)
51 (***) = (BadArrow.***)
52
52
53+instance Products (->) where
54+ (***) = (BadArrow.***)
55+
53-- | A category with finite coproducts.
56-- | A category with finite coproducts.
54class Category cat => Coproducts cat where
57class Category cat => Coproducts cat where
55 -- | Feed marked inputs through the argument arrow, passing the rest through unchanged to the output.
58 -- | Feed marked inputs through the argument arrow, passing the rest through unchanged to the output.
@@ -74,6 +77,9 @@ class Category cat => Coproducts cat where
74instance Monad m => Coproducts (Kleisli m) where
77instance Monad m => Coproducts (Kleisli m) where
75 (+++) = (BadArrow.+++)
78 (+++) = (BadArrow.+++)
76
79
80+instance Coproducts (->) where
81+ (+++) = (BadArrow.+++)
82+
77-- | A category @cat@ is a CatPlus when @cat a b@ is a monoid for all a, b.
83-- | A category @cat@ is a CatPlus when @cat a b@ is a monoid for all a, b.
78class Category cat => CatPlus cat where
84class Category cat => CatPlus cat where
79 -- | The identity of '/+/'.
85 -- | The identity of '/+/'.