
If I write a function like this: f (x1,y1) (x2,y2) = (x1++x2,y1++y2) My understanding of typeclasses is just developing, but I notice this is a bit like "lifting" (++) into a tuple. Maybe there is some existing typeclass and a 2-tuple is already an instance of it? Like arrow? D

On March 28, 2014 4:35:11 AM GMT+03:00, Dennis Raddle
If I write a function like this:
f (x1,y1) (x2,y2) = (x1++x2,y1++y2)
My understanding of typeclasses is just developing, but I notice this is a bit like "lifting" (++) into a tuple. Maybe there is some existing typeclass and a 2-tuple is already an instance of it? Like arrow?
D
------------------------------------------------------------------------
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
Indeed. The (->) instance of Arrow exposes all sorts of nice combinators, such as: (***) :: (a -> b) -> (c -> d) -> (a,c) -> (b,d) (&&&) :: (a -> b) -> (a -> c) -> a -> (b,c) (+++) :: (a -> b) -> (a' -> b') -> Either a a' -> Either b b' (|||) :: (a -> c) -> (b -> c) -> Either a b -> c
participants (2)
-
Dennis Raddle
-
Gesh