IOSpec-0.3: A pure specification of the IO monad.

Safe HaskellSafe
LanguageHaskell98

Test.IOSpec.Teletype

Contents

Description

A pure specification of getChar and putChar.

Synopsis

The IOTeletype monad

data Teletype a #

An expression of type IOSpec Teletype a corresponds to an IO computation that may print to or read from stdout and stdin respectively.

There is a minor caveat here. I assume that stdin and stdout are not buffered. This is not the standard behaviour in many Haskell compilers.

Instances

Functor Teletype # 

Methods

fmap :: (a -> b) -> Teletype a -> Teletype b #

(<$) :: a -> Teletype b -> Teletype a #

Executable Teletype # 

Methods

step :: Teletype a -> VM (Step a) #

Pure getChar and putChar

getChar :: (:<:) Teletype f => IOSpec f Char #

The getChar function can be used to read a character from the teletype.

putChar :: Teletype :<: f => Char -> IOSpec f () #

The getChar function can be used to print a character to the teletype.

putStr :: Teletype :<: f => String -> IOSpec f () #