X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FTuple.hs;h=ea7191ae78ec65fd3eb24d589f8b000c6ae0e6e8;hb=26cb781c1a14407f01fc966a8cf9cde17d4faf0d;hp=f1fc78cd283735aa4d9fc8471c4a7c3314e36bb0;hpb=2302873c04a5267083745fbc8da9c704bee436b6;p=ghc-base.git diff --git a/Data/Tuple.hs b/Data/Tuple.hs index f1fc78c..ea7191a 100644 --- a/Data/Tuple.hs +++ b/Data/Tuple.hs @@ -1,49 +1,86 @@ {-# OPTIONS -fno-implicit-prelude #-} ----------------------------------------------------------------------------- --- +-- | -- Module : Data.Tuple -- Copyright : (c) The University of Glasgow 2001 --- License : BSD-style (see the file libraries/core/LICENSE) +-- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org -- Stability : experimental -- Portability : portable -- --- $Id: Tuple.hs,v 1.1 2001/07/03 11:38:07 simonmar Exp $ --- -- The tuple data types, and associated functions. -- ----------------------------------------------------------------------------- -module Data.Tuple ( - module Data.Tuple - -- tuples 1..37, - -- fst :: (a,b) -> a - -- snd :: (a,b) -> a - -- curry :: ((a, b) -> c) -> a -> b -> c - -- uncurry :: (a -> b -> c) -> ((a, b) -> c) - ) where +module Data.Tuple + ( fst -- :: (a,b) -> a + , snd -- :: (a,b) -> a + , curry -- :: ((a, b) -> c) -> a -> b -> c + , uncurry -- :: (a -> b -> c) -> ((a, b) -> c) +#ifdef __NHC__ + , (,)(..) + , (,,)(..) + , (,,,)(..) + , (,,,,)(..) + , (,,,,,)(..) + , (,,,,,,)(..) + , (,,,,,,,)(..) + , (,,,,,,,,)(..) + , (,,,,,,,,,)(..) + , (,,,,,,,,,,)(..) + , (,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,,,)(..) +#endif + ) + where #ifdef __GLASGOW_HASKELL__ import GHC.Base +#endif /* __GLASGOW_HASKELL__ */ -default () -- Double isn't available yet +#ifdef __NHC__ +import Prelude +import Prelude + ( (,)(..) + , (,,)(..) + , (,,,)(..) + , (,,,,)(..) + , (,,,,,)(..) + , (,,,,,,)(..) + , (,,,,,,,)(..) + , (,,,,,,,,)(..) + , (,,,,,,,,,)(..) + , (,,,,,,,,,,)(..) + , (,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,,,)(..) + -- nhc98's prelude only supplies tuple instances up to size 15 + , fst, snd + , curry, uncurry + ) #endif -data (,) a b = (,) a b deriving (Eq, Ord) +default () -- Double isn't available yet + +#ifdef __GLASGOW_HASKELL__ +data (,) a b = (,) a b deriving (Eq, Ord) data (,,) a b c = (,,) a b c deriving (Eq, Ord) data (,,,) a b c d = (,,,) a b c d deriving (Eq, Ord) data (,,,,) a b c d e = (,,,,) a b c d e deriving (Eq, Ord) -data (,,,,,) a b c d e f = (,,,,,) a b c d e f -data (,,,,,,) a b c d e f g = (,,,,,,) a b c d e f g -data (,,,,,,,) a b c d e f g h = (,,,,,,,) a b c d e f g h -data (,,,,,,,,) a b c d e f g h i = (,,,,,,,,) a b c d e f g h i -data (,,,,,,,,,) a b c d e f g h i j = (,,,,,,,,,) a b c d e f g h i j -data (,,,,,,,,,,) a b c d e f g h i j k = (,,,,,,,,,,) a b c d e f g h i j k -data (,,,,,,,,,,,) a b c d e f g h i j k l = (,,,,,,,,,,,) a b c d e f g h i j k l -data (,,,,,,,,,,,,) a b c d e f g h i j k l m = (,,,,,,,,,,,,) a b c d e f g h i j k l m -data (,,,,,,,,,,,,,) a b c d e f g h i j k l m n = (,,,,,,,,,,,,,) a b c d e f g h i j k l m n -data (,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o = (,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o +data (,,,,,) a b c d e f = (,,,,,) a b c d e f deriving (Eq, Ord) +data (,,,,,,) a b c d e f g = (,,,,,,) a b c d e f g deriving (Eq, Ord) +data (,,,,,,,) a b c d e f g h = (,,,,,,,) a b c d e f g h deriving (Eq, Ord) +data (,,,,,,,,) a b c d e f g h i = (,,,,,,,,) a b c d e f g h i deriving (Eq, Ord) +data (,,,,,,,,,) a b c d e f g h i j = (,,,,,,,,,) a b c d e f g h i j deriving (Eq, Ord) +data (,,,,,,,,,,) a b c d e f g h i j k = (,,,,,,,,,,) a b c d e f g h i j k deriving (Eq, Ord) +data (,,,,,,,,,,,) a b c d e f g h i j k l = (,,,,,,,,,,,) a b c d e f g h i j k l deriving (Eq, Ord) +data (,,,,,,,,,,,,) a b c d e f g h i j k l m = (,,,,,,,,,,,,) a b c d e f g h i j k l m deriving (Eq, Ord) +data (,,,,,,,,,,,,,) a b c d e f g h i j k l m n = (,,,,,,,,,,,,,) a b c d e f g h i j k l m n deriving (Eq, Ord) +data (,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o = (,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o deriving (Eq, Ord) data (,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p = (,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p data (,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q = (,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q @@ -215,10 +252,12 @@ data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__ k__ l__ m__ n__ o__ p__ q__ r__ s__ t__ u__ v__ w__ x__ y__ z__ a___ b___ c___ d___ e___ f___ g___ h___ i___ j___ k___ l___ m___ n___ o___ p___ q___ r___ s___ t___ u___ v___ = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__ k__ l__ m__ n__ o__ p__ q__ r__ s__ t__ u__ v__ w__ x__ y__ z__ a___ b___ c___ d___ e___ f___ g___ h___ i___ j___ k___ l___ m___ n___ o___ p___ q___ r___ s___ t___ u___ v___ -} +#endif /* __GLASGOW_HASKELL__ */ -- --------------------------------------------------------------------------- -- Standard functions over tuples +#if !defined(__HUGS__) && !defined(__NHC__) fst :: (a,b) -> a fst (x,_) = x @@ -232,4 +271,4 @@ 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__ */