[project @ 2000-04-10 12:12:27 by simonpj]
[ghc-hetmet.git] / ghc / lib / std / IO.lhs
index 7ddeb03..daf0d09 100644 (file)
@@ -87,32 +87,29 @@ module IO (
 
 #ifdef __HUGS__
 import Ix(Ix)
-import Prelude
-import privileged Prelude ( IORef
-                         , unsafePerformIO
-                         , prelCleanupAfterRunAction
-                         , copy_String_to_cstring
-                         , primIntToChar
-                         , primWriteCharOffAddr
-                         , nullAddr
-                         , newIORef
-                         , writeIORef
-                         , readIORef
-                         , nh_close
-                         , nh_errno
-                         , nh_stdin
-                         , nh_stdout
-                         , nh_stderr
-                         , nh_flush
-                         , nh_open
-                         , nh_free
-                         , nh_read
-                         , nh_write
-                         , nh_filesize
-                         , nh_iseof
-                         )
-                       
-
+import PrelPrim ( IORef
+               , unsafePerformIO
+               , prelCleanupAfterRunAction
+               , copy_String_to_cstring
+               , primIntToChar
+               , primWriteCharOffAddr
+               , nullAddr
+               , newIORef
+               , writeIORef
+               , readIORef
+               , nh_close
+               , nh_errno
+               , nh_stdin
+               , nh_stdout
+               , nh_stderr
+               , nh_flush
+               , nh_open
+               , nh_free
+               , nh_read
+               , nh_write
+               , nh_filesize
+               , nh_iseof
+               )
 #else
 --import PrelST
 import PrelBase
@@ -646,65 +643,13 @@ bracket_ before after m = do
             Left  e -> ioError e
 \end{code}
 
-%*********************************************************
-%*                                                      *
-\subsection{Standard IO}
-%*                                                      *
-%*********************************************************
-
-The Prelude has from Day 1 provided a collection of common
-IO functions. We define these here, but let the Prelude
-export them.
-
-\begin{code}
-putChar         :: Char -> IO ()
-putChar c       =  hPutChar stdout c
-
-putStr          :: String -> IO ()
-putStr s        =  hPutStr stdout s
-
-putStrLn        :: String -> IO ()
-putStrLn s      =  do putStr s
-                      putChar '\n'
-
-print           :: Show a => a -> IO ()
-print x         =  putStrLn (show x)
-
-getChar         :: IO Char
-getChar         =  hGetChar stdin
-
-getLine         :: IO String
-getLine         =  hGetLine stdin
-            
-getContents     :: IO String
-getContents     =  hGetContents stdin
 
-interact        ::  (String -> String) -> IO ()
-interact f      =   do s <- getContents
-                       putStr (f s)
 
-readFile        :: FilePath -> IO String
-readFile name  =  openFile name ReadMode >>= hGetContents
-
-writeFile       :: FilePath -> String -> IO ()
-writeFile name str = do
-    hdl <- openFile name WriteMode
-    hPutStr hdl str
-    hClose hdl
-
-appendFile      :: FilePath -> String -> IO ()
-appendFile name str = do
-    hdl <- openFile name AppendMode
-    hPutStr hdl str
-    hClose hdl
-
-readLn          :: Read a => IO a
-readLn          =  do l <- getLine
-                      r <- readIO l
-                      return r
-
-
-\end{code}
+%*********************************************************
+%*                                                     *
+\subsection{The HUGS version of IO
+%*                                                     *
+%*********************************************************
 
 #else /* __HUGS__ */