Commit 8b110df7 authored by sof's avatar sof
Browse files

[project @ 1998-08-14 11:15:07 by sof]

If possible, use new IO support for doing block IO
parent 384ab178
......@@ -59,9 +59,17 @@ import IOBase ( Handle__(..), IOError(..), IOErrorType(..),
#else
import PrelPack
import PrelST ( StateAndPtr#(..) )
import PrelHandle ( filePtr, readHandle, writeHandle )
import PrelHandle ( readHandle,
#if __GLASGOW_HASKELL__ < 303
filePtr, flushBuf,
#endif
writeHandle
)
import PrelIOBase ( Handle__(..), IOError(..), IOErrorType(..),
IOResult(..), IO(..),
#if __GLASGOW_HASKELL__ >= 303
Handle__Type(..),
#endif
constructError
)
#endif
......@@ -463,6 +471,7 @@ Outputting @FastString@s is quick, just block copying the chunk (using
\begin{code}
hPutFS :: Handle -> FastString -> IO ()
#if __GLASGOW_HASKELL__ <= 302
hPutFS handle (FastString _ l# ba#) =
if l# ==# 0# then
return ()
......@@ -517,6 +526,16 @@ hPutFS handle (CharStr a# l#) =
else
constructError "hPutFS" >>= \ err ->
fail err
#else
hPutFS handle (FastString _ l# ba#)
| l# ==# 0# = return ()
| otherwise = hPutBufBA handle (ByteArray bottom ba#) (I# l#)
where
bottom = error "hPutFS.ba"
hPutFS handle (CharStr a# l#)
| l# ==# 0# = return ()
| otherwise = hPutBuf handle (A# a#) (I# l#)
--ToDo: avoid silly code duplic.
#endif
\end{code}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment