Data/Tuple.hs (original) (raw)

module Data.Tuple ( fst
, snd
, curry
, uncurry
, swap
#ifdef NHC , (,)(..) , (,,)(..) , (,,,)(..) , (,,,,)(..) , (,,,,,)(..) , (,,,,,,)(..) , (,,,,,,,)(..) , (,,,,,,,,)(..) , (,,,,,,,,,)(..) , (,,,,,,,,,,)(..) , (,,,,,,,,,,,)(..) , (,,,,,,,,,,,,)(..) , (,,,,,,,,,,,,,)(..) , (,,,,,,,,,,,,,,)(..) #endif ) where

#ifdef GLASGOW_HASKELL

import GHC.Base

import GHC.Tuple

#endif /* GLASGOW_HASKELL */

#ifdef NHC import Prelude import Prelude ( (,)(..) , (,,)(..) , (,,,)(..) , (,,,,)(..) , (,,,,,)(..) , (,,,,,,)(..) , (,,,,,,,)(..) , (,,,,,,,,)(..) , (,,,,,,,,,)(..) , (,,,,,,,,,,)(..) , (,,,,,,,,,,,)(..) , (,,,,,,,,,,,,)(..) , (,,,,,,,,,,,,,)(..) , (,,,,,,,,,,,,,,)(..)

, fst, snd , curry, uncurry ) #endif

default ()

#if !defined(HUGS) && !defined(NHC)

fst :: (a,b) -> a fst (x,_) = x

snd :: (a,b) -> b snd (_,y) = y

curry :: ((a, b) -> c) -> a -> b -> c 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 :: (a,b) -> (b,a) swap (a,b) = (b,a)