From 87b82a02c740960b8aed085c29598048a6618b63 Mon Sep 17 00:00:00 2001 From: sof Date: Tue, 2 Feb 1999 13:24:52 +0000 Subject: [PATCH] [project @ 1999-02-02 13:24:52 by sof] - renamed boundsOfByteArray to boundsOfMutableByteArray. (partly for consistency, partly to create a new Top 10 entry on the list of long function names exported from lib/.) - moved sizeofByteArray over to ByteArray --- ghc/lib/exts/MutableArray.lhs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ghc/lib/exts/MutableArray.lhs b/ghc/lib/exts/MutableArray.lhs index 55174c7..d5adb92 100644 --- a/ghc/lib/exts/MutableArray.lhs +++ b/ghc/lib/exts/MutableArray.lhs @@ -25,8 +25,8 @@ module MutableArray newDoubleArray, newStablePtrArray, -- :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix) - boundsOfArray, -- :: Ix ix => MutableArray s ix elt -> (ix, ix) - boundsOfByteArray, -- :: Ix ix => MutableByteArray s ix -> (ix, ix) + boundsOfArray, -- :: Ix ix => MutableArray s ix elt -> (ix, ix) + boundsOfMutableByteArray, -- :: Ix ix => MutableByteArray s ix -> (ix, ix) readArray, -- :: Ix ix => MutableArray s ix elt -> ix -> ST s elt @@ -58,7 +58,6 @@ module MutableArray thawArray, -- :: Ix ix => Array ix elt -> ST s (MutableArray s ix elt) -- the sizes are reported back are *in bytes*. - sizeofByteArray, -- :: Ix ix => ByteArray ix -> Int sizeofMutableByteArray, -- :: Ix ix => MutableByteArray s ix -> Int readWord8Array, -- :: Ix ix => MutableByteArray s ix -> Int -> IO Word8 @@ -103,11 +102,6 @@ array is not accidental; storing foreign objs in a mutable array is not supported. \begin{code} -sizeofByteArray :: Ix ix => ByteArray ix -> Int -sizeofByteArray (ByteArray _ arr#) = - case (sizeofByteArray# arr#) of - i# -> (I# i#) - sizeofMutableByteArray :: Ix ix => MutableByteArray s ix -> Int sizeofMutableByteArray (MutableByteArray _ arr#) = case (sizeofMutableByteArray# arr#) of @@ -377,3 +371,10 @@ writeInt64Array mb n w = do (h',l') = w `divMod` (int32ToInt64 (maxBound::Int32) * 2 - 1) \end{code} + +\begin{code} +{-# SPECIALIZE boundsOfMutableByteArray :: MutableByteArray s Int -> IPr #-} +boundsOfMutableByteArray :: Ix ix => MutableByteArray s ix -> (ix, ix) +boundsOfMutableByteArray (MutableByteArray ixs _) = ixs + +\end{code} -- 1.7.10.4