IOSpec-0.1: A pure specification of the IO monad.Source codeContentsIndex
Test.IOSpec.Teletype
Contents
The IOTeletype monad
Pure getChar and putChar
Description
A pure implementation of getChar and putChar.
Synopsis
data IOTeletype a
data Output a
= Print Char (Output a)
| Finish a
runTT :: IOTeletype a -> Stream Char -> Output a
getChar :: IOTeletype Char
putChar :: Char -> IOTeletype ()
The IOTeletype monad
data IOTeletype a Source
The IOTeletype monad
show/hide Instances
data Output a Source
The result of running a teletype interation is a (potentially infinite) list of characters, that are printed to the screen. The interaction can also end, and return a final value, using the Finish constructor.
Constructors
Print Char (Output a)
Finish a
runTT :: IOTeletype a -> Stream Char -> Output aSource
Once you have constructed something of type IOTeletype you can run the interaction. If you pass in a stream of characters entered at the teletype, it will produce a value of type Output
Pure getChar and putChar
getChar :: IOTeletype CharSource
The getChar function can be used to read input from the teletype.
putChar :: Char -> IOTeletype ()Source
The getChar function can be used to print to the teletype.
Produced by Haddock version 2.6.0