git.iko.soy/semi-iso-optics
on master help sign in
Fix a subtle bug in the implementation of (+++) and (***) for dual categories.
689792ePaweł Nowak
Control/Category/Structures.hs+2−2
@@ -53,7 +53,7 @@ instance Monad m => Products (Kleisli m) where
53 (***) = (BadArrow.***)
53 (***) = (BadArrow.***)
54
54
55instance Products cat => Products (Dual cat) where
55instance Products cat => Products (Dual cat) where
56− Dual f *** Dual g = Dual $ f *** g
56+ Dual f *** Dual g = Dual $ second g >>> first f
57
57
58instance Products (->) where
58instance Products (->) where
59 (***) = (BadArrow.***)
59 (***) = (BadArrow.***)
@@ -83,7 +83,7 @@ instance Monad m => Coproducts (Kleisli m) where
83 (+++) = (BadArrow.+++)
83 (+++) = (BadArrow.+++)
84
84
85instance Coproducts cat => Coproducts (Dual cat) where
85instance Coproducts cat => Coproducts (Dual cat) where
86− Dual f +++ Dual g = Dual $ f +++ g
86+ Dual f +++ Dual g = Dual $ right g >>> left f
87
87
88instance Coproducts (->) where
88instance Coproducts (->) where
89 (+++) = (BadArrow.+++)
89 (+++) = (BadArrow.+++)