X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FIO.hs;h=bf26835eef628b0335ae9246723e0852295577aa;hb=HEAD;hp=c12fcea4a7be8cd6648479799579c87d6c04949d;hpb=595f2cbc9072003f4e86dab6d1c9a408d388f3b7;p=ghc-base.git diff --git a/System/IO.hs b/System/IO.hs index c12fcea..bf26835 100644 --- a/System/IO.hs +++ b/System/IO.hs @@ -1,4 +1,5 @@ -{-# OPTIONS_GHC -XNoImplicitPrelude #-} +{-# LANGUAGE CPP, NoImplicitPrelude #-} + ----------------------------------------------------------------------------- -- | -- Module : System.IO @@ -200,6 +201,7 @@ module System.IO ( utf16, utf16le, utf16be, utf32, utf32le, utf32be, localeEncoding, + char8, mkTextEncoding, #endif @@ -244,12 +246,12 @@ import System.Posix.Types #ifdef __GLASGOW_HASKELL__ import GHC.Base -import GHC.IO hiding ( onException ) +import GHC.IO hiding ( bracket, onException ) import GHC.IO.IOMode import GHC.IO.Handle.FD import qualified GHC.IO.FD as FD import GHC.IO.Handle -import GHC.IO.Handle.Text ( hGetBufSome ) +import GHC.IO.Handle.Text ( hGetBufSome, hPutStrLn ) import GHC.IORef import GHC.IO.Exception ( userError ) import GHC.IO.Encoding @@ -325,8 +327,7 @@ putStr s = hPutStr stdout s -- | The same as 'putStr', but adds a newline character. putStrLn :: String -> IO () -putStrLn s = do putStr s - putChar '\n' +putStrLn s = hPutStrLn stdout s -- | The 'print' function outputs a value of any printable type to the -- standard output device. @@ -424,13 +425,6 @@ readIO s = case (do { (x,t) <- reads s ; hReady :: Handle -> IO Bool hReady h = hWaitForInput h 0 --- | The same as 'hPutStr', but adds a newline character. - -hPutStrLn :: Handle -> String -> IO () -hPutStrLn hndl str = do - hPutStr hndl str - hPutChar hndl '\n' - -- | Computation 'hPrint' @hdl t@ writes the string representation of @t@ -- given by the 'shows' function to the file or channel managed by @hdl@ -- and appends a newline.