1{-# LANGUAGE CPP #-}
2#if __GLASGOW_HASKELL__ >= 706
3{-# LANGUAGE PolyKinds #-}
4#endif
5-----------------------------------------------------------------------------
6-- |
7-- Copyright   :  (C) 2007-2015 Edward Kmett
8-- License     :  BSD-style (see the file LICENSE)
9--
10-- Maintainer  :  Edward Kmett <ekmett@gmail.com>
11-- Stability   :  provisional
12-- Portability :  portable
13--
14-- A semigroupoid satisfies all of the requirements to be a Category except
15-- for the existence of identity arrows.
16----------------------------------------------------------------------------
17module Data.Semigroupoid.Dual (Dual(..)) where
18
19import Data.Semigroupoid
20import Control.Category
21import Prelude ()
22
23newtype Dual k a b = Dual { getDual :: k b a }
24
25instance Semigroupoid k => Semigroupoid (Dual k) where
26  Dual f `o` Dual g = Dual (g `o` f)
27
28instance Category k => Category (Dual k) where
29  id = Dual id
30  Dual f . Dual g = Dual (g . f)
31