print package:ghc-internal

The print function outputs a value of any printable type to the standard output device. Printable types are those that are instances of class Show; print converts values to strings for output using the show operation and adds a newline. print is implemented as putStrLn . show This operation may fail with the same errors, and has the same issues with concurrency, as hPutStr!

Examples

>>> print [1, 2, 3]
[1,2,3]
Be careful when using print for outputting strings, as this will invoke show and cause strings to be printed with quotation marks and non-ascii symbols escaped.
>>> print "λ :D"
"\995 :D"
A program to print the first 8 integers and their powers of 2 could be written as:
>>> print [(n, 2^n) | n <- [0..8]]
[(0,1),(1,2),(2,4),(3,8),(4,16),(5,32),(6,64),(7,128),(8,256)]
An exception handler for Handle finalization that prints the error to the given Handle, but doesn't rethrow it.
Takes a value of type a and returns a concrete representation of that type.
Computation hPrint hdl t writes the string representation of t given by the show function to the file or channel managed by hdl and appends a newline. This operation may fail with the same errors as hPutStrLn

Examples

>>> hPrint stdout [1,2,3]
[1,2,3]
>>> hPrint stdin [4,5,6]
*** Exception: <stdin>: hPutStr: illegal operation (handle is not open for writing)
Selects printable Unicode characters (letters, numbers, marks, punctuation, symbols and spaces). This function returns False if its argument has one of the following GeneralCategorys, or True otherwise: