projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use explicit language extensions & remove extension fields from base.cabal
[ghc-base.git]
/
Data
/
Tuple.hs
diff --git
a/Data/Tuple.hs
b/Data/Tuple.hs
index
89fb861
..
a5ea875
100644
(file)
--- a/
Data/Tuple.hs
+++ b/
Data/Tuple.hs
@@
-1,4
+1,4
@@
-{-# OPTIONS_GHC -XNoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- XXX -fno-warn-unused-imports needed for the GHC.Tuple import below. Sigh.
-----------------------------------------------------------------------------
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- XXX -fno-warn-unused-imports needed for the GHC.Tuple import below. Sigh.
-----------------------------------------------------------------------------
@@
-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)
, 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__
, (,)(..)
, (,,)(..)
#ifdef __NHC__
, (,)(..)
, (,,)(..)
@@
-43,13
+44,13
@@
module Data.Tuple
import GHC.Base
-- We need to depend on GHC.Base so that
import GHC.Base
-- We need to depend on GHC.Base so that
--- a) so that we get GHC.Bool, GHC.Classes, GHC.Ordering
+-- a) so that we get GHC.Classes, GHC.Ordering, GHC.Types
-- b) so that GHC.Base.inline is available, which is used
-- when expanding instance declarations
import GHC.Tuple
-- b) so that GHC.Base.inline is available, which is used
-- when expanding instance declarations
import GHC.Tuple
--- We must import GHC.Tuple, to ensure sure that the
+-- We must import GHC.Tuple, to ensure sure that the
-- data constructors of `(,)' are in scope when we do
-- the standalone deriving instance for Eq (a,b) etc
-- data constructors of `(,)' are in scope when we do
-- the standalone deriving instance for Eq (a,b) etc
@@
-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__ */
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)