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