| Portability | portable |
|---|---|
| Stability | stable |
| Maintainer | mihai.maruseac@gmail.com |
| Safe Haskell | Safe-Inferred |
Training.MM.IOManager
Contents
Description
A skeleton library to help learners of Haskell concentrate on the pure-functional aspect and let the IO be handled by the library.
- type Filename = String
- data Input
- data Output
- wrapIO :: (Input -> Output -> Output) -> IO ()
- getStdIn :: Input -> String
- getInputFile :: Input -> Filename -> String
- writeStdOut :: Output -> String -> Output
- writeStdErr :: Output -> String -> Output
- writeOutputFile :: Output -> Filename -> String -> Output
The Filename type
The Input type
The Output type
Exported for use in main pipeline
wrapIO :: (Input -> Output -> Output) -> IO ()Source
Wraps a simple function Input -> Output -> Output in
order to simplify student's usage.
Exported to be usable by students
getStdIn :: Input -> StringSource
Obtains the contents of the standard input as given to the program. Returns a String containing the input without any modification.
getInputFile :: Input -> Filename -> StringSource
Obtains the contents of an input file. Returns a String containing the input without any modification.
writeStdOut :: Output -> String -> OutputSource
Appends text to the standard output. No newline is printed at the end,
the caller must handle it. Returns a new Output value, containing the
appended text.
writeStdErr :: Output -> String -> OutputSource
Appends text to the standard error. No newline is printed at the end, the
caller must handle it. Returns a new Output value, containing the
appended text.
Note: When running the program, the standard error text is displayed after the entire text from the standard input is displayed.