Commit ceb68b91 authored by simonmar's avatar simonmar
Browse files

[project @ 2001-12-21 15:07:20 by simonmar]

Merge up to the ghc/lib/std on the HEAD (tagged as
new-libraries-last-merged).
parent b83cfb91
......@@ -8,7 +8,7 @@
-- Stability : experimental
-- Portability : non-portable
--
-- $Id: Concurrent.hs,v 1.2 2001/08/07 15:25:04 simonmar Exp $
-- $Id: Concurrent.hs,v 1.3 2001/12/21 15:07:21 simonmar Exp $
--
-- A common interface to a collection of useful concurrency
-- abstractions.
......@@ -53,8 +53,7 @@ import GHC.Conc
import GHC.TopHandler ( reportStackOverflow, reportError )
import GHC.IOBase ( IO(..) )
import GHC.IOBase ( unsafeInterleaveIO )
import GHC.Base ( fork# )
import GHC.Prim ( Addr#, unsafeCoerce# )
import GHC.Base
#endif
#ifdef __HUGS__
......
......@@ -8,7 +8,7 @@
-- Stability : experimental
-- Portability : non-portable
--
-- $Id: Exception.hs,v 1.4 2001/10/18 11:14:17 rrt Exp $
-- $Id: Exception.hs,v 1.5 2001/12/21 15:07:21 simonmar Exp $
--
-- The External API for exceptions. The functions provided in this
-- module allow catching of exceptions in the IO monad.
......@@ -76,7 +76,7 @@ module Control.Exception (
#ifdef __GLASGOW_HASKELL__
import Prelude hiding (catch)
import GHC.Prim ( assert )
import GHC.Base ( assert )
import GHC.Exception hiding (try, catch, bracket, bracket_)
import GHC.Conc ( throwTo, ThreadId )
import GHC.IOBase ( IO(..) )
......
......@@ -8,7 +8,7 @@
-- Stability : experimental
-- Portability : non-portable (requires universal quantification for runST)
--
-- $Id: ST.hs,v 1.4 2001/07/31 13:31:44 simonmar Exp $
-- $Id: ST.hs,v 1.5 2001/12/21 15:07:21 simonmar Exp $
--
-- The State Transformer Monad, ST
--
......@@ -34,7 +34,7 @@ import Data.Dynamic
#ifdef __GLASGOW_HASKELL__
import GHC.ST
import GHC.Prim ( unsafeCoerce#, RealWorld )
import GHC.Base ( unsafeCoerce#, RealWorld )
import GHC.IOBase ( IO(..), stToIO )
-- This relies on IO and ST having the same representation modulo the
......
......@@ -8,7 +8,7 @@
-- Stability : provisional
-- Portability : non-portable (requires universal quantification for runST)
--
-- $Id: Lazy.hs,v 1.2 2001/07/03 11:37:49 simonmar Exp $
-- $Id: Lazy.hs,v 1.3 2001/12/21 15:07:21 simonmar Exp $
--
-- This module presents an identical interface to Control.Monad.ST,
-- but the underlying implementation of the state thread is lazy.
......@@ -47,10 +47,9 @@ import Data.Array
import qualified Control.Monad.ST as ST
import qualified GHC.Arr as STArray
import qualified GHC.ST
import GHC.Base ( ($), ()(..) )
import GHC.Base
import Control.Monad
import Data.Ix
import GHC.Prim
#endif
#ifdef __HUGS__
......
......@@ -9,7 +9,7 @@
-- Stability : experimental
-- Portability : portable
--
-- $Id: Bits.hs,v 1.2 2001/07/03 11:37:49 simonmar Exp $
-- $Id: Bits.hs,v 1.3 2001/12/21 15:07:21 simonmar Exp $
--
-- Bitwise operations.
--
......@@ -92,20 +92,13 @@ instance Bits Int where
| i# >=# 0# = I# (x# `iShiftL#` i#)
| otherwise = I# (x# `iShiftRA#` negateInt# i#)
(I# x#) `rotate` (I# i#) =
#if WORD_SIZE_IN_BYTES == 4
I# (word2Int# ((x'# `shiftL#` i'#) `or#`
(x'# `shiftRL#` (32# -# i'#))))
(x'# `shiftRL#` (wsib -# i'#))))
where
x'# = int2Word# x#
i'# = word2Int# (int2Word# i# `and#` int2Word# 31#)
#else
I# (word2Int# ((x'# `shiftL#` i'#) `or#`
(x'# `shiftRL#` (64# -# i'#))))
where
x'# = int2Word# x#
i'# = word2Int# (int2Word# i# `and#` int2Word# 63#)
#endif
bitSize _ = WORD_SIZE_IN_BYTES * 8
i'# = word2Int# (int2Word# i# `and#` int2Word# (wsib -# 1#))
wsib = WORD_SIZE_IN_BITS# {- work around preprocessor problem (??) -}
bitSize _ = WORD_SIZE_IN_BITS
isSigned _ = True
instance Bits Integer where
......
......@@ -8,7 +8,7 @@
-- Stability : provisional
-- Portability : portable
--
-- $Id: Complex.hs,v 1.1 2001/06/28 14:15:02 simonmar Exp $
-- $Id: Complex.hs,v 1.2 2001/12/21 15:07:21 simonmar Exp $
--
-- Complex numbers.
--
......@@ -58,24 +58,30 @@ realPart, imagPart :: (RealFloat a) => Complex a -> a
realPart (x :+ _) = x
imagPart (_ :+ y) = y
{-# SPECIALISE conjugate :: Complex Double -> Complex Double #-}
conjugate :: (RealFloat a) => Complex a -> Complex a
conjugate (x:+y) = x :+ (-y)
{-# SPECIALISE mkPolar :: Double -> Double -> Complex Double #-}
mkPolar :: (RealFloat a) => a -> a -> Complex a
mkPolar r theta = r * cos theta :+ r * sin theta
{-# SPECIALISE cis :: Double -> Complex Double #-}
cis :: (RealFloat a) => a -> Complex a
cis theta = cos theta :+ sin theta
{-# SPECIALISE polar :: Complex Double -> (Double,Double) #-}
polar :: (RealFloat a) => Complex a -> (a,a)
polar z = (magnitude z, phase z)
{-# SPECIALISE magnitude :: Complex Double -> Double #-}
magnitude :: (RealFloat a) => Complex a -> a
magnitude (x:+y) = scaleFloat k
(sqrt ((scaleFloat mk x)^(2::Int) + (scaleFloat mk y)^(2::Int)))
where k = max (exponent x) (exponent y)
mk = - k
{-# SPECIALISE phase :: Complex Double -> Double #-}
phase :: (RealFloat a) => Complex a -> a
phase (0 :+ 0) = 0 -- SLPJ July 97 from John Peterson
phase (x:+y) = atan2 y x
......
......@@ -9,7 +9,7 @@
-- Stability : experimental
-- Portability : portable
--
-- $Id: Dynamic.hs,v 1.3 2001/07/03 14:13:32 simonmar Exp $
-- $Id: Dynamic.hs,v 1.4 2001/12/21 15:07:21 simonmar Exp $
--
-- The Dynamic interface provides basic support for dynamic types.
--
......@@ -78,8 +78,6 @@ import GHC.Dynamic
#endif
#ifdef __GLASGOW_HASKELL__
import GHC.Prim ( unsafeCoerce# )
unsafeCoerce :: a -> b
unsafeCoerce = unsafeCoerce#
#endif
......
......@@ -8,7 +8,7 @@
-- Stability : experimental
-- Portability : portable
--
-- $Id: IORef.hs,v 1.2 2001/07/03 11:37:49 simonmar Exp $
-- $Id: IORef.hs,v 1.3 2001/12/21 15:07:21 simonmar Exp $
--
-- Mutable references in the IO monad.
--
......@@ -29,7 +29,7 @@ module Data.IORef
import Prelude
#ifdef __GLASGOW_HASKELL__
import GHC.Prim ( mkWeak# )
import GHC.Base ( mkWeak# )
import GHC.STRef
import GHC.IOBase
#if !defined(__PARALLEL_HASKELL__)
......
......@@ -8,7 +8,7 @@
-- Stability : provisional
-- Portability : portable
--
-- $Id: Ix.hs,v 1.1 2001/06/28 14:15:02 simonmar Exp $
-- $Id: Ix.hs,v 1.2 2001/12/21 15:07:21 simonmar Exp $
--
-- Class of index types.
--
......@@ -20,8 +20,8 @@ module Data.Ix
( range -- :: (Ix a) => (a,a) -> [a]
, index -- :: (Ix a) => (a,a) -> a -> Int
, inRange -- :: (Ix a) => (a,a) -> a -> Bool
, rangeSize -- :: (Ix a) => (a,a) -> Int
)
, rangeSize -- :: (Ix a) => (a,a) -> Int
-- Ix instances:
--
-- Ix Char
......
......@@ -9,7 +9,7 @@
-- Stability : provisional
-- Portability : portable
--
-- $Id: List.hs,v 1.1 2001/06/28 14:15:02 simonmar Exp $
-- $Id: List.hs,v 1.2 2001/12/21 15:07:21 simonmar Exp $
--
-- Operations on lists.
--
......@@ -317,13 +317,21 @@ insertBy cmp x ys@(y:ys')
GT -> y : insertBy cmp x ys'
_ -> x : ys
maximumBy :: (a -> a -> a) -> [a] -> a
maximumBy _ [] = error "List.maximumBy: empty list"
maximumBy max xs = foldl1 max xs
minimumBy :: (a -> a -> a) -> [a] -> a
minimumBy _ [] = error "List.minimumBy: empty list"
minimumBy min xs = foldl1 min xs
maximumBy :: (a -> a -> Ordering) -> [a] -> a
maximumBy _ [] = error "List.maximumBy: empty list"
maximumBy cmp xs = foldl1 max xs
where
max x y = case cmp x y of
GT -> x
_ -> y
minimumBy :: (a -> a -> Ordering) -> [a] -> a
minimumBy _ [] = error "List.minimumBy: empty list"
minimumBy cmp xs = foldl1 min xs
where
min x y = case cmp x y of
GT -> y
_ -> x
genericLength :: (Num i) => [b] -> i
genericLength [] = 0
......
......@@ -9,7 +9,7 @@
-- Stability : experimental
-- Portability : portable
--
-- $Id: Tuple.hs,v 1.1 2001/07/03 11:38:07 simonmar Exp $
-- $Id: Tuple.hs,v 1.2 2001/12/21 15:07:22 simonmar Exp $
--
-- The tuple data types, and associated functions.
--
......@@ -30,20 +30,20 @@ import GHC.Base
default () -- Double isn't available yet
#endif
data (,) a b = (,) a b deriving (Eq, Ord)
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
......
-----------------------------------------------------------------------------
--
-- Module : Debug.QuickCheck.Poly
-- Module : Debug.QuickCheck.Utils
-- Copyright : (c) Andy Gill 2001
-- License : BSD-style (see the file libraries/core/LICENSE)
--
......@@ -8,13 +8,13 @@
-- Stability : experimental
-- Portability : portable
--
-- $Id: Utils.hs,v 1.1 2001/08/17 12:48:38 simonmar Exp $
-- $Id: Utils.hs,v 1.2 2001/12/21 15:07:22 simonmar Exp $
--
-- These are some general purpose utilities for use with QuickCheck.
--
-----------------------------------------------------------------------------
module Debug.QuickCheckUtils
module Debug.QuickCheck.Utils
( isAssociativeBy
, isAssociative
, isCommutableBy
......
......@@ -9,7 +9,7 @@
-- Stability : provisional
-- Portability : portable
--
-- $Id: Error.hs,v 1.3 2001/07/31 12:59:30 simonmar Exp $
-- $Id: Error.hs,v 1.4 2001/12/21 15:07:22 simonmar Exp $
--
-- C-specific Marshalling support: Handling of C "errno" error codes
--
......@@ -120,6 +120,7 @@ import System.IO ( IOError, Handle, ioError )
-- import of C function that gives address of errno
-- This function exists because errno is a variable on some systems, but on
-- Windows it is a macro for a function...
-- [yes, global variables and thread safety don't really go hand-in-hand. -- sof]
foreign import "ghcErrno" unsafe _errno :: Ptr CInt
-- Haskell representation for "errno" values
......@@ -148,108 +149,108 @@ eOK, e2BIG, eACCES, eADDRINUSE, eADDRNOTAVAIL, eADV, eAFNOSUPPORT, eAGAIN,
eSOCKTNOSUPPORT, eSPIPE, eSRCH, eSRMNT, eSTALE, eTIME, eTIMEDOUT,
eTOOMANYREFS, eTXTBSY, eUSERS, eWOULDBLOCK, eXDEV :: Errno
--
-- the CCONST_XXX identifiers are cpp symbols whose value is computed by
-- the cCONST_XXX identifiers are cpp symbols whose value is computed by
-- configure
--
eOK = Errno 0
e2BIG = Errno (CCONST_E2BIG)
eACCES = Errno (CCONST_EACCES)
eADDRINUSE = Errno (CCONST_EADDRINUSE)
eADDRNOTAVAIL = Errno (CCONST_EADDRNOTAVAIL)
eADV = Errno (CCONST_EADV)
eAFNOSUPPORT = Errno (CCONST_EAFNOSUPPORT)
eAGAIN = Errno (CCONST_EAGAIN)
eALREADY = Errno (CCONST_EALREADY)
eBADF = Errno (CCONST_EBADF)
eBADMSG = Errno (CCONST_EBADMSG)
eBADRPC = Errno (CCONST_EBADRPC)
eBUSY = Errno (CCONST_EBUSY)
eCHILD = Errno (CCONST_ECHILD)
eCOMM = Errno (CCONST_ECOMM)
eCONNABORTED = Errno (CCONST_ECONNABORTED)
eCONNREFUSED = Errno (CCONST_ECONNREFUSED)
eCONNRESET = Errno (CCONST_ECONNRESET)
eDEADLK = Errno (CCONST_EDEADLK)
eDESTADDRREQ = Errno (CCONST_EDESTADDRREQ)
eDIRTY = Errno (CCONST_EDIRTY)
eDOM = Errno (CCONST_EDOM)
eDQUOT = Errno (CCONST_EDQUOT)
eEXIST = Errno (CCONST_EEXIST)
eFAULT = Errno (CCONST_EFAULT)
eFBIG = Errno (CCONST_EFBIG)
eFTYPE = Errno (CCONST_EFTYPE)
eHOSTDOWN = Errno (CCONST_EHOSTDOWN)
eHOSTUNREACH = Errno (CCONST_EHOSTUNREACH)
eIDRM = Errno (CCONST_EIDRM)
eILSEQ = Errno (CCONST_EILSEQ)
eINPROGRESS = Errno (CCONST_EINPROGRESS)
eINTR = Errno (CCONST_EINTR)
eINVAL = Errno (CCONST_EINVAL)
eIO = Errno (CCONST_EIO)
eISCONN = Errno (CCONST_EISCONN)
eISDIR = Errno (CCONST_EISDIR)
eLOOP = Errno (CCONST_ELOOP)
eMFILE = Errno (CCONST_EMFILE)
eMLINK = Errno (CCONST_EMLINK)
eMSGSIZE = Errno (CCONST_EMSGSIZE)
eMULTIHOP = Errno (CCONST_EMULTIHOP)
eNAMETOOLONG = Errno (CCONST_ENAMETOOLONG)
eNETDOWN = Errno (CCONST_ENETDOWN)
eNETRESET = Errno (CCONST_ENETRESET)
eNETUNREACH = Errno (CCONST_ENETUNREACH)
eNFILE = Errno (CCONST_ENFILE)
eNOBUFS = Errno (CCONST_ENOBUFS)
eNODATA = Errno (CCONST_ENODATA)
eNODEV = Errno (CCONST_ENODEV)
eNOENT = Errno (CCONST_ENOENT)
eNOEXEC = Errno (CCONST_ENOEXEC)
eNOLCK = Errno (CCONST_ENOLCK)
eNOLINK = Errno (CCONST_ENOLINK)
eNOMEM = Errno (CCONST_ENOMEM)
eNOMSG = Errno (CCONST_ENOMSG)
eNONET = Errno (CCONST_ENONET)
eNOPROTOOPT = Errno (CCONST_ENOPROTOOPT)
eNOSPC = Errno (CCONST_ENOSPC)
eNOSR = Errno (CCONST_ENOSR)
eNOSTR = Errno (CCONST_ENOSTR)
eNOSYS = Errno (CCONST_ENOSYS)
eNOTBLK = Errno (CCONST_ENOTBLK)
eNOTCONN = Errno (CCONST_ENOTCONN)
eNOTDIR = Errno (CCONST_ENOTDIR)
eNOTEMPTY = Errno (CCONST_ENOTEMPTY)
eNOTSOCK = Errno (CCONST_ENOTSOCK)
eNOTTY = Errno (CCONST_ENOTTY)
eNXIO = Errno (CCONST_ENXIO)
eOPNOTSUPP = Errno (CCONST_EOPNOTSUPP)
ePERM = Errno (CCONST_EPERM)
ePFNOSUPPORT = Errno (CCONST_EPFNOSUPPORT)
ePIPE = Errno (CCONST_EPIPE)
ePROCLIM = Errno (CCONST_EPROCLIM)
ePROCUNAVAIL = Errno (CCONST_EPROCUNAVAIL)
ePROGMISMATCH = Errno (CCONST_EPROGMISMATCH)
ePROGUNAVAIL = Errno (CCONST_EPROGUNAVAIL)
ePROTO = Errno (CCONST_EPROTO)
ePROTONOSUPPORT = Errno (CCONST_EPROTONOSUPPORT)
ePROTOTYPE = Errno (CCONST_EPROTOTYPE)
eRANGE = Errno (CCONST_ERANGE)
eREMCHG = Errno (CCONST_EREMCHG)
eREMOTE = Errno (CCONST_EREMOTE)
eROFS = Errno (CCONST_EROFS)
eRPCMISMATCH = Errno (CCONST_ERPCMISMATCH)
eRREMOTE = Errno (CCONST_ERREMOTE)
eSHUTDOWN = Errno (CCONST_ESHUTDOWN)
eSOCKTNOSUPPORT = Errno (CCONST_ESOCKTNOSUPPORT)
eSPIPE = Errno (CCONST_ESPIPE)
eSRCH = Errno (CCONST_ESRCH)
eSRMNT = Errno (CCONST_ESRMNT)
eSTALE = Errno (CCONST_ESTALE)
eTIME = Errno (CCONST_ETIME)
eTIMEDOUT = Errno (CCONST_ETIMEDOUT)
eTOOMANYREFS = Errno (CCONST_ETOOMANYREFS)
eTXTBSY = Errno (CCONST_ETXTBSY)
eUSERS = Errno (CCONST_EUSERS)
eWOULDBLOCK = Errno (CCONST_EWOULDBLOCK)
eXDEV = Errno (CCONST_EXDEV)
e2BIG = Errno (cCONST_E2BIG)
eACCES = Errno (cCONST_EACCES)
eADDRINUSE = Errno (cCONST_EADDRINUSE)
eADDRNOTAVAIL = Errno (cCONST_EADDRNOTAVAIL)
eADV = Errno (cCONST_EADV)
eAFNOSUPPORT = Errno (cCONST_EAFNOSUPPORT)
eAGAIN = Errno (cCONST_EAGAIN)
eALREADY = Errno (cCONST_EALREADY)
eBADF = Errno (cCONST_EBADF)
eBADMSG = Errno (cCONST_EBADMSG)
eBADRPC = Errno (cCONST_EBADRPC)
eBUSY = Errno (cCONST_EBUSY)
eCHILD = Errno (cCONST_ECHILD)
eCOMM = Errno (cCONST_ECOMM)
eCONNABORTED = Errno (cCONST_ECONNABORTED)
eCONNREFUSED = Errno (cCONST_ECONNREFUSED)
eCONNRESET = Errno (cCONST_ECONNRESET)
eDEADLK = Errno (cCONST_EDEADLK)
eDESTADDRREQ = Errno (cCONST_EDESTADDRREQ)
eDIRTY = Errno (cCONST_EDIRTY)
eDOM = Errno (cCONST_EDOM)
eDQUOT = Errno (cCONST_EDQUOT)
eEXIST = Errno (cCONST_EEXIST)
eFAULT = Errno (cCONST_EFAULT)
eFBIG = Errno (cCONST_EFBIG)
eFTYPE = Errno (cCONST_EFTYPE)
eHOSTDOWN = Errno (cCONST_EHOSTDOWN)
eHOSTUNREACH = Errno (cCONST_EHOSTUNREACH)
eIDRM = Errno (cCONST_EIDRM)
eILSEQ = Errno (cCONST_EILSEQ)
eINPROGRESS = Errno (cCONST_EINPROGRESS)
eINTR = Errno (cCONST_EINTR)
eINVAL = Errno (cCONST_EINVAL)
eIO = Errno (cCONST_EIO)
eISCONN = Errno (cCONST_EISCONN)
eISDIR = Errno (cCONST_EISDIR)
eLOOP = Errno (cCONST_ELOOP)
eMFILE = Errno (cCONST_EMFILE)
eMLINK = Errno (cCONST_EMLINK)
eMSGSIZE = Errno (cCONST_EMSGSIZE)
eMULTIHOP = Errno (cCONST_EMULTIHOP)
eNAMETOOLONG = Errno (cCONST_ENAMETOOLONG)
eNETDOWN = Errno (cCONST_ENETDOWN)
eNETRESET = Errno (cCONST_ENETRESET)
eNETUNREACH = Errno (cCONST_ENETUNREACH)
eNFILE = Errno (cCONST_ENFILE)
eNOBUFS = Errno (cCONST_ENOBUFS)
eNODATA = Errno (cCONST_ENODATA)
eNODEV = Errno (cCONST_ENODEV)
eNOENT = Errno (cCONST_ENOENT)
eNOEXEC = Errno (cCONST_ENOEXEC)
eNOLCK = Errno (cCONST_ENOLCK)
eNOLINK = Errno (cCONST_ENOLINK)
eNOMEM = Errno (cCONST_ENOMEM)
eNOMSG = Errno (cCONST_ENOMSG)
eNONET = Errno (cCONST_ENONET)
eNOPROTOOPT = Errno (cCONST_ENOPROTOOPT)
eNOSPC = Errno (cCONST_ENOSPC)
eNOSR = Errno (cCONST_ENOSR)
eNOSTR = Errno (cCONST_ENOSTR)
eNOSYS = Errno (cCONST_ENOSYS)
eNOTBLK = Errno (cCONST_ENOTBLK)
eNOTCONN = Errno (cCONST_ENOTCONN)
eNOTDIR = Errno (cCONST_ENOTDIR)
eNOTEMPTY = Errno (cCONST_ENOTEMPTY)
eNOTSOCK = Errno (cCONST_ENOTSOCK)
eNOTTY = Errno (cCONST_ENOTTY)
eNXIO = Errno (cCONST_ENXIO)
eOPNOTSUPP = Errno (cCONST_EOPNOTSUPP)
ePERM = Errno (cCONST_EPERM)
ePFNOSUPPORT = Errno (cCONST_EPFNOSUPPORT)
ePIPE = Errno (cCONST_EPIPE)
ePROCLIM = Errno (cCONST_EPROCLIM)
ePROCUNAVAIL = Errno (cCONST_EPROCUNAVAIL)
ePROGMISMATCH = Errno (cCONST_EPROGMISMATCH)
ePROGUNAVAIL = Errno (cCONST_EPROGUNAVAIL)
ePROTO = Errno (cCONST_EPROTO)
ePROTONOSUPPORT = Errno (cCONST_EPROTONOSUPPORT)
ePROTOTYPE = Errno (cCONST_EPROTOTYPE)
eRANGE = Errno (cCONST_ERANGE)
eREMCHG = Errno (cCONST_EREMCHG)
eREMOTE = Errno (cCONST_EREMOTE)
eROFS = Errno (cCONST_EROFS)
eRPCMISMATCH = Errno (cCONST_ERPCMISMATCH)
eRREMOTE = Errno (cCONST_ERREMOTE)
eSHUTDOWN = Errno (cCONST_ESHUTDOWN)
eSOCKTNOSUPPORT = Errno (cCONST_ESOCKTNOSUPPORT)
eSPIPE = Errno (cCONST_ESPIPE)
eSRCH = Errno (cCONST_ESRCH)
eSRMNT = Errno (cCONST_ESRMNT)
eSTALE = Errno (cCONST_ESTALE)
eTIME = Errno (cCONST_ETIME)
eTIMEDOUT = Errno (cCONST_ETIMEDOUT)
eTOOMANYREFS = Errno (cCONST_ETOOMANYREFS)
eTXTBSY = Errno (cCONST_ETXTBSY)
eUSERS = Errno (cCONST_EUSERS)
eWOULDBLOCK = Errno (cCONST_EWOULDBLOCK)
eXDEV = Errno (cCONST_EXDEV)
-- checks whether the given errno value is supported on the current
-- architecture
......@@ -457,7 +458,7 @@ errnoToIOError loc errno maybeHdl maybeName = unsafePerformIO $ do
| errno == eNFILE = ResourceExhausted
| errno == eNOBUFS = ResourceExhausted
| errno == eNODATA = NoSuchThing
| errno == eNODEV = NoSuchThing
| errno == eNODEV = UnsupportedOperation
| errno == eNOENT = NoSuchThing
| errno == eNOEXEC = InvalidArgument
| errno == eNOLCK = ResourceExhausted
......@@ -513,3 +514,106 @@ errnoToIOError loc errno maybeHdl maybeName = unsafePerformIO $ do
#endif
foreign import unsafe strerror :: Errno -> IO (Ptr CChar)
-- Dreadfully tedious callouts to wrappers which define the
-- actual values for the error codes.
foreign import ccall "prel_error_E2BIG" unsafe cCONST_E2BIG :: CInt
foreign import ccall "prel_error_EACCES" unsafe cCONST_EACCES :: CInt
foreign import ccall "prel_error_EADDRINUSE" unsafe cCONST_EADDRINUSE :: CInt
foreign import ccall "prel_error_EADDRNOTAVAIL" unsafe cCONST_EADDRNOTAVAIL :: CInt
foreign import ccall "prel_error_EADV" unsafe cCONST_EADV :: CInt
foreign import ccall "prel_error_EAFNOSUPPORT" unsafe cCONST_EAFNOSUPPORT :: CInt
foreign import ccall "prel_error_EAGAIN" unsafe cCONST_EAGAIN :: CInt
foreign import ccall "prel_error_EALREADY" unsafe cCONST_EALREADY :: CInt
foreign import ccall "prel_error_EBADF" unsafe cCONST_EBADF :: CInt
foreign import ccall "prel_error_EBADMSG" unsafe cCONST_EBADMSG :: CInt
foreign import ccall "prel_error_EBADRPC" unsafe cCONST_EBADRPC :: CInt
foreign import ccall "prel_error_EBUSY" unsafe cCONST_EBUSY :: CInt
foreign import ccall "prel_error_ECHILD" unsafe cCONST_ECHILD :: CInt
foreign import ccall "prel_error_ECOMM" unsafe cCONST_ECOMM :: CInt
foreign import ccall "prel_error_ECONNABORTED" unsafe cCONST_ECONNABORTED :: CInt
foreign import ccall "prel_error_ECONNREFUSED" unsafe cCONST_ECONNREFUSED :: CInt
foreign import ccall "prel_error_ECONNRESET" unsafe cCONST_ECONNRESET :: CInt
foreign import ccall "prel_error_EDEADLK" unsafe cCONST_EDEADLK :: CInt
foreign import ccall "prel_error_EDESTADDRREQ" unsafe cCONST_EDESTADDRREQ :: CInt
foreign import ccall "prel_error_EDIRTY" unsafe cCONST_EDIRTY :: CInt
foreign import ccall "prel_error_EDOM" unsafe cCONST_EDOM :: CInt
foreign import ccall "prel_error_EDQUOT" unsafe cCONST_EDQUOT :: CInt
foreign import ccall "prel_error_EEXIST" unsafe cCONST_EEXIST :: CInt
foreign import ccall "prel_error_EFAULT" unsafe cCONST_EFAULT :: CInt
foreign import ccall "prel_error_EFBIG" unsafe cCONST_EFBIG :: CInt
foreign import ccall "prel_error_EFTYPE" unsafe cCONST_EFTYPE :: CInt
foreign import ccall "prel_error_EHOSTDOWN" unsafe cCONST_EHOSTDOWN :: CInt
foreign import ccall "prel_error_EHOSTUNREACH" unsafe cCONST_EHOSTUNREACH :: CInt
foreign import ccall "prel_error_EIDRM" unsafe cCONST_EIDRM :: CInt
foreign import ccall "prel_error_EILSEQ" unsafe cCONST_EILSEQ :: CInt
foreign import ccall "prel_error_EINPROGRESS" unsafe cCONST_EINPROGRESS :: CInt
foreign import ccall "prel_error_EINTR" unsafe cCONST_EINTR :: CInt
foreign import ccall "prel_error_EINVAL" unsafe cCONST_EINVAL :: CInt
foreign import ccall "prel_error_EIO" unsafe