(non-GHC only) track MArray interface change
authorRoss Paterson <ross@soi.city.ac.uk>
Thu, 10 Aug 2006 18:29:02 +0000 (18:29 +0000)
committerRoss Paterson <ross@soi.city.ac.uk>
Thu, 10 Aug 2006 18:29:02 +0000 (18:29 +0000)
Data/Array/IO.hs
Data/Array/IO/Internals.hs

index 996879d..a476a32 100644 (file)
@@ -226,10 +226,11 @@ illegalBufferSize handle fn sz =
 
 #else /* !__GLASGOW_HASKELL__ */
 hGetArray :: Handle -> IOUArray Int Word8 -> Int -> IO Int
-hGetArray handle arr count
-  | count < 0 || count > rangeSize (bounds arr)
-  = illegalBufferSize handle "hGetArray" count
-  | otherwise = get 0
+hGetArray handle arr count = do
+       bds <- getBounds arr
+       if count < 0 || count > rangeSize bds
+          then illegalBufferSize handle "hGetArray" count
+          else get 0
  where
   get i | i == count = return i
        | otherwise = do
@@ -243,10 +244,11 @@ hGetArray handle arr count
                        get (i+1)
 
 hPutArray :: Handle -> IOUArray Int Word8 -> Int -> IO ()
-hPutArray handle arr count
-  | count < 0 || count > rangeSize (bounds arr)
-  = illegalBufferSize handle "hPutArray" count
-  | otherwise = put 0
+hPutArray handle arr count = do
+       bds <- getBounds arr
+       if count < 0 || count > rangeSize bds
+          then illegalBufferSize handle "hPutArray" count
+          else put 0
  where
   put i | i == count = return ()
        | otherwise = do
index 433c6c2..fca542e 100644 (file)
@@ -50,7 +50,7 @@ INSTANCE_TYPEABLE2(IOArray,iOArrayTc,"IOArray")
 
 instance MArray IOArray e IO where
 #if defined(__HUGS__)
-    getBound    = return . boundsIOArray
+    getBounds   = return . boundsIOArray
 #elif defined(__GLASGOW_HASKELL__)
     {-# INLINE getBounds #-}
     getBounds (IOArray marr) = stToIO $ getBounds marr