on master help sign in
Fix up some documentation.

--HG-- extra : convert_revision : 6e59315b906d21d65204423d3fb9b229754e6a83

commit2c4a9c76666fd0d649301e603522ba4c9bb1d427 authorBryan O'Sullivan <bos@serpentine.com> dateTue 15 Dec 2009, 08:16 (17 years ago) parent9eb2a7c
1 file changed+8−7
Data/Text/Lazy/IO.hs+8−7
Data/Text/Lazy/IO.hs+8−7
@@ -8,7 +8,7 @@
88-- Stability : experimental
99-- Portability : GHC
1010--
11−-- Efficient locale-sensitive support for text I\/O.
11+-- Efficient locale-sensitive support for lazy text I\/O.
1212
1313module Data.Text.Lazy.IO
1414 (
@@ -56,9 +56,8 @@ import System.IO.Error (isEOFError)
5656import System.IO.Unsafe (unsafeInterleaveIO)
5757#endif
5858
59−-- | The 'readFile' function reads a file and returns the contents of
60−-- the file as a string. The entire file is read strictly, as with
61−-- 'getContents'.
59+-- | Read a file and return its contents as a string. The file is
60+-- read lazily, as with 'getContents'.
6261readFile :: FilePath -> IO Text
6362readFile name = openFile name ReadMode >>= hGetContents
6463
@@ -71,6 +70,8 @@ writeFile p = withFile p WriteMode . flip hPutStr
7170appendFile :: FilePath -> Text -> IO ()
7271appendFile p = withFile p AppendMode . flip hPutStr
7372
73+-- | Lazily read the remaining contents of a 'Handle'. The 'Handle'
74+-- will be closed after the read completes, or on error.
7475hGetContents :: Handle -> IO Text
7576#if __GLASGOW_HASKELL__ <= 610
7677hGetContents = fmap decodeUtf8 . L8.hGetContents
@@ -122,12 +123,12 @@ hPutStrLn h t = hPutStr h t >> hPutChar h '\n'
122123
123124-- | The 'interact' function takes a function of type @Text -> Text@
124125-- as its argument. The entire input from the standard input device is
125−-- passed to this function as its argument, and the resulting string
126−-- is output on the standard output device.
126+-- passed (lazily) to this function as its argument, and the resulting
127+-- string is output on the standard output device.
127128interact :: (Text -> Text) -> IO ()
128129interact f = putStr . f =<< getContents
129130
130−-- | Read all user input on 'stdin' as a single string.
131+-- | Lazily read all user input on 'stdin' as a single string.
131132getContents :: IO Text
132133getContents = hGetContents stdin
133134