{-# LANGUAGE CPP #-}
module Internal
( bsToStrict
, bsFromStrict
, (<$>)
, pure
, Data.Monoid.mempty
, (<>)
) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative
#endif
import Data.Monoid
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BS.L
#if !MIN_VERSION_base(4,5,0)
(<>) :: Monoid a => a -> a -> a
(<>) = mappend
infixr 6 <>
#endif
{-# INLINE bsToStrict #-}
bsToStrict :: BS.L.ByteString -> BS.ByteString
#if MIN_VERSION_bytestring(0,10,0)
bsToStrict = BS.L.toStrict
#else
bsToStrict = BS.concat . BS.L.toChunks
#endif
{-# INLINE bsFromStrict #-}
bsFromStrict :: BS.ByteString -> BS.L.ByteString
#if MIN_VERSION_bytestring(0,10,0)
bsFromStrict = BS.L.fromStrict
#else
bsFromStrict = BS.L.fromChunks . (:[])
#endif