1 {-# OPTIONS -XRankNTypes -XMultiParamTypeClasses -XNoMonomorphismRestriction -XTypeOperators -XFlexibleInstances #-}
2 -----------------------------------------------------------------------------
4 -- Module : GHC.HetMet.GArrow
6 -- License : public domain
8 -- Maintainer : Adam Megacz <megacz@acm.org>
9 -- Stability : experimental
10 -- Portability : portable
12 module GHC.HetMet.GArrow (
23 class GArrow g (**) where
25 ga_comp :: g x y -> g y z -> g x z
26 ga_first :: g x y -> g (x ** z) (y ** z)
27 ga_second :: g x y -> g (z ** x) (z ** y)
28 ga_cancell :: g (()**x) x
29 ga_cancelr :: g (x**()) x
30 ga_uncancell :: g x (()**x)
31 ga_uncancelr :: g x (x**())
32 ga_assoc :: g ((x**y)**z) (x**(y**z))
33 ga_unassoc :: g (x**(y**z)) ((x**y)**z)
35 class GArrow g (**) => GArrowDrop g (**) where
38 class GArrow g (**) => GArrowCopy g (**) where
41 class GArrow g (**) => GArrowSwap g (**) where
42 ga_swap :: g (x**y) (y**x)
44 -- implementation of ga_second for GArrowSwap instances
45 ga_swap_second f = ga_comp (ga_comp ga_swap (ga_first f)) ga_swap
47 class GArrow g (**) => GArrowLoop g (**) where
48 ga_loop :: g (x**z) (y**z) -> g x y
50 class GArrow g (**) => GArrowLiteral g (**) a where
51 ga_literal :: a -> g () a
53 -- not sure -- subject to change
54 class GArrow g (**) => GArrowReify g (**) where
55 ga_reify :: (x -> y) -> g x y
57 -- not sure -- subject to change
58 class GArrow g (**) => GArrowReflect g (**) where
59 ga_reflect :: g x y -> (x -> y)