#if !(MIN_VERSION_bytestring(0,10,0))
#endif
module Text.Show.Text.Data.ByteString (
showbByteStringStrict
, showbByteStringLazy
, showbByteStringLazyPrec
#if MIN_VERSION_bytestring(0,10,4)
, showbShortByteString
#endif
) where
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
#if MIN_VERSION_bytestring(0,10,4)
import Data.ByteString.Short (ShortByteString)
#endif
import Data.Text.Lazy.Builder (Builder)
import Prelude hiding (Show(show))
import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))
#if !(MIN_VERSION_bytestring(0,10,0))
import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
#endif
#include "inline.h"
showbByteStringStrict :: BS.ByteString -> Builder
showbByteStringStrict = showb . FromStringShow
showbByteStringLazy :: BL.ByteString -> Builder
showbByteStringLazy = showbByteStringLazyPrec 0
showbByteStringLazyPrec :: Int -> BL.ByteString -> Builder
#if MIN_VERSION_bytestring(0,10,0)
showbByteStringLazyPrec _ = showb . FromStringShow
#else
showbByteStringLazyPrec = showbPrec
#endif
#if MIN_VERSION_bytestring(0,10,4)
showbShortByteString :: ShortByteString -> Builder
showbShortByteString = showb . FromStringShow
#endif
instance Show BS.ByteString where
showb = showbByteStringStrict
INLINE_INST_FUN(showb)
#if MIN_VERSION_bytestring(0,10,0)
instance Show BL.ByteString where
showbPrec = showbByteStringLazyPrec
INLINE_INST_FUN(showbPrec)
#else
$(deriveShowPragmas defaultInlineShowbPrec ''BL.ByteString)
#endif
#if MIN_VERSION_bytestring(0,10,4)
instance Show ShortByteString where
showb = showbShortByteString
INLINE_INST_FUN(showb)
#endif