- flat (CAppend s1 s2) = flat s1 `seqPrimIO` flat s2
- flat CNewline = _ccall_ stg_putc '\n' file
- flat (CCh c) = _ccall_ stg_putc c file
- flat (CInt i) = _ccall_ fprintf file percent_d i
- flat (CStr s) = put_str s
- flat (CPStr s) = put_pstr s
-
- -----
- put_str, put_str2 :: String -> PrimIO ()
-
- put_str str
- = --put_str2 ``stderr'' (str ++ "\n") `seqPrimIO`
- put_str2 str
-
- put_str2 [] = returnPrimIO ()
-
- put_str2 (c1@(C# _) : c2@(C# _) : c3@(C# _) : c4@(C# _) : cs)
- = _ccall_ stg_putc c1 file `seqPrimIO`
- _ccall_ stg_putc c2 file `seqPrimIO`
- _ccall_ stg_putc c3 file `seqPrimIO`
- _ccall_ stg_putc c4 file `seqPrimIO`
- put_str2 cs -- efficiency hack? who knows... (WDP 94/10)
-
- put_str2 (c1@(C# _) : c2@(C# _) : c3@(C# _) : cs)
- = _ccall_ stg_putc c1 file `seqPrimIO`
- _ccall_ stg_putc c2 file `seqPrimIO`
- _ccall_ stg_putc c3 file `seqPrimIO`
- put_str2 cs -- efficiency hack? who knows... (WDP 94/10)
-
- put_str2 (c1@(C# _) : c2@(C# _) : cs)
- = _ccall_ stg_putc c1 file `seqPrimIO`
- _ccall_ stg_putc c2 file `seqPrimIO`
- put_str2 cs -- efficiency hack? who knows... (WDP 94/10)
-
- put_str2 (c1@(C# _) : cs)
- = _ccall_ stg_putc c1 file `seqPrimIO`
- put_str2 cs -- efficiency hack? who knows... (WDP 94/10)
-
- put_pstr ps = _putPS file ps
-
-percent_d = _psToByteArray SLIT("%d")
+ flat (CAppend s1 s2) = flat s1 >> flat s2
+ flat CNewline = hPutChar handle '\n'
+ flat (CCh c) = hPutChar handle c
+ flat (CInt i) = hPutStr handle (show i)
+ flat (CStr s) = hPutStr handle s
+ flat (CPStr s) = hPutStr handle (_UNPK_ s)