summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonm <unknown>1998-10-06 14:36:27 +0000
committersimonm <unknown>1998-10-06 14:36:27 +0000
commite363c98b95457881c26c9e51da0df423697ac290 (patch)
tree9629cbcb2fe5cbc99336216f29850992ab44890b
parentb7cf40bb1d6750283c703e386d61ef5bd8ae754c (diff)
downloadhaskell-e363c98b95457881c26c9e51da0df423697ac290.tar.gz
[project @ 1998-10-06 14:36:27 by simonm]
back out revision 1.2 (change made on wrong branch).
-rw-r--r--ghc/lib/misc/CString.lhs17
1 files changed, 10 insertions, 7 deletions
diff --git a/ghc/lib/misc/CString.lhs b/ghc/lib/misc/CString.lhs
index 48c1f55589..26b775e040 100644
--- a/ghc/lib/misc/CString.lhs
+++ b/ghc/lib/misc/CString.lhs
@@ -54,7 +54,10 @@ module CString
import PrelPack
import GlaExts
import Addr
-import PrelIOBase ( IO(..) )
+import PrelIOBase ( IO(..), IOResult(..))
+import PrelArr ( StateAndMutableByteArray#(..),
+ StateAndByteArray#(..)
+ )
\end{code}
@@ -161,21 +164,21 @@ out the bounds - use with care.
allocChars :: Int -> IO (MutableByteArray RealWorld Int)
allocChars (I# size#) = IO $ \ s# ->
case newCharArray# size# s# of
- (# s2#, barr# #) ->
- (# s2#, (MutableByteArray (I# 1#, I# size#) barr#) #)
+ StateAndMutableByteArray# s2# barr# ->
+ IOok s2# (MutableByteArray (I# 1#, I# size#) barr#)
allocWords :: Int -> IO (MutableByteArray RealWorld Int)
allocWords (I# size#) = IO $ \ s# ->
case newIntArray# size# s# of
- (# s2#, barr# #) ->
- (# s2#, (MutableByteArray (I# 1#, I# size#) barr#) #)
+ StateAndMutableByteArray# s2# barr# ->
+ IOok s2# (MutableByteArray (I# 1#, I# size#) barr#)
-- Freeze these index-free mutable arrays
freeze :: MutableByteArray RealWorld Int -> IO (ByteArray Int)
freeze (MutableByteArray ixs arr#) = IO $ \ s# ->
case unsafeFreezeByteArray# arr# s# of
- (# s2#, frozen# #) ->
- (# s2#, (ByteArray ixs frozen#) #)
+ StateAndByteArray# s2# frozen# ->
+ IOok s2# (ByteArray ixs frozen#)
-- Copy a null-terminated string from outside the heap to
-- Haskellized nonsense inside the heap