Commit ccbe2b8b authored by Simon Peyton Jones's avatar Simon Peyton Jones

Revert "32-bit performance wibbles"

This reverts commit 387f1d1e.

Bizarrely, this commit accidentally added libraries/haskell98.
So I'll revert it entirely and start again.
parent 8a29493d
GNUmakefile
dist-install
ghc.mk
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 709
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Trustworthy #-}
#endif
module Array (
module Ix, -- export all of Ix for convenience
Array, array, listArray, (!), bounds, indices, elems, assocs,
accumArray, (//), accum, ixmap
) where
import Ix
import Data.Array
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Bits (module Data.Bits) where
import Data.Bits
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module CError (module Foreign.C.Error) where
import Foreign.C.Error
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module CForeign (module Foreign.C) where
import Foreign.C
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module CPUTime (
getCPUTime, cpuTimePrecision
) where
import System.CPUTime
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module CString (module Foreign.C.String) where
import Foreign.C.String
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module CTypes (module Foreign.C.Types) where
import Foreign.C.Types
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Char (
isAscii, isLatin1, isControl, isPrint, isSpace, isUpper, isLower,
isAlpha, isDigit, isOctDigit, isHexDigit, isAlphaNum,
digitToInt, intToDigit,
toUpper, toLower,
ord, chr,
readLitChar, showLitChar, lexLitChar,
-- ...and what the Prelude exports
Char, String
) where
import Data.Char
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Complex (
Complex((:+)), realPart, imagPart, conjugate,
mkPolar, cis, polar, magnitude, phase
) where
import Data.Complex
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 709
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Trustworthy #-}
#endif
module Directory (
Permissions( Permissions, readable, writable, executable, searchable ),
createDirectory, removeDirectory, removeFile,
renameDirectory, renameFile, getDirectoryContents,
getCurrentDirectory, setCurrentDirectory,
doesFileExist, doesDirectoryExist,
getPermissions, setPermissions,
getModificationTime
) where
import System.Directory hiding (Permissions,
readable, writable, executable, searchable,
getPermissions, setPermissions)
import qualified System.Directory as SD
data Permissions = Permissions {
readable :: Bool,
writable :: Bool,
executable :: Bool,
searchable :: Bool
}
deriving (Eq, Ord, Read, Show)
getPermissions :: FilePath -> IO Permissions
getPermissions fp = do perm <- SD.getPermissions fp
return $ Permissions {
readable = SD.readable perm,
writable = SD.writable perm,
executable = SD.executable perm,
searchable = SD.searchable perm
}
setPermissions :: FilePath -> Permissions -> IO ()
setPermissions fp perm = let mkPerm = setOwnerReadable (readable perm)
. setOwnerWritable (writable perm)
. setOwnerExecutable (executable perm)
. setOwnerSearchable (searchable perm)
in SD.setPermissions fp (mkPerm emptyPermissions)
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Trustworthy #-}
#endif
module ForeignPtr (module Foreign.ForeignPtr) where
import Foreign.ForeignPtr
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module IO (
Handle, HandlePosn,
IOMode(ReadMode,WriteMode,AppendMode,ReadWriteMode),
BufferMode(NoBuffering,LineBuffering,BlockBuffering),
SeekMode(AbsoluteSeek,RelativeSeek,SeekFromEnd),
stdin, stdout, stderr,
openFile, hClose, hFileSize, hIsEOF, isEOF,
hSetBuffering, hGetBuffering, hFlush,
hGetPosn, hSetPosn, hSeek,
hWaitForInput, hReady, hGetChar, hGetLine, hLookAhead, hGetContents,
hPutChar, hPutStr, hPutStrLn, hPrint,
hIsOpen, hIsClosed, hIsReadable, hIsWritable, hIsSeekable,
isAlreadyExistsError, isDoesNotExistError, isAlreadyInUseError,
isFullError, isEOFError,
isIllegalOperation, isPermissionError, isUserError,
ioeGetErrorString, ioeGetHandle, ioeGetFileName,
try, bracket, bracket_,
-- ...and what the Prelude exports
IO, FilePath, IOError, ioError, userError, catch, interact,
putChar, putStr, putStrLn, print, getChar, getLine, getContents,
readFile, writeFile, appendFile, readIO, readLn
) where
import System.IO
import System.IO.Error
-- | The 'bracket' function captures a common allocate, compute, deallocate
-- idiom in which the deallocation step must occur even in the case of an
-- error during computation. This is similar to try-catch-finally in Java.
--
-- This version handles only IO errors, as defined by Haskell 98.
-- The version of @bracket@ in "Control.Exception" handles all exceptions,
-- and should be used instead.
bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket before after m = do
x <- before
rs <- try (m x)
_ <- after x
case rs of
Right r -> return r
Left e -> ioError e
-- | A variant of 'bracket' where the middle computation doesn't want @x@.
--
-- This version handles only IO errors, as defined by Haskell 98.
-- The version of @bracket_@ in "Control.Exception" handles all exceptions,
-- and should be used instead.
bracket_ :: IO a -> (a -> IO b) -> IO c -> IO c
bracket_ before after m = do
x <- before
rs <- try m
_ <- after x
case rs of
Right r -> return r
Left e -> ioError e
-- | The construct 'try' @comp@ exposes IO errors which occur within a
-- computation, and which are not fully handled.
--
-- Non-I\/O exceptions are not caught by this variant; to catch all
-- exceptions, use 'Control.Exception.try' from "Control.Exception".
try :: IO a -> IO (Either IOError a)
try f = catch (do r <- f
return (Right r))
(return . Left)
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Int (module Data.Int) where
import Data.Int
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Ix (
Ix(range, index, inRange), rangeSize
) where
import Data.Ix
Code derived from the document "Report on the Programming Language
Haskell 98", is distributed under the following license:
Copyright (c) 2002 Simon Peyton Jones
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
including this Notice. Modified versions of this Report may also be
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Language.
-----------------------------------------------------------------------------
Code derived from the document "The Haskell 98 Foreign Function
Interface, An Addendum to the Haskell 98 Report" is distributed under
the following license:
Copyright (c) 2002 Manuel M. T. Chakravarty
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
including this Notice. Modified versions of this Report may also be
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Foreign Function Interface.
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module List (
elemIndex, elemIndices,
find, findIndex, findIndices,
nub, nubBy, delete, deleteBy, (\\), deleteFirstsBy,
union, unionBy, intersect, intersectBy,
intersperse, transpose, partition, group, groupBy,
inits, tails, isPrefixOf, isSuffixOf,
mapAccumL, mapAccumR,
sort, sortBy, insert, insertBy, maximumBy, minimumBy,
genericLength, genericTake, genericDrop,
genericSplitAt, genericIndex, genericReplicate,
zip4, zip5, zip6, zip7,
zipWith4, zipWith5, zipWith6, zipWith7,
unzip4, unzip5, unzip6, unzip7, unfoldr,
-- ...and what the Prelude exports
-- []((:), []), -- This is built-in syntax
map, (++), concat, filter,
head, last, tail, init, null, length, (!!),
foldl, foldl1, scanl, scanl1, foldr, foldr1, scanr, scanr1,
iterate, repeat, replicate, cycle,
take, drop, splitAt, takeWhile, dropWhile, span, break,
lines, words, unlines, unwords, reverse, and, or,
any, all, elem, notElem, lookup,
sum, product, maximum, minimum, concatMap,
zip, zip3, zipWith, zipWith3, unzip, unzip3
) where
import Data.OldList hiding (foldl', splitAt)
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 709
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Trustworthy #-}
#endif
module Locale (
TimeLocale(..), defaultTimeLocale
) where
import System.Locale (
-- just the bits that are specified by Haskell 98
TimeLocale(TimeLocale,wDays,months,amPm,dateTimeFmt,
dateFmt,timeFmt,time12Fmt),
defaultTimeLocale
)
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module MarshalAlloc (module Foreign.Marshal.Alloc) where
import Foreign.Marshal.Alloc
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module MarshalArray (module Foreign.Marshal.Array) where
import Foreign.Marshal.Array
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module MarshalError (
module Foreign.Marshal.Error,
IOErrorType,
mkIOError,
alreadyExistsErrorType,
doesNotExistErrorType,
alreadyInUseErrorType,
fullErrorType,
eofErrorType,
illegalOperationErrorType,
permissionErrorType,
userErrorType,
annotateIOError
) where
import System.IO.Error
import Foreign.Marshal.Error
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module MarshalUtils (module Foreign.Marshal.Utils) where
import Foreign.Marshal.Utils
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Maybe (
isJust, isNothing,
fromJust, fromMaybe, listToMaybe, maybeToList,
catMaybes, mapMaybe,
-- ...and what the Prelude exports
Maybe(Nothing, Just),
maybe
) where
import Data.Maybe
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Monad (
MonadPlus(mzero, mplus),
join, guard, when, unless, ap,
msum,
filterM, mapAndUnzipM, zipWithM, zipWithM_, foldM,
liftM, liftM2, liftM3, liftM4, liftM5,
-- ...and what the Prelude exports
Monad((>>=), (>>), return, fail),
Functor(fmap),
mapM, mapM_, sequence, sequence_, (=<<),
) where
import Control.Monad
{-# LANGUAGE CPP, PackageImports #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Safe #-}
#endif
module Numeric (
-- * Showing
showSigned, -- :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
showIntAtBase, -- :: Integral a => a -> (a -> Char) -> a -> ShowS
showInt, -- :: Integral a => a -> ShowS
showHex, -- :: Integral a => a -> ShowS
showOct, -- :: Integral a => a -> ShowS
showEFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
showFFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
showGFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
showFloat, -- :: (RealFloat a) => a -> ShowS
floatToDigits, -- :: (RealFloat a) => Integer -> a -> ([Int], Int)
-- * Reading
-- | /NB:/ 'readInt' is the \'dual\' of 'showIntAtBase',
-- and 'readDec' is the \`dual\' of 'showInt'.
-- The inconsistent naming is a historical accident.
readSigned, -- :: (Real a) => ReadS a -> ReadS a
readInt, -- :: (Integral a) => a -> (Char -> Bool)
-- -> (Char -> Int) -> ReadS a
readDec, -- :: (Integral a) => ReadS a
readOct, -- :: (Integral a) => ReadS a
readHex, -- :: (Integral a) => ReadS a
readFloat, -- :: (RealFloat a) => ReadS a
lexDigits, -- :: ReadS String
-- * Miscellaneous
fromRat, -- :: (RealFloat a) => Rational -> a
) where
import "base" Numeric
{-# LANGUAGE BangPatterns, NoImplicitPrelude, PackageImports, Trustworthy #-}
-- |
-- The Haskell 98 Prelude: a standard module imported by default
-- into all Haskell modules. For more documentation, see the Haskell 98
-- Report <http://www.haskell.org/onlinereport/>.
module Prelude (
-- * Standard types, classes and related functions
-- ** Basic data types
Bool(False, True),
(&&), (||), not, otherwise,
Maybe(Nothing, Just),
maybe,
Either(Left, Right),
either,
Ordering(LT, EQ, GT),
Char, String,
-- *** Tuples
fst, snd, curry, uncurry,
-- ** Basic type classes
Eq((==), (/=)),
Ord(compare, (<), (<=), (>=), (>), max, min),
Enum(succ, pred, toEnum, fromEnum, enumFrom, enumFromThen,
enumFromTo, enumFromThenTo),
Bounded(minBound, maxBound),
-- ** Numbers
-- *** Numeric types
Int, Integer, Float, Double,
Rational,
-- *** Numeric type classes
Num((+), (-), (*), negate, abs, signum, fromInteger),
Real(toRational),
Integral(quot, rem, div, mod, quotRem, divMod, toInteger),
Fractional((/), recip, fromRational),
Floating(pi, exp, log, sqrt, (**), logBase, sin, cos, tan,
asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh),
RealFrac(properFraction, truncate, round, ceiling, floor),
RealFloat(floatRadix, floatDigits, floatRange, decodeFloat,
encodeFloat, exponent, significand, scaleFloat, isNaN,
isInfinite, isDenormalized, isIEEE, isNegativeZero, atan2),
-- *** Numeric functions
subtract, even, odd, gcd, lcm, (^), (^^),
fromIntegral, realToFrac,
-- ** Monads and functors
Monad((>>=), (>>), return, fail),
Functor(fmap),
mapM, mapM_, sequence, sequence_, (=<<),
-- ** Miscellaneous functions
id, const, (.), flip, ($), until,
asTypeOf, error, undefined,
seq, ($!),
-- * List operations
map, (++), filter,
head, last, tail, init, null, length, (!!),
reverse,
-- ** Reducing lists (folds)
foldl, foldl1, foldr, foldr1,
-- *** Special folds
and, or, any, all,
sum, product,
concat, concatMap,
maximum, minimum,
-- ** Building lists
-- *** Scans
scanl, scanl1, scanr, scanr1,
-- *** Infinite lists
iterate, repeat, replicate, cycle,
-- ** Sublists
take, drop, splitAt, takeWhile, dropWhile, span, break,
-- ** Searching lists
elem, notElem, lookup,
-- ** Zipping and unzipping lists
zip, zip3, zipWith, zipWith3, unzip, unzip3,
-- ** Functions on strings
lines, words, unlines, unwords,
-- * Converting to and from @String@
-- ** Converting to @String@
ShowS,
Show(showsPrec, showList, show),
shows,
showChar, showString, showParen,
-- ** Converting from @String@
ReadS,
Read(readsPrec, readList),
reads, readParen, read, lex,
-- * Basic Input and output
IO,
-- ** Simple I\/O operations
-- All I/O functions defined here are character oriented. The
-- treatment of the newline character will vary on different systems.
-- For example, two characters of input, return and linefeed, may
-- read as a single newline character. These functions cannot be
-- used portably for binary I/O.
-- *** Output functions
putChar,
putStr, putStrLn, print,
-- *** Input functions
getChar,
getLine, getContents, interact,
-- *** Files
FilePath,
readFile, writeFile, appendFile, readIO, readLn,
-- ** Exception handling in the I\/O monad
IOError, ioError, userError, catch
) where
import qualified "base" Control.Exception.Base as New (catch)
import "base" Control.Monad
import "base" System.IO
import "base" System.IO.Error (IOError, ioError, userError)
import "base" Data.OldList hiding ( splitAt )
import "base" Data.Either
import "base" Data.Maybe
import "base" Data.Tuple
import GHC.Base (($), ($!), (&&), (.), (||), Bool(..), Char, Eq(..), Int,
Ord(..), Ordering(..), String, asTypeOf, const, error, flip,
id, not, otherwise, seq, undefined, until)
import Text.Read
import GHC.Enum
import GHC.Num
import GHC.Real hiding ( gcd )
import qualified GHC.Real ( gcd )
import GHC.Float
import GHC.Show
-- -----------------------------------------------------------------------------
-- Miscellaneous functions
-- | The 'catch' function establishes a handler that receives any
-- 'IOError' raised in the action protected by 'catch'.
-- An 'IOError' is caught by
-- the most recent handler established by one of the exception handling
-- functions. These handlers are
-- not selective: all 'IOError's are caught. Exception propagation
-- must be explicitly provided in a handler by re-raising any unwanted
-- exceptions. For example, in