Alfredo Di Napoli <[email protected]> wrote:

> Thanks Brent, this should do the trick, although what I was asking was
> something more general:
>
> For "explicitly pass" I meant passing them without the eta reduce, in
> other terms:
>
> swapA' :: (Arrow a) => a ((b,c), (b,c)) (c,b)
> swapA'  t = (????) swapFirst >>> swapSecond (???)
>   where
>     swapFirst  = first $ arr snd
>     swapSecond = second $ arr fst
>
>  where the question marks indicate that I don't know how to tell
> swapFirst "hey, even though from the outside
> I'm passing you a tuple *t*, you have to take as input a (t,t)."
>
> Hope this is clearer or it has some sense at all, maybe I'm not
> getting correctly the way arrows work!

Perhaps arrow notation (Arrows extension) is what you want:

    swapA' :: (Arrow a) => a ((b, c), (b, c)) (c, b)
    swapA' =
        proc ((_, x), (y, _)) -> id -< (x, y)

But I really don't understand why you're implementing this as an arrow
computation.  A simple function would do the trick, and should you
really want to use it in an arrow you can just lift it by applying
'arr'.


Greets,
Ertugrul

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to