putStr package:ghc-internal

Write a string to the standard output device putStr is implemented as hPutStr stdout. This operation may fail with the same errors, and has the same issues with concurrency, as hPutStr!

Examples

Note that the following do not put a newline.
>>> putStr "Hello, World!"
Hello, World!
>>> putStr "\0052\0042\0050"
4*2
The same as putStr, but adds a newline character. This operation may fail with the same errors, and has the same issues with concurrency, as hPutStr!
Computation hPutStr hdl s writes the string s to the file or channel managed by hdl. Note that hPutStr is not concurrency safe unless the BufferMode of hdl is set to LineBuffering or BlockBuffering:
>>> let f = forkIO . hPutStr stdout

>>> in do hSetBuffering stdout NoBuffering; f "This is a longer string"; f ":D"; f "Hello Haskell"; pure ()
This: HDiesl lao  lHoansgkeerl lstring
>>> let f = forkIO . hPutStr stdout

>>> in do hSetBuffering stdout LineBuffering; f "This is a longer string"; f ":D"; f "Hello Haskell"; pure ()
This is a longer string:DHello Haskell
This operation may fail with:
The same as hPutStr, but adds a newline character. This operation may fail with the same errors, and has the same issues with concurrency, as hPutStr!