X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Flib%2Fstd%2FPrelude.lhs;h=7a09c42dc2e43b1ae6d114422acd21b8a48e824f;hb=bb864806cef069b0bba9fbaa92b4135f99041dcd;hp=8dcb1fec5dc768e0fe4ec9c527b53e840ef3a8db;hpb=940841711bb0c30326a5173d8107c2792919641c;p=ghc-hetmet.git diff --git a/ghc/lib/std/Prelude.lhs b/ghc/lib/std/Prelude.lhs index 8dcb1fe..7a09c42 100644 --- a/ghc/lib/std/Prelude.lhs +++ b/ghc/lib/std/Prelude.lhs @@ -74,6 +74,7 @@ import PrelList #ifndef USE_REPORT_PRELUDE hiding ( takeUInt_append ) #endif +import PrelIO import PrelIOBase import PrelException import PrelRead @@ -209,63 +210,3 @@ realToFrac :: (Real a, Fractional b) => a -> b realToFrac = fromRational . toRational \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}