Hello, in his paper "Generalising monads to arrows" John Hughes introduces an Arrow class with the members arr and (>>>) and extends this with a member first. The Arrow module by Ross Paterson adopts the practice of including first in the Arrow class. Now, I have a type which would fit wonderfully into the Arrow concept if arrows wouldn't be expected to have a first operator. To be precise, I have a type Parser of kind * -> * -> * with Parser a b being a parser which reads from a list of tokens of type a and produces a value of type b. Parser a is an instance of Monad and MonadPlus, thus providing sequencing, handling of alternatives and the like. Now I want to implement scanners via my parser type. A scanner shall simply be described by a parser which parses one higher-level token from a stream of lower-level tokens. I want to provide a function of type Parser a b -> Parser b c -> Parser a c which constructs a parser which reads a value of type c from a stream of type a tokens by repeatedly invoking the first argument parser to produce higher-level tokens which are then consumed by the second argument parser in order to produce the final output. Of course this function looks like a candidate for being (>>>) in a Parser arrow. And there is also a meaningful definition for pure (arr). pure f just has to be a parser which reads exactly one token, applies f to it and outputs the resulting value. The problem is that there seems to be no appropriate definition for first. That's why, in my opinion, it would be very good to have only the members pure (arr) and (>>>) in Arrow and to define a subclass which adds first, similar to ArrowChoice which adds left. This would have also the advantage that the handling of first, second, (***) and (&&&) on the one hand, and the handling of left, right, (+++) and (|||) on the other would be totally analogous. What do you think of this approach? Are there any of you who think that modifying the Arrow module this way would be a good idea? I'm waiting for your comments.
Wolfgang _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell