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

Safe Haskell | Safe-Inferred
Language | Haskell98

Test.IOSpec.Teletype

Contents

- The IOTeletype monad
- Pure getChar and putChar

Description

A pure specification of getChar and putChar.

Synopsis

- data Teletype a
- getChar :: forall (f :: Type -> Type). Teletype :<: f => IOSpec f Char
- putChar :: forall (f :: Type -> Type). Teletype :<: f => Char -> IOSpec f ()
- putStr :: forall (f :: Type -> Type). Teletype :<: f => String -> IOSpec f ()
- putStrLn :: forall (f :: Type -> Type). Teletype :<: f => String -> IOSpec f ()
- getLine :: forall (f :: Type -> Type). Teletype :<: f => IOSpec f String

# The IOTeletype monad

data Teletype a Source #

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

Instances details

Executable Teletype Source # |
Instance details Defined in Test.IOSpec.Teletype Methods step :: Teletype a -> VM (Step a) Source #
Functor Teletype Source # |
Instance details Defined in Test.IOSpec.Teletype Methods fmap :: (a -> b) -> Teletype a -> Teletype b Source # (<$) :: a -> Teletype b -> Teletype a Source #

# Pure getChar and putChar

getChar :: forall (f :: Type -> Type). Teletype :<: f => IOSpec f Char Source #

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

putChar :: forall (f :: Type -> Type). Teletype :<: f => Char -> IOSpec f () Source #

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

putStr :: forall (f :: Type -> Type). Teletype :<: f => String -> IOSpec f () Source #

putStrLn :: forall (f :: Type -> Type). Teletype :<: f => String -> IOSpec f () Source #

getLine :: forall (f :: Type -> Type). Teletype :<: f => IOSpec f String Source #