@@ -80,13 +80,20 @@ instance Strong Either Void LinearArrow where
80
80
first (LA f) = LA $ either (Left . f) Right
81
81
second (LA g) = LA $ either Left (Right . g)
82
82
83
+ instance Monoidal (,) () LinearArrow where
84
+ LA f *** LA g = LA $ \ (a,x) -> (f a, g x)
85
+ unit = LA id
86
+
83
87
instance Profunctor (-> ) where
84
88
dimap f g h x = g (h (f x))
85
89
instance Strong (,) () (-> ) where
86
90
first f (x, y) = (f x, y)
87
91
instance Strong Either Void (-> ) where
88
92
first f (Left x) = Left (f x)
89
93
first _ (Right y) = Right y
94
+ instance Monoidal (,) () (-> ) where
95
+ (f *** g) (a,x) = (f a, g x)
96
+ unit () = ()
90
97
91
98
data Exchange a b s t = Exchange (s #-> a ) (b #-> t )
92
99
instance Profunctor (Exchange a b ) where
@@ -104,6 +111,10 @@ instance Prelude.Applicative f => Strong Either Void (Kleisli f) where
104
111
Left x -> Prelude. fmap Left (f x)
105
112
Right y -> Prelude. pure (Right y)
106
113
114
+ instance Prelude. Applicative f => Monoidal (,) () (Kleisli f ) where
115
+ Kleisli f *** Kleisli g = Kleisli (\ (x,y) -> (,) Prelude. <$> f x Prelude. <*> g y)
116
+ unit = Kleisli Prelude. pure
117
+
107
118
data Market a b s t = Market (b #-> t ) (s #-> Either t a )
108
119
runMarket :: Market a b s t #-> (b #-> t , s #-> Either t a )
109
120
runMarket (Market f g) = (f, g)
0 commit comments