arrows

Wolfgang Jeltsch wolfgang@jeltsch.net
07 Jun 2002 15:18:22 +0200


At 2002-06-04 06:39 CEST Ashley Yakeley wrote:
> [...]
> 1. Should I add your intermediate class? Do you have examples of 
> something that has 'pure' but not 'first'?

Of course! My Parser type. As I wrote earlier I cannot see a meaningful
definition of first for it. You may also try to find a definition for
(&&&) and see that there is not a meaningful one. (&&&) for Parser would
have the type Parser t v -> Parser t v' -> Parser t (v,v'). The first
argument would read some tokens of type t in order to produce a result
of type v; the second argument would possibly read a different number of
tokens to produce a result of type v'. How many tokens should the result
parser read?

> 2. What are the best names? I used 'Arrow' because it's for "arrows" as 
> defined by John Hughes <http://haskell.cs.yale.edu/arrows/>. I might 
> change 'Compositor' to 'Morphism' if it makes more sense to people.

I think, Morphism would be a good name for your Compositor class.
Because I feel the need for a arrow class with pure but without first, I
would create a subclass of Morphism which introduces pure and call this
class Arrow. Further on, I would exclude first from ArrowChoice by
making ArrowChoice a subclass of my Arrow class and letting it introduce
only left, right, (+++) and (|||). In a similar way I would exclude
first from every other arrow class that doesn't need it. I would create
a class ArrowCombine being a subclass of my Arrow class and introducing
first, second, (***) and (&&&).
Because the relation between ArrowCombine and Arrow would be very, very
similar to the relation between ArrowChoice and Arrow, I think it's bad
to name the class, which introduces first, just Arrow. Instead, I think,
its name should be similar to ArrowChoice. That's why I'd name it
ArrowCombine and take the name Arrow for the class without first.

> [...]

Wolfgang