{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE FlexibleContexts  #-}

module Precursor.Text.Show
  ( TextShow(..)
  , show
  , gShowPrec
  , print
  ) where

import           Data.Text.Lazy (Text)
import           TextShow
import           TextShow.Generic
import           GHC.Generics
import           Prelude ((.), Int)
import           Data.Text.Lazy.IO (putStrLn)
import           Control.Monad.IO.Class (MonadIO, liftIO)

show :: TextShow a => a -> Text
show = toLazyText . showb

gShowPrec :: (Generic a, GTextShowB Zero (Rep a)) => Int -> a -> Builder
gShowPrec = genericShowbPrec

print :: (TextShow a, MonadIO m) => a -> m ()
print = liftIO . putStrLn . show