universum-1.8.1.1: Custom prelude used in Serokell
Copyright(c) Serokell 2018
LicenseMIT
MaintainerSerokell <hi@serokell.io>
Stabilityexperimental
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Universum.Print

Description

Generalizes the putStr family of functions for String likes such as lazy and strict versions of Text and ByteString.

A caveat to using overloaded functions is that printing string literals raises ambiguity errors in the presence of OverloadedStrings. To avoid this problem wither add a type annotation putStr ("Hello World!" :: Text) or use one of the type constrained functions putText, putLText etc.

You may add support for your own types by importing Universum.Print.Internal and implementing Print. However be advised that only the functions in this module should be considered stable, not the interface for Print.

Synopsis

Documentation

putStr :: (Print a, MonadIO m) => a -> m () Source #

Write a string like value to stdout/.

putStrLn :: (Print a, MonadIO m) => a -> m () Source #

Write a string like value to stdout appending a newline character.

print :: forall a m. (MonadIO m, Show a) => a -> m () Source #

Lifted version of print.

class Print a Source #

Support class to overload writing of string like values.

Minimal complete definition

hPutStr, hPutStrLn

Instances

Instances details
Print ByteString Source # 
Instance details

Defined in Universum.Print.Internal

Print ByteString Source # 
Instance details

Defined in Universum.Print.Internal

Print Text Source # 
Instance details

Defined in Universum.Print.Internal

Methods

hPutStr :: Handle -> Text -> IO () Source #

hPutStrLn :: Handle -> Text -> IO () Source #

Print Text Source # 
Instance details

Defined in Universum.Print.Internal

Methods

hPutStr :: Handle -> Text -> IO () Source #

hPutStrLn :: Handle -> Text -> IO () Source #

Print [Char] Source # 
Instance details

Defined in Universum.Print.Internal

Methods

hPutStr :: Handle -> [Char] -> IO () Source #

hPutStrLn :: Handle -> [Char] -> IO () Source #

putText :: MonadIO m => Text -> m () Source #

Specialized to Text version of putStr or forcing type inference.

putTextLn :: MonadIO m => Text -> m () Source #

Specialized to Text version of putStrLn or forcing type inference.

putLText :: MonadIO m => Text -> m () Source #

Specialized to Text version of putStr or forcing type inference.

putLTextLn :: MonadIO m => Text -> m () Source #

Specialized to Text version of putStrLn or forcing type inference.

Writing strings to an arbitrary Handle

hPutStr :: (Print a, MonadIO m) => Handle -> a -> m () Source #

Write a string like value a to a supplied Handle.

hPutStrLn :: (Print a, MonadIO m) => Handle -> a -> m () Source #

Write a string like value a to a supplied Handle, appending a newline character.

hPrint :: (MonadIO m, Show a) => Handle -> a -> m () Source #

Lifted version of hPrint