From 8b110df7741b0b27315cee31ebd6780c6f0db859 Mon Sep 17 00:00:00 2001 From: sof Date: Fri, 14 Aug 1998 11:15:07 +0000 Subject: [PATCH] [project @ 1998-08-14 11:15:07 by sof] If possible, use new IO support for doing block IO --- ghc/compiler/utils/FastString.lhs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/utils/FastString.lhs b/ghc/compiler/utils/FastString.lhs index 8a2d89a..55723bc 100644 --- a/ghc/compiler/utils/FastString.lhs +++ b/ghc/compiler/utils/FastString.lhs @@ -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} -- 1.7.10.4