
3 Oct
2012
3 Oct
'12
4:41 a.m.
Hello everyone, sorry for the dumb question but I'm wrapping my head around arrow just from this morning. Consider this toy function to swap argument of a tuple: swapA' :: (Arrow a) => a ((b,c), (b,c)) (c,b) swapA' = swapFirst >>> swapSecond where swapFirst = first $ arr snd swapSecond = second $ arr fst It works but requires to pass a tuple of tuple, namely ((b,c), (b,c)). How can I explicitly pass my tuple of tuple to swapFirst so I can simply invoke swapA' (1,2) and get the correct result? ps. I know that swap can be easily and elegantly be written as: swap = snd &&& fst but the point of the exercise was to experiment with first, second and arrow concatenation Thanks in advance, Alfredo