{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE Safe #-}
module Data.Semigroupoid.Dual (Dual(..)) where
import Data.Semigroupoid
import Control.Category
import Prelude ()
newtype Dual k a b = Dual { forall {k} {k} (k :: k -> k -> *) (a :: k) (b :: k).
Dual k a b -> k b a
getDual :: k b a }
instance Semigroupoid k => Semigroupoid (Dual k) where
Dual k k j
f o :: forall (j :: k) (k :: k) (i :: k).
Dual k j k -> Dual k i j -> Dual k i k
`o` Dual k j i
g = forall {k} {k} (k :: k -> k -> *) (a :: k) (b :: k).
k b a -> Dual k a b
Dual (k j i
g forall {k} (c :: k -> k -> *) (j :: k) (k :: k) (i :: k).
Semigroupoid c =>
c j k -> c i j -> c i k
`o` k k j
f)
instance Category k => Category (Dual k) where
id :: forall (a :: k). Dual k a a
id = forall {k} {k} (k :: k -> k -> *) (a :: k) (b :: k).
k b a -> Dual k a b
Dual forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
Dual k c b
f . :: forall (b :: k) (c :: k) (a :: k).
Dual k b c -> Dual k a b -> Dual k a c
. Dual k b a
g = forall {k} {k} (k :: k -> k -> *) (a :: k) (b :: k).
k b a -> Dual k a b
Dual (k b a
g forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. k c b
f)