Copyright | Copyright (C) 2007 John Goerzen |
---|---|
License | BSD3 |
Maintainer | David Fox <dsf@seereason.com>, Andreas Abel |
Stability | stable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.ListLike.IO
Description
String-like functions
Written by John Goerzen, jgoerzen@complete.org
Synopsis
- class ListLike full item => ListLikeIO full item | full -> item where
- hGetLine :: Handle -> IO full
- hGetContents :: Handle -> IO full
- hGet :: Handle -> Int -> IO full
- hGetNonBlocking :: Handle -> Int -> IO full
- hPutStr :: Handle -> full -> IO ()
- hPutStrLn :: Handle -> full -> IO ()
- getLine :: IO full
- getContents :: IO full
- putStr :: full -> IO ()
- putStrLn :: full -> IO ()
- interact :: (full -> full) -> IO ()
- readFile :: FilePath -> IO full
- writeFile :: FilePath -> full -> IO ()
- appendFile :: FilePath -> full -> IO ()
Documentation
class ListLike full item => ListLikeIO full item | full -> item where #
An extension to ListLike
for those data types that support
I/O. These functions mirror those in System.IO for the most part. They
also share the same names; see the comments in Data.ListLike for help
importing them.
Note that some types may not be capable of lazy reading or writing. Therefore, the usual semantics of System.IO functions regarding laziness may or may not be available from a particular implementation.
Minimal complete definition:
- hGetLine
- hGetContents
- hGet
- hGetNonBlocking
- hPutStr
Minimal complete definition
Methods
hGetLine :: Handle -> IO full #
Reads a line from the specified handle
hGetContents :: Handle -> IO full #
Read entire handle contents. May be done lazily like
hGetContents
.
hGet :: Handle -> Int -> IO full #
Read specified number of bytes. See hGet
for
particular semantics.
hGetNonBlocking :: Handle -> Int -> IO full #
Non-blocking read. See hGetNonBlocking
for more.
hPutStr :: Handle -> full -> IO () #
Writing entire data.
hPutStrLn :: Handle -> full -> IO () #
Write data plus newline character.
Read one line
getContents :: IO full #
Read entire content from stdin. See hGetContents
.
Write data to stdout.
Write data plus newline character to stdout.
interact :: (full -> full) -> IO () #
Interact with stdin and stdout by using a function to transform
input to output. May be lazy. See interact
for more.
readFile :: FilePath -> IO full #
Read file. May be lazy.
writeFile :: FilePath -> full -> IO () #
Write data to file.
appendFile :: FilePath -> full -> IO () #
Append data to file.
Instances
ListLikeIO CharString Char # | |
Defined in Data.ListLike.CharString Methods hGetLine :: Handle -> IO CharString # hGetContents :: Handle -> IO CharString # hGet :: Handle -> Int -> IO CharString # hGetNonBlocking :: Handle -> Int -> IO CharString # hPutStr :: Handle -> CharString -> IO () # hPutStrLn :: Handle -> CharString -> IO () # getLine :: IO CharString # getContents :: IO CharString # putStr :: CharString -> IO () # putStrLn :: CharString -> IO () # interact :: (CharString -> CharString) -> IO () # readFile :: FilePath -> IO CharString # writeFile :: FilePath -> CharString -> IO () # appendFile :: FilePath -> CharString -> IO () # | |
ListLikeIO CharStringLazy Char # | |
Defined in Data.ListLike.CharString Methods hGetLine :: Handle -> IO CharStringLazy # hGetContents :: Handle -> IO CharStringLazy # hGet :: Handle -> Int -> IO CharStringLazy # hGetNonBlocking :: Handle -> Int -> IO CharStringLazy # hPutStr :: Handle -> CharStringLazy -> IO () # hPutStrLn :: Handle -> CharStringLazy -> IO () # getLine :: IO CharStringLazy # getContents :: IO CharStringLazy # putStr :: CharStringLazy -> IO () # putStrLn :: CharStringLazy -> IO () # interact :: (CharStringLazy -> CharStringLazy) -> IO () # readFile :: FilePath -> IO CharStringLazy # writeFile :: FilePath -> CharStringLazy -> IO () # appendFile :: FilePath -> CharStringLazy -> IO () # | |
ListLikeIO Chars Char # | |
Defined in Data.ListLike.Chars Methods hGetLine :: Handle -> IO Chars # hGetContents :: Handle -> IO Chars # hGet :: Handle -> Int -> IO Chars # hGetNonBlocking :: Handle -> Int -> IO Chars # hPutStr :: Handle -> Chars -> IO () # hPutStrLn :: Handle -> Chars -> IO () # getContents :: IO Chars # interact :: (Chars -> Chars) -> IO () # readFile :: FilePath -> IO Chars # writeFile :: FilePath -> Chars -> IO () # appendFile :: FilePath -> Chars -> IO () # | |
ListLikeIO ByteString Word8 # | |
Defined in Data.ListLike.Instances Methods hGetLine :: Handle -> IO ByteString # hGetContents :: Handle -> IO ByteString # hGet :: Handle -> Int -> IO ByteString # hGetNonBlocking :: Handle -> Int -> IO ByteString # hPutStr :: Handle -> ByteString -> IO () # hPutStrLn :: Handle -> ByteString -> IO () # getLine :: IO ByteString # getContents :: IO ByteString # putStr :: ByteString -> IO () # putStrLn :: ByteString -> IO () # interact :: (ByteString -> ByteString) -> IO () # readFile :: FilePath -> IO ByteString # writeFile :: FilePath -> ByteString -> IO () # appendFile :: FilePath -> ByteString -> IO () # | |
ListLikeIO ByteString Word8 # | |
Defined in Data.ListLike.Instances Methods hGetLine :: Handle -> IO ByteString # hGetContents :: Handle -> IO ByteString # hGet :: Handle -> Int -> IO ByteString # hGetNonBlocking :: Handle -> Int -> IO ByteString # hPutStr :: Handle -> ByteString -> IO () # hPutStrLn :: Handle -> ByteString -> IO () # getLine :: IO ByteString # getContents :: IO ByteString # putStr :: ByteString -> IO () # putStrLn :: ByteString -> IO () # interact :: (ByteString -> ByteString) -> IO () # readFile :: FilePath -> IO ByteString # writeFile :: FilePath -> ByteString -> IO () # appendFile :: FilePath -> ByteString -> IO () # | |
ListLikeIO Text Char # | |
Defined in Data.ListLike.Text.Text Methods hGetLine :: Handle -> IO Text # hGetContents :: Handle -> IO Text # hGet :: Handle -> Int -> IO Text # hGetNonBlocking :: Handle -> Int -> IO Text # hPutStr :: Handle -> Text -> IO () # hPutStrLn :: Handle -> Text -> IO () # getContents :: IO Text # interact :: (Text -> Text) -> IO () # readFile :: FilePath -> IO Text # writeFile :: FilePath -> Text -> IO () # appendFile :: FilePath -> Text -> IO () # | |
ListLikeIO Builder Char # | |
Defined in Data.ListLike.Text.Builder Methods hGetLine :: Handle -> IO Builder # hGetContents :: Handle -> IO Builder # hGet :: Handle -> Int -> IO Builder # hGetNonBlocking :: Handle -> Int -> IO Builder # hPutStr :: Handle -> Builder -> IO () # hPutStrLn :: Handle -> Builder -> IO () # getContents :: IO Builder # putStrLn :: Builder -> IO () # interact :: (Builder -> Builder) -> IO () # readFile :: FilePath -> IO Builder # writeFile :: FilePath -> Builder -> IO () # appendFile :: FilePath -> Builder -> IO () # | |
ListLikeIO Text Char # | |
Defined in Data.ListLike.Text.TextLazy Methods hGetLine :: Handle -> IO Text # hGetContents :: Handle -> IO Text # hGet :: Handle -> Int -> IO Text # hGetNonBlocking :: Handle -> Int -> IO Text # hPutStr :: Handle -> Text -> IO () # hPutStrLn :: Handle -> Text -> IO () # getContents :: IO Text # interact :: (Text -> Text) -> IO () # readFile :: FilePath -> IO Text # writeFile :: FilePath -> Text -> IO () # appendFile :: FilePath -> Text -> IO () # | |
ListLikeIO String Char # | |
Defined in Data.ListLike.Instances Methods hGetLine :: Handle -> IO String # hGetContents :: Handle -> IO String # hGet :: Handle -> Int -> IO String # hGetNonBlocking :: Handle -> Int -> IO String # hPutStr :: Handle -> String -> IO () # hPutStrLn :: Handle -> String -> IO () # getContents :: IO String # interact :: (String -> String) -> IO () # readFile :: FilePath -> IO String # writeFile :: FilePath -> String -> IO () # appendFile :: FilePath -> String -> IO () # | |
ListLikeIO (Seq Char) Char # | |
Defined in Data.ListLike.Instances Methods hGetLine :: Handle -> IO (Seq Char) # hGetContents :: Handle -> IO (Seq Char) # hGet :: Handle -> Int -> IO (Seq Char) # hGetNonBlocking :: Handle -> Int -> IO (Seq Char) # hPutStr :: Handle -> Seq Char -> IO () # hPutStrLn :: Handle -> Seq Char -> IO () # getContents :: IO (Seq Char) # putStrLn :: Seq Char -> IO () # interact :: (Seq Char -> Seq Char) -> IO () # readFile :: FilePath -> IO (Seq Char) # writeFile :: FilePath -> Seq Char -> IO () # appendFile :: FilePath -> Seq Char -> IO () # | |
ListLikeIO (UTF8 ByteString) Char # | |
Defined in Data.ListLike.UTF8 Methods hGetLine :: Handle -> IO (UTF8 ByteString) # hGetContents :: Handle -> IO (UTF8 ByteString) # hGet :: Handle -> Int -> IO (UTF8 ByteString) # hGetNonBlocking :: Handle -> Int -> IO (UTF8 ByteString) # hPutStr :: Handle -> UTF8 ByteString -> IO () # hPutStrLn :: Handle -> UTF8 ByteString -> IO () # getLine :: IO (UTF8 ByteString) # getContents :: IO (UTF8 ByteString) # putStr :: UTF8 ByteString -> IO () # putStrLn :: UTF8 ByteString -> IO () # interact :: (UTF8 ByteString -> UTF8 ByteString) -> IO () # readFile :: FilePath -> IO (UTF8 ByteString) # writeFile :: FilePath -> UTF8 ByteString -> IO () # appendFile :: FilePath -> UTF8 ByteString -> IO () # | |
ListLikeIO (UTF8 ByteString) Char # | |
Defined in Data.ListLike.UTF8 Methods hGetLine :: Handle -> IO (UTF8 ByteString) # hGetContents :: Handle -> IO (UTF8 ByteString) # hGet :: Handle -> Int -> IO (UTF8 ByteString) # hGetNonBlocking :: Handle -> Int -> IO (UTF8 ByteString) # hPutStr :: Handle -> UTF8 ByteString -> IO () # hPutStrLn :: Handle -> UTF8 ByteString -> IO () # getLine :: IO (UTF8 ByteString) # getContents :: IO (UTF8 ByteString) # putStr :: UTF8 ByteString -> IO () # putStrLn :: UTF8 ByteString -> IO () # interact :: (UTF8 ByteString -> UTF8 ByteString) -> IO () # readFile :: FilePath -> IO (UTF8 ByteString) # writeFile :: FilePath -> UTF8 ByteString -> IO () # appendFile :: FilePath -> UTF8 ByteString -> IO () # | |
(Integral i, Ix i) => ListLikeIO (Array i Char) Char # | |
Defined in Data.ListLike.Instances Methods hGetLine :: Handle -> IO (Array i Char) # hGetContents :: Handle -> IO (Array i Char) # hGet :: Handle -> Int -> IO (Array i Char) # hGetNonBlocking :: Handle -> Int -> IO (Array i Char) # hPutStr :: Handle -> Array i Char -> IO () # hPutStrLn :: Handle -> Array i Char -> IO () # getLine :: IO (Array i Char) # getContents :: IO (Array i Char) # putStr :: Array i Char -> IO () # putStrLn :: Array i Char -> IO () # interact :: (Array i Char -> Array i Char) -> IO () # readFile :: FilePath -> IO (Array i Char) # writeFile :: FilePath -> Array i Char -> IO () # appendFile :: FilePath -> Array i Char -> IO () # |