X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FTuple.hs;h=ea7191ae78ec65fd3eb24d589f8b000c6ae0e6e8;hb=950ea620c19650754db3ae6058be71f0cdb89bb5;hp=6c096bb1ab101f02e182c2516e5a703c3f9665b7;hpb=2b09d1369ead1a675a916a3c928e0b72c169c3fe;p=ghc-base.git diff --git a/Data/Tuple.hs b/Data/Tuple.hs index 6c096bb..ea7191a 100644 --- a/Data/Tuple.hs +++ b/Data/Tuple.hs @@ -13,20 +13,60 @@ -- ----------------------------------------------------------------------------- -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__ */ + +#ifdef __NHC__ +import Prelude +import Prelude + ( (,)(..) + , (,,)(..) + , (,,,)(..) + , (,,,,)(..) + , (,,,,,)(..) + , (,,,,,,)(..) + , (,,,,,,,)(..) + , (,,,,,,,,)(..) + , (,,,,,,,,,)(..) + , (,,,,,,,,,,)(..) + , (,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,,)(..) + , (,,,,,,,,,,,,,,)(..) + -- nhc98's prelude only supplies tuple instances up to size 15 + , fst, snd + , curry, uncurry + ) +#endif 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) @@ -217,7 +257,7 @@ data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -- --------------------------------------------------------------------------- -- Standard functions over tuples -#ifndef __HUGS__ +#if !defined(__HUGS__) && !defined(__NHC__) fst :: (a,b) -> a fst (x,_) = x @@ -231,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 /* __HUGS__ */ +#endif /* neither __HUGS__ nor __NHC__ */