{-# 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 k1 j
f o :: forall (j :: k) (k1 :: k) (i :: k).
Dual k j k1 -> Dual k i j -> Dual k i k1
`o` Dual k j i
g = k k1 i -> Dual k i k1
forall {k} {k} (k :: k -> k -> *) (a :: k) (b :: k).
k b a -> Dual k a b
Dual (k j i
g k j i -> k k1 j -> k k1 i
forall (j :: k) (k1 :: k) (i :: k). k j k1 -> k i j -> k i k1
forall {k} (c :: k -> k -> *) (j :: k) (k1 :: k) (i :: k).
Semigroupoid c =>
c j k1 -> c i j -> c i k1
`o` k k1 j
f)
instance Category k => Category (Dual k) where
id :: forall (a :: k). Dual k a a
id = k a a -> Dual k a a
forall {k} {k} (k :: k -> k -> *) (a :: k) (b :: k).
k b a -> Dual k a b
Dual k a a
forall (a :: k). k a a
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 = k c a -> Dual k a c
forall {k} {k} (k :: k -> k -> *) (a :: k) (b :: k).
k b a -> Dual k a b
Dual (k b a
g k b a -> k c b -> k c a
forall (b :: k) (c :: k) (a :: k). k b c -> k a b -> k a c
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)