projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0fcdf0d
)
Add swap (#3298)
author
Simon Marlow
<marlowsd@gmail.com>
Tue, 4 May 2010 09:53:39 +0000
(09:53 +0000)
committer
Simon Marlow
<marlowsd@gmail.com>
Tue, 4 May 2010 09:53:39 +0000
(09:53 +0000)
Data/Tuple.hs
patch
|
blob
|
history
diff --git
a/Data/Tuple.hs
b/Data/Tuple.hs
index
89fb861
..
693b8d7
100644
(file)
--- 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)