1 {-# OPTIONS_GHC -XNoImplicitPrelude #-}
2 {-# OPTIONS_GHC -fno-warn-unused-imports #-}
3 -- XXX -fno-warn-unused-imports needed for the GHC.Tuple import below. Sigh.
4 -----------------------------------------------------------------------------
7 -- Copyright : (c) The University of Glasgow 2001
8 -- License : BSD-style (see the file libraries/base/LICENSE)
10 -- Maintainer : libraries@haskell.org
11 -- Stability : experimental
12 -- Portability : portable
14 -- The tuple data types, and associated functions.
16 -----------------------------------------------------------------------------
19 ( fst -- :: (a,b) -> a
20 , snd -- :: (a,b) -> a
21 , curry -- :: ((a, b) -> c) -> a -> b -> c
22 , uncurry -- :: (a -> b -> c) -> ((a, b) -> c)
32 , (,,,,,,,,,)(..)
33 , (,,,,,,,,,,)(..)
34 , (,,,,,,,,,,,)(..)
35 , (,,,,,,,,,,,,)(..)
36 , (,,,,,,,,,,,,,)(..)
37 , (,,,,,,,,,,,,,,)(..)
42 #ifdef __GLASGOW_HASKELL__
45 -- We need to depend on GHC.Base so that
46 -- a) so that we get GHC.Bool, GHC.Classes, GHC.Ordering
48 -- b) so that GHC.Base.inline is available, which is used
49 -- when expanding instance declarations
52 -- We must import GHC.Tuple, to ensure sure that the
53 -- data constructors of `(,)' are in scope when we do
54 -- the standalone deriving instance for Eq (a,b) etc
56 #endif /* __GLASGOW_HASKELL__ */
69 , (,,,,,,,,,)(..)
70 , (,,,,,,,,,,)(..)
71 , (,,,,,,,,,,,)(..)
72 , (,,,,,,,,,,,,)(..)
73 , (,,,,,,,,,,,,,)(..)
74 , (,,,,,,,,,,,,,,)(..)
75 -- nhc98's prelude only supplies tuple instances up to size 15
81 #ifdef __GLASGOW_HASKELL__
85 default () -- Double isn't available yet
87 -- ---------------------------------------------------------------------------
88 -- Standard functions over tuples
90 #if !defined(__HUGS__) && !defined(__NHC__)
91 -- | Extract the first component of a pair.
95 -- | Extract the second component of a pair.
99 -- | 'curry' converts an uncurried function to a curried function.
100 curry :: ((a, b) -> c) -> a -> b -> c
101 curry f x y = f (x, y)
103 -- | 'uncurry' converts a curried function to a function on pairs.
104 uncurry :: (a -> b -> c) -> ((a, b) -> c)
105 uncurry f p = f (fst p) (snd p)
106 #endif /* neither __HUGS__ nor __NHC__ */