+
+
+
+
+
+------------------------------------------------------------------------
+-- Type Families
+
+--
+-- The GArrow and GArrow{Copy,Drop,Swap} classes brandish their tensor
+-- and unit types; this is important because we might want to have
+-- both "instance GArrow g X Y" and "instance GArrow g Z Q" -- in
+-- fact, this is exactly how sums and pairs are defined.
+--
+-- However, in daily practice it's a pain to have all those extra type
+-- variables floating around. If you'd like to hide them, you can use
+-- the type families below to do so; see the definition of class
+-- GArrowSTKC for an example. Keep in mind, however, that any given
+-- type may only have a single instance declared using the type
+-- families.
+--
+
+type family GArrowTensor g :: * -> * -> * -- (**)
+type family GArrowUnit g :: * -- ()
+type family GArrowExponent g :: * -> * -> * -- (~>)
+
+
+
+
+------------------------------------------------------------------------
+-- Commonly Implemented Collections of Classes
+
+--
+-- The simply typed KAPPA calculus; see Hasegawa, __Decomposing Typed
+-- Lambda Calculus into a Couple of Categorical Programming
+-- Languages__, http://dx.doi.org/10.1007/3-540-60164-3_28
+--
+
+class (GArrowDrop g (GArrowTensor g) (GArrowUnit g),
+ GArrowCopy g (GArrowTensor g) (GArrowUnit g),
+ GArrowSwap g (GArrowTensor g) (GArrowUnit g)) =>
+ GArrowSTKC g
+
+class (GArrowDrop g (GArrowTensor g) (GArrowUnit g),
+ GArrowCopy g (GArrowTensor g) (GArrowUnit g),
+ GArrowSwap g (GArrowTensor g) (GArrowUnit g),
+ GArrowLoop g (GArrowTensor g) (GArrowUnit g)) =>
+ GArrowSTKCL g
+
+-- The simply typed LAMBDA calculus
+class (GArrowDrop g (GArrowTensor g) (GArrowUnit g),
+ GArrowCopy g (GArrowTensor g) (GArrowUnit g),
+ GArrowSwap g (GArrowTensor g) (GArrowUnit g),
+ GArrowCurry g (GArrowTensor g) (GArrowUnit g) (GArrowExponent g),
+ GArrowApply g (GArrowTensor g) (GArrowUnit g) (GArrowExponent g)
+ ) =>
+ GArrowSTLC g
+
+-- Programming Language for Computable Functions (w/o integers and booleans)
+class (GArrowDrop g (GArrowTensor g) (GArrowUnit g),
+ GArrowCopy g (GArrowTensor g) (GArrowUnit g),
+ GArrowSwap g (GArrowTensor g) (GArrowUnit g),
+ GArrowCurry g (GArrowTensor g) (GArrowUnit g) (GArrowExponent g),
+ GArrowApply g (GArrowTensor g) (GArrowUnit g) (GArrowExponent g),
+ GArrowLoop g (GArrowTensor g) (GArrowUnit g)
+ ) =>
+ GArrowPCF g (**) u (~>)
+
+
+
+
+
+------------------------------------------------------------------------
+-- Experimental, Not Yet Exported
+
+-- See Lindley, Wadler, and Yallop '08 -- except that here ga_force
+-- is primitive since there is no "arr" to define it in terms of.
+class GArrow g (**) u => GArrowStatic g (**) u (~>) where
+ ga_delay :: g a b -> g u (a~>b)
+ ga_force :: g u (a~>b) -> g a b
+ -- "ga_static/force_delay" forall a . force (delay a) = a
+ -- "ga_static/delay_force" forall a . delay (force a) = a
+