Question on declaring an instance

Consider the data type: Foo i o a = ... we want to declare an instance of Monad and Arrow for Foo without using a newtype (repackaging). The effect we want is to be able to construct an expression like: ( f>> g )>>> ( h>> i ) where f, g, h, i :: Foo i o a, for some i o a it is easy to declare instance Monad (Foo i o) where ... but how do we declare instance Arrow (Foo ... ), this instance takes a kind * -> * -> * it is easy to declare instance Arrow (Bar a) where ... where Bar a i o is a flipping of the order of the arguments to Foo i.e. Bar = ((flip . (flip .)) Foo Can Foo be declared an instance of both Arrow and Monad ? _________________________________________________________________ It's simple! Sell your car for just $30 at CarPoint.com.au http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT

On Mon, May 19, 2008 at 2:02 AM, john lask
Consider the data type:
Foo i o a = ...
we want to declare an instance of Monad and Arrow for Foo without using a newtype (repackaging). The effect we want is to be able to construct an expression like:
( f>> g )>>> ( h>> i )
where f, g, h, i :: Foo i o a, for some i o a
[...]
Can Foo be declared an instance of both Arrow and Monad ?
I think not. However, it's not unreasonable for data Foo i o To be both monad and arrow, since arrows are functors in their second argument. Luke
participants (2)
-
john lask
-
Luke Palmer