Hello,
I read some of the material about Arrows on www.haskell.org/arrows and
I have some questions :
* Why is made the choice to use (,) as Cartesian in first?
Can't we write something like :
class Cartesian p where
pair :: a -> b -> (p a b)
projLeft :: (p a b) -> a
projRight :: (p a b) -> b
class Cartesian pair => Arrow ar where
arr ::( ar pair a b) -> (ar pair a b)
(>>>) :: (ar pair a b) -> (ar pair b c) -> (ar pair a c)
first :: (ar pair a b) -> (ar (pair a d) (pair b d))
(The same could be said for ArrowChoice)
I think this could be more powerful and could allow a smarter
management of inputs and outputs of arrows than tuples.
I think for example to event-driven arrows : we could make a pair of
inputs without mixing the "event happened" information.
* Why is made the choice of first as being a base function?
We have
first f = f *** (arr id)
second f = (arr id) *** f
So they could be define from (***).
Moreover, the definition of f *** with first and second creates an
order in the use of the f and g (first f >>> second g) whereas it seems
that (***) is a "parallel" operator.
In an event-driven arrow we have to give the same events to f and g
even if they are independent.
Best regards,
Nicolas Oury
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
- Re: A newbie question about Arrows. Nicolas Oury
- Re: A newbie question about Arrows. Ross Paterson
- Re: A newbie question about Arrows. Shawn P. Garbett
- Re: A newbie question about Arrows. Ross Paterson
- Re: A newbie question about Arrows. Magnus Carlsson
- Re: A newbie question about Arrows. Ashley Yakeley
- New to haskell and Functional Programming kunphuzil
- Re: A newbie question about Arrows. Nicolas.Oury
- Re: A newbie question about Arrows. Ross Paterson
- Re: A newbie question about Arrows. Ashley Yakeley