A newbie question about Arrows.

Ashley Yakeley ashley@semantic.org
Mon, 6 Jan 2003 15:09:42 -0800


At 2003-01-06 03:14, Ross Paterson wrote:

>class PreArrow ar where
>	arr :: (a -> b) -> ar a b
>	(>>>) :: ar a b -> ar b c -> ar a c
...
>	class (PreArrow ar, Monoidal p u) => GenArrow ar p u where
>		first :: ar a b -> ar (p a c) (p b c)

My own preference is something like this:

 	class (PreArrow ar) => GenArrow' ar where
	  	arrApply :: ar p (q -> r) -> ar p q -> ar p r

My GenArrow' is actually equivalent to Hughes' Arrow and I assume your 
GenArrow.

In an ideal world, I could leverage my FunctorApply class to have 
something like this:

 	class (Functor f) => FunctorApply f where
  		-- first arg (fab) "executed" first
	  	fApply :: f (a -> b) -> (f a -> f b)

    -- first arg (fa) "executed" first
    fPassTo :: f a -> f (a -> b) -> f b
    fPassTo fa fab = fApply (fmap (\a ab -> ab a) fa) fab

  class (PreArrow ar,forall p. FunctorApply (ar p)) => GenArrow'' ar

Unfortunately, GHC does not yet allow this kind of superclassing.

<http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/hbase/Source/HBa
se/Category/Functor.hs?rev=HEAD&content-type=text/plain>
<http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/hbase/Source/HBa
se/Category/Arrow.hs?rev=HEAD&content-type=text/plain>

-- 
Ashley Yakeley, Seattle WA