haskell-course-preludes-0.0.0.4: Small modules for a Haskell course in which Haskell is taught by implementing Prelude functionality.

Safe HaskellNone

Prelude.OldIO

Contents

Synopsis

IO Requests and responses

data IORequest Source

Constructors

Print String 
PrintChar Char 
GetLine 
ReadFile FilePath 
WriteToFile FilePath String 
Exit 

data IOResponse Source

Constructors

Success 
FileContents String 
ConsoleLine String 

Instances

run :: ([IOResponse] -> [IORequest]) -> IO ()Source

Other convenient operators

(.) :: (b -> c) -> (a -> b) -> a -> c

Function composition.

trace :: String -> a -> a

The trace function outputs the trace message given as its first argument, before returning the second argument as its result.

For example, this returns the value of f x but first outputs the message.

 trace ("calling f with x = " ++ show x) (f x)

The trace function should only be used for debugging, or for monitoring execution. The function is not referentially transparent: its type indicates that it is a pure function but it has the side effect of outputting the trace message.