1{-# LANGUAGE CPP #-} 2{-# LANGUAGE FlexibleInstances #-} 3{-# LANGUAGE GADTs #-} 4#if __GLASGOW_HASKELL__ >= 706 5{-# LANGUAGE PolyKinds #-} 6#endif 7#if __GLASGOW_HASKELL__ >= 702 8{-# LANGUAGE Trustworthy #-} 9#endif 10----------------------------------------------------------------------------- 11-- | 12-- Copyright : (C) 2011-2015 Edward Kmett 13-- License : BSD-style (see the file LICENSE) 14-- 15-- Maintainer : Edward Kmett <ekmett@gmail.com> 16-- Stability : provisional 17-- Portability : polykinds 18-- 19---------------------------------------------------------------------------- 20 21module Data.Groupoid 22 ( Groupoid(..) 23 ) where 24 25import Data.Semigroupoid 26import Data.Semigroupoid.Dual 27 28#if MIN_VERSION_base(4,7,0) 29import qualified Data.Type.Coercion as Co 30import qualified Data.Type.Equality as Eq 31#endif 32 33-- | semigroupoid with inverses. This technically should be a category with inverses, except we need to use Ob to define the valid objects for the category 34class Semigroupoid k => Groupoid k where 35 inv :: k a b -> k b a 36 37instance Groupoid k => Groupoid (Dual k) where 38 inv (Dual k) = Dual (inv k) 39 40#if MIN_VERSION_base(4,7,0) 41instance Groupoid Co.Coercion where 42 inv = Co.sym 43 44instance Groupoid (Eq.:~:) where 45 inv = Eq.sym 46#endif 47 48#if MIN_VERSION_base(4,10,0) 49instance Groupoid (Eq.:~~:) where 50 inv Eq.HRefl = Eq.HRefl 51#endif 52