hPutStr -package:rio
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:
A synonym for
hPut, for compatibility
Write a string to a handle.
Computation
hPutStr hdl s writes the string
s
to the file or channel managed by
hdl.
This operation may fail with:
Write a string like value
a to a supplied
Handle.
Like the normal
hPutStr, but encodes the output using an
encoding.
Write a string to a handle
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!
Write a ByteString to a handle, appending a newline byte.
Unlike
hPutStr, this is not atomic: other threads might write
to the handle between writing of the bytestring and the newline.
Write a ByteString to a handle, appending a newline byte.
The chunks will be written one at a time, followed by a newline. Other
threads might write to the
Handle in between, and hence
hPutStrLn alone is not suitable for concurrent writes.
Write a string to a handle, followed by a newline.
Given a list of strings, output a line containing each item, adding
newlines as appropriate. The list is not expected to have newlines
already.
The same as
hPutStr, but adds a newline character.
Write data plus newline character.
Write a string like value
a to a supplied
Handle,
appending a newline character.