pipes-2.4.0: Compositional pipelines

Safe HaskellNone

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 :: () -> Server () String IO rSource

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

getLineC :: () -> Client String () IO rSource

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

readLnS :: Read a => () -> Server () a IO rSource

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

readLnC :: Read a => () -> Client a () IO rSource

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

Output

printB :: (Show a, Show a') => a' -> Proxy a' a a' a IO rSource

prints all values flowing through it to stdout

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

printD :: Show a => x -> Proxy x a x a IO rSource

prints all values flowing 'D'ownstream to stdout

printU :: Show a' => a' -> Proxy a' x a' x IO rSource

prints all values flowing 'U'pstream to stdout

putStrLnB :: String -> Proxy String String String String IO rSource

putStrLns all values flowing through it to stdout

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

putStrLnD :: x -> Proxy x String x String IO rSource

putStrLns all values flowing 'D'ownstream to stdout

putStrLnU :: String -> Proxy String x String x IO rSource

putStrLns all values flowing 'U'pstream to stdout

Interaction

promptS :: String -> Server String String IO rSource

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

promptC :: () -> Client String String IO rSource

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

Handle I/O

Input

hGetLineD :: Handle -> () -> Server () String IO rSource

Get input from a handle one line at a time and send 'D'ownstream

hGetLineU :: Handle -> () -> Client String () IO rSource

Get input from a handle one line at a time and send 'U'pstream

Output

hPrintB :: (Show a, Show a') => Handle -> a' -> Proxy a' a a' a IO rSource

prints all values flowing through it to a Handle

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

hPrintD :: Show a => Handle -> x -> Proxy x a x a IO rSource

prints all values flowing 'D'ownstream to a Handle

hPrintU :: Show a' => Handle -> a' -> Proxy a' x a' x IO rSource

prints all values flowing 'U'pstream to a Handle

hPutStrLnB :: Handle -> String -> Proxy String String String String IO rSource

putStrLns all values flowing through it to a Handle

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

hPutStrLnD :: Handle -> x -> Proxy x String x String IO rSource

putStrLns all values flowing 'D'ownstream to a Handle

hPutStrLnU :: Handle -> String -> Proxy String x String x IO rSource

putStrLns all values flowing 'U'pstream to a Handle