{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE Trustworthy #-}
module Universum.Print
( putStr
, putStrLn
, print
, Print
, putText
, putTextLn
, putLText
, putLTextLn
, hPutStr
, hPutStrLn
, hPrint
) where
import Data.Function ((.))
import Universum.Monad.Reexport (MonadIO, liftIO)
import Universum.Print.Internal (Print)
import qualified Universum.Print.Internal as I (hPutStrLn, hPutStr)
import qualified Prelude (print)
import qualified System.IO as SIO (Handle, hPrint)
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
import qualified Universum.Base as Base
hPutStr :: (Print a, MonadIO m) => SIO.Handle -> a -> m ()
hPutStr h = liftIO . I.hPutStr h
{-# SPECIALIZE hPutStr :: Print a => SIO.Handle -> a -> Base.IO () #-}
hPutStrLn :: (Print a, MonadIO m) => SIO.Handle -> a -> m ()
hPutStrLn h = liftIO . I.hPutStrLn h
{-# SPECIALIZE hPutStrLn :: Print a => SIO.Handle -> a -> Base.IO () #-}
putStr :: (Print a, MonadIO m) => a -> m ()
putStr = hPutStr Base.stdout
{-# SPECIALIZE putStr :: Print a => a -> Base.IO () #-}
putStrLn :: (Print a, MonadIO m) => a -> m ()
putStrLn = hPutStrLn Base.stdout
{-# SPECIALIZE putStrLn :: Print a => a -> Base.IO () #-}
print :: forall a m . (MonadIO m, Base.Show a) => a -> m ()
print = liftIO . Prelude.print
{-# SPECIALIZE print :: Base.Show a => a -> Base.IO () #-}
hPrint :: (MonadIO m, Base.Show a) => SIO.Handle -> a -> m ()
hPrint h = liftIO . SIO.hPrint h
{-# SPECIALIZE hPrint :: Base.Show a => SIO.Handle -> a -> Base.IO () #-}
putText :: MonadIO m => T.Text -> m ()
putText = putStr
{-# SPECIALIZE putText :: T.Text -> Base.IO () #-}
putTextLn :: MonadIO m => T.Text -> m ()
putTextLn = putStrLn
{-# SPECIALIZE putTextLn :: T.Text -> Base.IO () #-}
putLText :: MonadIO m => TL.Text -> m ()
putLText = putStr
{-# SPECIALIZE putLText :: TL.Text -> Base.IO () #-}
putLTextLn :: MonadIO m => TL.Text -> m ()
putLTextLn = putStrLn
{-# SPECIALIZE putLTextLn :: TL.Text -> Base.IO () #-}