arrows
Ashley Yakeley
ashley@semantic.org
Fri, 24 May 2002 15:55:00 -0700
At 2002-05-24 13:40, Wolfgang Jeltsch wrote:
>Now, I have a type which would fit wonderfully into the Arrow concept if
>arrows wouldn't be expected to have a first operator.
...then it's not an Arrow. It sounds like it might be one of these,
however:
class Compositor comp where
{
identity :: comp a a;
compose :: comp b c -> comp a b -> comp a c;
};
I'm not sure if 'Compositor' is a good name for it, or what.
>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
Can't you have a parser that reads in one token tuple, and apply another
parser to the first part of it only?
Otherwise, perhaps you could have classes like this:
class (Compositor arrow) => Semiarrow arrow where
{
arr :: (p -> q) -> arrow p q;
};
class (Semiarrow arrow) => Arrow arrow where
{
arrFirst :: arrow p q -> arrow (p,r) (q,r);
};
--
Ashley Yakeley, Seattle WA