From: Simon Marlow Date: Tue, 4 May 2010 09:53:39 +0000 (+0000) Subject: Add swap (#3298) X-Git-Url: http://git.megacz.com/?p=ghc-base.git;a=commitdiff_plain;h=825c5c7be443f287a46c8212473e419f9106b9cf Add swap (#3298) --- diff --git a/Data/Tuple.hs b/Data/Tuple.hs index 89fb861..693b8d7 100644 --- a/Data/Tuple.hs +++ b/Data/Tuple.hs @@ -20,6 +20,7 @@ module Data.Tuple , snd -- :: (a,b) -> a , curry -- :: ((a, b) -> c) -> a -> b -> c , uncurry -- :: (a -> b -> c) -> ((a, b) -> c) + , swap -- :: (a,b) -> (b,a) #ifdef __NHC__ , (,)(..) , (,,)(..) @@ -104,3 +105,7 @@ curry f x y = f (x, y) uncurry :: (a -> b -> c) -> ((a, b) -> c) uncurry f p = f (fst p) (snd p) #endif /* neither __HUGS__ nor __NHC__ */ + +-- | Swap the components of a pair. +swap :: (a,b) -> (b,a) +swap (a,b) = (b,a)