summaryrefslogtreecommitdiff
path: root/libraries/base/Data
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/Data')
-rw-r--r--libraries/base/Data/Bits.hs21
-rw-r--r--libraries/base/Data/Bool.hs11
-rw-r--r--libraries/base/Data/Char.hs17
-rw-r--r--libraries/base/Data/Dynamic.hs4
-rw-r--r--libraries/base/Data/Fixed.hs26
-rw-r--r--libraries/base/Data/Foldable.hs6
-rw-r--r--libraries/base/Data/IORef.hs17
-rw-r--r--libraries/base/Data/Int.hs7
-rw-r--r--libraries/base/Data/Ix.hs4
-rw-r--r--libraries/base/Data/List.hs9
-rw-r--r--libraries/base/Data/Maybe.hs17
-rw-r--r--libraries/base/Data/OldTypeable.hs9
-rw-r--r--libraries/base/Data/OldTypeable/Internal.hs4
-rw-r--r--libraries/base/Data/Ratio.hs5
-rw-r--r--libraries/base/Data/String.hs2
-rw-r--r--libraries/base/Data/Traversable.hs2
-rw-r--r--libraries/base/Data/Tuple.hs43
-rw-r--r--libraries/base/Data/Typeable/Internal.hs4
-rw-r--r--libraries/base/Data/Version.hs4
-rw-r--r--libraries/base/Data/Word.hs6
20 files changed, 5 insertions, 213 deletions
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs
index 747a481e21..63e6b811c4 100644
--- a/libraries/base/Data/Bits.hs
+++ b/libraries/base/Data/Bits.hs
@@ -331,17 +331,7 @@ instance Bits Int where
bit = primBitInt
testBit = primTestInt
bitSize _ = SIZEOF_HSINT*8
-#elif defined(__NHC__)
- (.&.) = nhc_primIntAnd
- (.|.) = nhc_primIntOr
- xor = nhc_primIntXor
- complement = nhc_primIntCompl
- shiftL = nhc_primIntLsh
- shiftR = nhc_primIntRsh
- bit = bitDefault
- testBit = testBitDefault
- bitSize _ = 32
-#endif /* __NHC__ */
+#endif
x `rotate` i
| i<0 && x<0 = let left = i+bitSize x in
@@ -358,15 +348,6 @@ instance Bits Int where
instance FiniteBits Int where
finiteBitSize _ = WORD_SIZE_IN_BITS
-#ifdef __NHC__
-foreign import ccall nhc_primIntAnd :: Int -> Int -> Int
-foreign import ccall nhc_primIntOr :: Int -> Int -> Int
-foreign import ccall nhc_primIntXor :: Int -> Int -> Int
-foreign import ccall nhc_primIntLsh :: Int -> Int -> Int
-foreign import ccall nhc_primIntRsh :: Int -> Int -> Int
-foreign import ccall nhc_primIntCompl :: Int -> Int
-#endif /* __NHC__ */
-
#if defined(__GLASGOW_HASKELL__)
instance Bits Word where
{-# INLINE shift #-}
diff --git a/libraries/base/Data/Bool.hs b/libraries/base/Data/Bool.hs
index b60cad91b5..2f80c97167 100644
--- a/libraries/base/Data/Bool.hs
+++ b/libraries/base/Data/Bool.hs
@@ -29,14 +29,3 @@ module Data.Bool (
import GHC.Base
#endif
-#ifdef __NHC__
-import Prelude
-import Prelude
- ( Bool(..)
- , (&&)
- , (||)
- , not
- , otherwise
- )
-#endif
-
diff --git a/libraries/base/Data/Char.hs b/libraries/base/Data/Char.hs
index 56f6487371..abf4064100 100644
--- a/libraries/base/Data/Char.hs
+++ b/libraries/base/Data/Char.hs
@@ -69,15 +69,6 @@ import Hugs.Prelude (Ix)
import Hugs.Char
#endif
-#ifdef __NHC__
-import Prelude
-import Prelude(Char,String)
-import Char
-import Ix
-import NHC.FFI (CInt)
-foreign import ccall unsafe "WCsubst.h u_gencat" wgencat :: CInt -> CInt
-#endif
-
-- | Convert a single digit 'Char' to the corresponding 'Int'.
-- This function fails unless its argument satisfies 'isHexDigit',
-- but recognises both upper and lower-case hexadecimal digits
@@ -133,7 +124,7 @@ data GeneralCategory
-- | The Unicode general category of the character.
generalCategory :: Char -> GeneralCategory
-#if defined(__GLASGOW_HASKELL__) || defined(__NHC__)
+#if defined(__GLASGOW_HASKELL__)
generalCategory c = toEnum $ fromIntegral $ wgencat $ fromIntegral $ ord c
#endif
#ifdef __HUGS__
@@ -203,9 +194,3 @@ isSeparator c = case generalCategory c of
ParagraphSeparator -> True
_ -> False
-#ifdef __NHC__
--- dummy implementation
-toTitle :: Char -> Char
-toTitle = toUpper
-#endif
-
diff --git a/libraries/base/Data/Dynamic.hs b/libraries/base/Data/Dynamic.hs
index 03a34cf3c6..a3d331ed61 100644
--- a/libraries/base/Data/Dynamic.hs
+++ b/libraries/base/Data/Dynamic.hs
@@ -62,10 +62,6 @@ import Hugs.IORef
import Hugs.IOExts
#endif
-#ifdef __NHC__
-import NHC.IOExtras (IORef,newIORef,readIORef,writeIORef,unsafePerformIO)
-#endif
-
#include "Typeable.h"
-------------------------------------------------------------
diff --git a/libraries/base/Data/Fixed.hs b/libraries/base/Data/Fixed.hs
index fd0ca01513..6ea9bcdfbe 100644
--- a/libraries/base/Data/Fixed.hs
+++ b/libraries/base/Data/Fixed.hs
@@ -1,9 +1,7 @@
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, ScopedTypeVariables, PatternGuards #-}
{-# OPTIONS -Wall -fno-warn-unused-binds #-}
-#ifndef __NHC__
{-# LANGUAGE DeriveDataTypeable #-}
-#endif
-----------------------------------------------------------------------------
-- |
@@ -40,17 +38,13 @@ module Data.Fixed
) where
import Prelude -- necessary to get dependencies right
-#ifndef __NHC__
import Data.Typeable
import Data.Data
-#endif
import GHC.Read
import Text.ParserCombinators.ReadPrec
import Text.Read.Lex
-#ifndef __NHC__
default () -- avoid any defaulting shenanigans
-#endif
-- | generalisation of 'div' to any instance of Real
div' :: (Real a,Integral b) => a -> a -> b
@@ -68,13 +62,8 @@ mod' n d = n - (fromInteger f) * d where
-- | The type parameter should be an instance of 'HasResolution'.
newtype Fixed a = MkFixed Integer
-#ifndef __NHC__
deriving (Eq,Ord,Typeable)
-#else
- deriving (Eq,Ord)
-#endif
-#ifndef __NHC__
-- We do this because the automatically derived Data instance requires (Data a) context.
-- Our manual instance has the more general (Typeable a) context.
tyFixed :: DataType
@@ -86,7 +75,6 @@ instance (Typeable a) => Data (Fixed a) where
gunfold k z _ = k (z MkFixed)
dataTypeOf _ = tyFixed
toConstr _ = conMkFixed
-#endif
class HasResolution a where
resolution :: p a -> Integer
@@ -176,63 +164,49 @@ convertFixed (Number n)
convertFixed _ = pfail
data E0 = E0
-#ifndef __NHC__
deriving (Typeable)
-#endif
instance HasResolution E0 where
resolution _ = 1
-- | resolution of 1, this works the same as Integer
type Uni = Fixed E0
data E1 = E1
-#ifndef __NHC__
deriving (Typeable)
-#endif
instance HasResolution E1 where
resolution _ = 10
-- | resolution of 10^-1 = .1
type Deci = Fixed E1
data E2 = E2
-#ifndef __NHC__
deriving (Typeable)
-#endif
instance HasResolution E2 where
resolution _ = 100
-- | resolution of 10^-2 = .01, useful for many monetary currencies
type Centi = Fixed E2
data E3 = E3
-#ifndef __NHC__
deriving (Typeable)
-#endif
instance HasResolution E3 where
resolution _ = 1000
-- | resolution of 10^-3 = .001
type Milli = Fixed E3
data E6 = E6
-#ifndef __NHC__
deriving (Typeable)
-#endif
instance HasResolution E6 where
resolution _ = 1000000
-- | resolution of 10^-6 = .000001
type Micro = Fixed E6
data E9 = E9
-#ifndef __NHC__
deriving (Typeable)
-#endif
instance HasResolution E9 where
resolution _ = 1000000000
-- | resolution of 10^-9 = .000000001
type Nano = Fixed E9
data E12 = E12
-#ifndef __NHC__
deriving (Typeable)
-#endif
instance HasResolution E12 where
resolution _ = 1000000000000
-- | resolution of 10^-12 = .000000000001
diff --git a/libraries/base/Data/Foldable.hs b/libraries/base/Data/Foldable.hs
index 0f2319523d..86c8f1098d 100644
--- a/libraries/base/Data/Foldable.hs
+++ b/libraries/base/Data/Foldable.hs
@@ -68,10 +68,6 @@ import Control.Monad (MonadPlus(..))
import Data.Maybe (fromMaybe, listToMaybe)
import Data.Monoid
-#ifdef __NHC__
-import Control.Arrow (ArrowZero(..)) -- work around nhc98 typechecker problem
-#endif
-
#ifdef __GLASGOW_HASKELL__
import GHC.Exts (build)
#endif
@@ -80,8 +76,6 @@ import GHC.Exts (build)
import GHC.Arr
#elif defined(__HUGS__)
import Hugs.Array
-#elif defined(__NHC__)
-import Array
#endif
-- | Data structures that can be folded.
diff --git a/libraries/base/Data/IORef.hs b/libraries/base/Data/IORef.hs
index a66ce1bc0a..f1dcf97d76 100644
--- a/libraries/base/Data/IORef.hs
+++ b/libraries/base/Data/IORef.hs
@@ -51,16 +51,6 @@ import GHC.Weak
#endif
#endif /* __GLASGOW_HASKELL__ */
-#ifdef __NHC__
-import NHC.IOExtras
- ( IORef
- , newIORef
- , readIORef
- , writeIORef
- , excludeFinalisers
- )
-#endif
-
#if defined(__GLASGOW_HASKELL__) && !defined(__PARALLEL_HASKELL__)
-- |Make a 'Weak' pointer to an 'IORef', using the second argument as a finalizer
-- to run when 'IORef' is garbage-collected
@@ -120,13 +110,6 @@ atomicModifyIORef = plainModifyIORef -- Hugs has no preemption
where plainModifyIORef r f = do
a <- readIORef r
case f a of (a',b) -> writeIORef r a' >> return b
-#elif defined(__NHC__)
-atomicModifyIORef r f =
- excludeFinalisers $ do
- a <- readIORef r
- let (a',b) = f a
- writeIORef r a'
- return b
#endif
-- | Strict version of 'atomicModifyIORef'. This forces both the value stored
diff --git a/libraries/base/Data/Int.hs b/libraries/base/Data/Int.hs
index 084bb0ef05..874d47ec13 100644
--- a/libraries/base/Data/Int.hs
+++ b/libraries/base/Data/Int.hs
@@ -35,13 +35,6 @@ import GHC.Int ( Int8, Int16, Int32, Int64 )
import Hugs.Int ( Int8, Int16, Int32, Int64 )
#endif
-#ifdef __NHC__
-import Prelude
-import Prelude (Int)
-import NHC.FFI (Int8, Int16, Int32, Int64)
-import NHC.SizedTypes (Int8, Int16, Int32, Int64) -- instances of Bits
-#endif
-
{- $notes
* All arithmetic is performed modulo 2^n, where @n@ is the number of
diff --git a/libraries/base/Data/Ix.hs b/libraries/base/Data/Ix.hs
index 44fc4099ba..d916f29f50 100644
--- a/libraries/base/Data/Ix.hs
+++ b/libraries/base/Data/Ix.hs
@@ -72,7 +72,3 @@ import GHC.Arr
import Hugs.Prelude( Ix(..) )
#endif
-#ifdef __NHC__
-import Ix (Ix(..))
-#endif
-
diff --git a/libraries/base/Data/List.hs b/libraries/base/Data/List.hs
index 0049237aac..e7e8602cba 100644
--- a/libraries/base/Data/List.hs
+++ b/libraries/base/Data/List.hs
@@ -17,11 +17,6 @@
module Data.List
(
-#ifdef __NHC__
- [] (..)
- ,
-#endif
-
-- * Basic functions
(++)
@@ -210,10 +205,6 @@ module Data.List
) where
-#ifdef __NHC__
-import Prelude
-#endif
-
import Data.Maybe
import Data.Char ( isSpace )
diff --git a/libraries/base/Data/Maybe.hs b/libraries/base/Data/Maybe.hs
index 728c981755..a71c2d71b6 100644
--- a/libraries/base/Data/Maybe.hs
+++ b/libraries/base/Data/Maybe.hs
@@ -35,21 +35,6 @@ module Data.Maybe
import GHC.Base
#endif
-#ifdef __NHC__
-import Prelude
-import Prelude (Maybe(..), maybe)
-import Maybe
- ( isJust
- , isNothing
- , fromJust
- , fromMaybe
- , listToMaybe
- , maybeToList
- , catMaybes
- , mapMaybe
- )
-#else
-
#ifndef __HUGS__
-- ---------------------------------------------------------------------------
-- The Maybe type, and instances
@@ -146,5 +131,3 @@ mapMaybe f (x:xs) =
Nothing -> rs
Just r -> r:rs
-#endif /* else not __NHC__ */
-
diff --git a/libraries/base/Data/OldTypeable.hs b/libraries/base/Data/OldTypeable.hs
index 9c75623322..2d5f0d464d 100644
--- a/libraries/base/Data/OldTypeable.hs
+++ b/libraries/base/Data/OldTypeable.hs
@@ -119,15 +119,6 @@ import Hugs.IOArray
import Hugs.ConcBase ( MVar )
#endif
-#ifdef __NHC__
-import NHC.IOExtras (IOArray,IORef,newIORef,readIORef,writeIORef,unsafePerformIO)
-import IO (Handle)
-import Ratio (Ratio)
- -- For the Typeable instance
-import NHC.FFI ( Ptr,FunPtr,StablePtr,ForeignPtr )
-import Array ( Array )
-#endif
-
#include "OldTypeable.h"
{-# DEPRECATED typeRepKey "TypeRep itself is now an instance of Ord" #-}
diff --git a/libraries/base/Data/OldTypeable/Internal.hs b/libraries/base/Data/OldTypeable/Internal.hs
index 817dc4c68a..96bbf0ba62 100644
--- a/libraries/base/Data/OldTypeable/Internal.hs
+++ b/libraries/base/Data/OldTypeable/Internal.hs
@@ -508,14 +508,12 @@ INSTANCE_TYPEABLE2(STRef,stRefTc,"STRef")
INSTANCE_TYPEABLE3(STArray,sTArrayTc,"STArray")
#endif
-#ifndef __NHC__
INSTANCE_TYPEABLE2((,),pairTc,"(,)")
INSTANCE_TYPEABLE3((,,),tup3Tc,"(,,)")
INSTANCE_TYPEABLE4((,,,),tup4Tc,"(,,,)")
INSTANCE_TYPEABLE5((,,,,),tup5Tc,"(,,,,)")
INSTANCE_TYPEABLE6((,,,,,),tup6Tc,"(,,,,,)")
INSTANCE_TYPEABLE7((,,,,,,),tup7Tc,"(,,,,,,)")
-#endif /* __NHC__ */
INSTANCE_TYPEABLE1(Ptr,ptrTc,"Ptr")
INSTANCE_TYPEABLE1(FunPtr,funPtrTc,"FunPtr")
@@ -536,9 +534,7 @@ INSTANCE_TYPEABLE0(Char,charTc,"Char")
INSTANCE_TYPEABLE0(Float,floatTc,"Float")
INSTANCE_TYPEABLE0(Double,doubleTc,"Double")
INSTANCE_TYPEABLE0(Int,intTc,"Int")
-#ifndef __NHC__
INSTANCE_TYPEABLE0(Word,wordTc,"Word" )
-#endif
INSTANCE_TYPEABLE0(Integer,integerTc,"Integer")
INSTANCE_TYPEABLE0(Ordering,orderingTc,"Ordering")
#ifndef __GLASGOW_HASKELL__
diff --git a/libraries/base/Data/Ratio.hs b/libraries/base/Data/Ratio.hs
index a9f726e849..d17e0bce3f 100644
--- a/libraries/base/Data/Ratio.hs
+++ b/libraries/base/Data/Ratio.hs
@@ -35,10 +35,6 @@ import GHC.Real -- The basic defns for Ratio
import Hugs.Prelude(Ratio(..), (%), numerator, denominator)
#endif
-#ifdef __NHC__
-import Ratio (Ratio(..), (%), numerator, denominator, approxRational)
-#else
-
-- -----------------------------------------------------------------------------
-- approxRational
@@ -83,5 +79,4 @@ approxRational rat eps = simplest (rat-eps) (rat+eps)
nd'' = simplest' d' r' d r
n'' = numerator nd''
d'' = denominator nd''
-#endif
diff --git a/libraries/base/Data/String.hs b/libraries/base/Data/String.hs
index 0124f13ab0..391602eb96 100644
--- a/libraries/base/Data/String.hs
+++ b/libraries/base/Data/String.hs
@@ -37,8 +37,6 @@ import Data.List (lines, words, unlines, unwords)
class IsString a where
fromString :: String -> a
-#ifndef __NHC__
instance IsString [Char] where
fromString xs = xs
-#endif
diff --git a/libraries/base/Data/Traversable.hs b/libraries/base/Data/Traversable.hs
index 2ae49c63ae..f5ac06086b 100644
--- a/libraries/base/Data/Traversable.hs
+++ b/libraries/base/Data/Traversable.hs
@@ -61,8 +61,6 @@ import Data.Monoid (Monoid)
import GHC.Arr
#elif defined(__HUGS__)
import Hugs.Array
-#elif defined(__NHC__)
-import Array
#endif
-- | Functors representing data structures that can be traversed from
diff --git a/libraries/base/Data/Tuple.hs b/libraries/base/Data/Tuple.hs
index 12684c3ac4..6d7e2f7f6d 100644
--- a/libraries/base/Data/Tuple.hs
+++ b/libraries/base/Data/Tuple.hs
@@ -23,22 +23,6 @@ module Data.Tuple
, curry
, uncurry
, swap
-#ifdef __NHC__
- , (,)(..)
- , (,,)(..)
- , (,,,)(..)
- , (,,,,)(..)
- , (,,,,,)(..)
- , (,,,,,,)(..)
- , (,,,,,,,)(..)
- , (,,,,,,,,)(..)
- , (,,,,,,,,,)(..)
- , (,,,,,,,,,,)(..)
- , (,,,,,,,,,,,)(..)
- , (,,,,,,,,,,,,)(..)
- , (,,,,,,,,,,,,,)(..)
- , (,,,,,,,,,,,,,,)(..)
-#endif
)
where
@@ -58,35 +42,12 @@ import GHC.Tuple
#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
-- ---------------------------------------------------------------------------
-- Standard functions over tuples
-#if !defined(__HUGS__) && !defined(__NHC__)
+#if !defined(__HUGS__)
-- | Extract the first component of a pair.
fst :: (a,b) -> a
fst (x,_) = x
@@ -102,7 +63,7 @@ curry f x y = f (x, y)
-- | 'uncurry' converts a curried function to a function on pairs.
uncurry :: (a -> b -> c) -> ((a, b) -> c)
uncurry f p = f (fst p) (snd p)
-#endif /* neither __HUGS__ nor __NHC__ */
+#endif
-- | Swap the components of a pair.
swap :: (a,b) -> (b,a)
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 99ad0b667c..8749275554 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -324,14 +324,12 @@ INSTANCE_TYPEABLE2(STRef,stRefTc,"STRef")
INSTANCE_TYPEABLE3(STArray,sTArrayTc,"STArray")
#endif
-#ifndef __NHC__
INSTANCE_TYPEABLE2((,),pairTc,"(,)")
INSTANCE_TYPEABLE3((,,),tup3Tc,"(,,)")
INSTANCE_TYPEABLE4((,,,),tup4Tc,"(,,,)")
INSTANCE_TYPEABLE5((,,,,),tup5Tc,"(,,,,)")
INSTANCE_TYPEABLE6((,,,,,),tup6Tc,"(,,,,,)")
INSTANCE_TYPEABLE7((,,,,,,),tup7Tc,"(,,,,,,)")
-#endif /* __NHC__ */
INSTANCE_TYPEABLE1(Ptr,ptrTc,"Ptr")
INSTANCE_TYPEABLE1(FunPtr,funPtrTc,"FunPtr")
@@ -352,9 +350,7 @@ INSTANCE_TYPEABLE0(Char,charTc,"Char")
INSTANCE_TYPEABLE0(Float,floatTc,"Float")
INSTANCE_TYPEABLE0(Double,doubleTc,"Double")
INSTANCE_TYPEABLE0(Int,intTc,"Int")
-#ifndef __NHC__
INSTANCE_TYPEABLE0(Word,wordTc,"Word" )
-#endif
INSTANCE_TYPEABLE0(Integer,integerTc,"Integer")
INSTANCE_TYPEABLE0(Ordering,orderingTc,"Ordering")
#ifndef __GLASGOW_HASKELL__
diff --git a/libraries/base/Data/Version.hs b/libraries/base/Data/Version.hs
index b0dd92e9ae..02089317b3 100644
--- a/libraries/base/Data/Version.hs
+++ b/libraries/base/Data/Version.hs
@@ -40,7 +40,7 @@ import Prelude -- necessary to get dependencies right
-- of GHC. In which case, we might need to pick up ReadP from
-- Distribution.Compat.ReadP, because the version in
-- Text.ParserCombinators.ReadP doesn't have all the combinators we need.
-#if __GLASGOW_HASKELL__ || __HUGS__ || __NHC__
+#if __GLASGOW_HASKELL__ || __HUGS__
import Text.ParserCombinators.ReadP
#else
import Distribution.Compat.ReadP
@@ -137,8 +137,6 @@ showVersion (Version branch tags)
--
#if __GLASGOW_HASKELL__ || __HUGS__
parseVersion :: ReadP Version
-#elif __NHC__
-parseVersion :: ReadPN r Version
#else
parseVersion :: ReadP r Version
#endif
diff --git a/libraries/base/Data/Word.hs b/libraries/base/Data/Word.hs
index 84a4d0721c..39aa1a821d 100644
--- a/libraries/base/Data/Word.hs
+++ b/libraries/base/Data/Word.hs
@@ -35,12 +35,6 @@ import GHC.Word
import Hugs.Word
#endif
-#ifdef __NHC__
-import NHC.FFI (Word8, Word16, Word32, Word64)
-import NHC.SizedTypes (Word8, Word16, Word32, Word64) -- instances of Bits
-type Word = Word32
-#endif
-
{- $notes
* All arithmetic is performed modulo 2^n, where n is the number of