-- |
-- Convert bijections to and from semigroupoids 'S.Iso'.
module Data.Invertible.Semigroupoid
  ( toIso
  , fromIso
  ) where

import Data.Invertible.Bijection
import qualified Data.Isomorphism as S

-- |Convert a bijection to a semigroupoid isomorphism.
toIso :: Bijection a b c -> S.Iso a b c
toIso :: forall (a :: * -> * -> *) b c. Bijection a b c -> Iso a b c
toIso (a b c
f :<->: a c b
g) = a b c -> a c b -> Iso a b c
forall {k} (k1 :: k -> k -> *) (a :: k) (b :: k).
k1 a b -> k1 b a -> Iso k1 a b
S.Iso a b c
f a c b
g

-- |Convert a semigroupoid isomorphism to a bijection.
fromIso :: S.Iso a b c -> Bijection a b c
fromIso :: forall (a :: * -> * -> *) b c. Iso a b c -> Bijection a b c
fromIso (S.Iso a b c
f a c b
g) = a b c
f a b c -> a c b -> Bijection a b c
forall (a :: * -> * -> *) b c. a b c -> a c b -> Bijection a b c
:<->: a c b
g