pipes-3.0.0: Compositional pipelines

Safe HaskellSafe
LanguageHaskell98

Control.Proxy.Prelude.IO

Contents

Description

String-based IO operations.

Note that Strings are very inefficient, and I will release future separate packages with ByteString and Text operations. I only provide these to allow users to test simple I/O without requiring additional library dependencies.

Synopsis

Standard I/O

Input

getLineS :: Proxy p => () -> Producer p String IO r Source #

A Producer that sends lines from stdin downstream

getLineC :: Proxy p => () -> CoProducer p String IO r Source #

A CoProducer that sends lines from stdin upstream

readLnS :: (Read b, Proxy p) => () -> Producer p b IO r Source #

read input from stdin one line at a time and send 'D'ownstream

readLnC :: (Read a', Proxy p) => () -> CoProducer p a' IO r Source #

read input from stdin one line at a time and send 'U'pstream

Output

printB :: (Show a', Show a, Proxy p) => a' -> p a' a a' a IO r Source #

prints all values flowing through it to stdout

Prefixes upstream values with "U: " and downstream values with "D: "

printD :: (Show a, Proxy p) => x -> p x a x a IO r Source #

prints all values flowing 'D'ownstream to stdout

printU :: (Show a', Proxy p) => a' -> p a' x a' x IO r Source #

prints all values flowing 'U'pstream to stdout

putStrLnB :: Proxy p => String -> p String String String String IO r Source #

putStrLns all values flowing through it to stdout

Prefixes upstream values with "U: " and downstream values with "D: "

putStrLnD :: Proxy p => x -> p x String x String IO r Source #

putStrLns all values flowing 'D'ownstream to stdout

putStrLnU :: Proxy p => String -> p String x String x IO r Source #

putStrLns all values flowing 'U'pstream to stdout

Interaction

promptS :: Proxy p => String -> Server p String String IO r Source #

Convert 'stdin'/'stdout' into a line-based Server

promptC :: Proxy p => () -> Client p String String IO r Source #

Convert 'stdin'/'stdout' into a line-based Client

Handle I/O

Input

hGetLineS :: Proxy p => Handle -> () -> Producer p String IO () Source #

A Producer that sends lines from a handle downstream

hGetLineC :: Proxy p => Handle -> () -> CoProducer p String IO () Source #

A CoProducer that sends lines from a Handle upstream

Output

hPrintB :: (Show a, Show a', Proxy p) => Handle -> a' -> p a' a a' a IO r Source #

prints all values flowing through it to a Handle

Prefixes upstream values with "U: " and downstream values with "D: "

hPrintD :: (Show a, Proxy p) => Handle -> x -> p x a x a IO r Source #

prints all values flowing 'D'ownstream to a Handle

hPrintU :: (Show a', Proxy p) => Handle -> a' -> p a' x a' x IO r Source #

prints all values flowing 'U'pstream to a Handle

hPutStrLnB :: Proxy p => Handle -> String -> p String String String String IO r Source #

putStrLns all values flowing through it to a Handle

Prefixes upstream values with "U: " and downstream values with "D: "

hPutStrLnD :: Proxy p => Handle -> x -> p x String x String IO r Source #

putStrLns all values flowing 'D'ownstream to a Handle

hPutStrLnU :: Proxy p => Handle -> String -> p String x String x IO r Source #

putStrLns all values flowing 'U'pstream to a Handle