Add putErrLn to match putStrLn (#67)
* Add `putErrLn` to match `putStrLn` Fix #66 * Add putErr for the most usual inference case * Rename `putErr` into `putErrText` In order to allow further specializations in the future if necessary.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
module Protolude.Show (
|
||||
Print(..),
|
||||
putText,
|
||||
putErrText,
|
||||
putLText,
|
||||
putByteString,
|
||||
putLByteString,
|
||||
@@ -27,7 +28,7 @@ import qualified Data.Text.IO as T
|
||||
import qualified Data.Text.Lazy as TL
|
||||
import qualified Data.Text.Lazy.IO as TL
|
||||
|
||||
import System.IO (Handle, stdout)
|
||||
import System.IO (Handle, stdout, stderr)
|
||||
|
||||
|
||||
class Print a where
|
||||
@@ -37,6 +38,8 @@ class Print a where
|
||||
hPutStrLn :: MonadIO m => Handle -> a -> m ()
|
||||
putStrLn :: MonadIO m => a -> m ()
|
||||
putStrLn = hPutStrLn stdout
|
||||
putErrLn :: MonadIO m => a -> m ()
|
||||
putErrLn = hPutStrLn stderr
|
||||
|
||||
instance Print T.Text where
|
||||
hPutStr = \h -> liftIO . T.hPutStr h
|
||||
@@ -74,3 +77,7 @@ putByteString = putStrLn
|
||||
putLByteString :: MonadIO m => BL.ByteString -> m ()
|
||||
putLByteString = putStrLn
|
||||
{-# SPECIALIZE putLByteString :: BL.ByteString -> Base.IO () #-}
|
||||
|
||||
putErrText :: MonadIO m => T.Text -> m ()
|
||||
putErrText = putErrLn
|
||||
{-# SPECIALIZE putErrText :: T.Text -> Base.IO () #-}
|
||||
|
||||
Reference in New Issue
Block a user