@@ -42,6 +42,8 @@ infixr 0 <.>
4242 m x' x ->
4343 m x' y'
4444b <.> p = (p >>^ morphed) >>^ si b
45+ where
46+ si p' = withPrism p' $ \x y -> SemiIso (pure . x) (either (const empty) pure . y)
4547
4648coercing :: forall b a. Coercible a b => SemiIso a b
4749coercing = siPure coerce coerce
@@ -50,15 +52,6 @@ morphed ::
5052 (TupleMorphable a c, TupleMorphable b c) => SemiIso a b
5153morphed = siPure morphTuples morphTuples
5254
53−class ToSemiIso x a b | x -> a b where
54− si :: x -> SemiIso a b
55−
56−instance ToSemiIso (Market a a a (Identity a) -> Market a a b (Identity b)) a b where
57− si p = withPrism p $ \x y -> SemiIso (pure . x) (either (const empty) pure . y)
58−
59−instance ToSemiIso (SemiIso a b) a b where
60− si = id
61−
6255mapIso :: (PolyArrow m SemiIso, Ord a, Ord b) => [(a, b)] -> m a b
6356mapIso m = arr $ siMaybe (`M.lookup` n) (`M.lookup` u)
6457 where