Fri, 27 Jun 2003 16:13:58 -0700
In article <firstname.lastname@example.org>,
Wolfgang Jeltsch <email@example.com> wrote:
> This brings me to another point. One year ago we had a discussion on The
> Haskell Mailing List concerning arrows. (The subject of the mails was just
> "arrows".) The point was that it seemed strange to me that first and second
> are included in the basic arrow class Arrow while left and right have their
> extra class ArrowChoice. Not only that it seemed strange to me but it made it
> impossible to make Parser baseMonad an instance of Arrow. Parser baseMonad
> has nice implementations of pure and (>>>) but none of first or second.
I agree. My own Arrow module hierarchy looks more or less like this:
class Compositor comp where
identity :: comp a a
compose :: comp b c -> comp a b -> comp a c
class (Compositor arrow) => Arrow arrow where
arrFunction :: (p -> q) -> arrow p q
-- | corresponds to Hughes\' \'Arrow\'
class (Arrow arrow) => ProductArrow arrow where
arrApply :: arrow p (q -> r) -> arrow p q -> arrow p r
arrProduct :: arrow p q -> arrow p r -> arrow p (q,r)
arrProduct = liftA2 (,)
class (Arrow arrow) => CoproductArrow arrow where
arrCoproduct :: arrow p r -> arrow q r -> arrow (Either p q) r
-- | corresponds to Hughes\' \'ArrowChoice\'
class (ProductArrow arrow,CoproductArrow arrow) => FullArrow arrow
instance (ProductArrow arrow,CoproductArrow arrow) => FullArrow arrow
class (Arrow arrow) => ArrowFix arrow where
arrFix :: arrow (p,q) q -> arrow p q
class (FullArrow arrow) => ApplyArrow arrow where
arrApplyArrow :: arrow (arrow p q,p) q
Note the symmetry between ProductArrow and CoproductArrow.
Base/Category/Arrow.hs?rev=HEAD&content-type=text/plain> for all the
Ashley Yakeley, Seattle WA