ListLike-4.5.1: Generic support for list-like structures

Copyright | Copyright (C) 2007 John Goerzen
License | BSD3
Maintainer | John Lato <jwlato@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

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

# 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

hGetLine, hGetContents, hGet, hGetNonBlocking, hPutStr

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.

getLine :: IO full #

Read one line

getContents :: IO full #

Read entire content from stdin. See `hGetContents`.

putStr :: full -> IO () #

Write data to stdout.

putStrLn :: full -> IO () #

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 CharStringLazy Char # |
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 CharString Char # |
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 Chars Char # |
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 () # getLine :: IO Chars # getContents :: IO Chars # putStr :: Chars -> IO () # putStrLn :: Chars -> IO () # interact :: (Chars -> Chars) -> IO () # readFile :: FilePath -> IO Chars # writeFile :: FilePath -> Chars -> IO () # appendFile :: FilePath -> Chars -> IO () #