module ByteStringOperators where import qualified Data.ByteString as S (ByteString) import Data.ByteString.Lazy.Char8 as L -- These two were imported to provide an NFData instance. import qualified Data.ByteString.Lazy.Internal as L (ByteString(..)) import Control.DeepSeq (<++>) :: ByteString -> ByteString -> ByteString (<++.>) :: ByteString -> S.ByteString -> ByteString (<.++>) :: S.ByteString -> ByteString -> ByteString (<.++.>) :: S.ByteString -> S.ByteString -> ByteString a <++> b = L.append a b a <++.> b = L.append a (fromChunks [b]) a <.++> b = L.append (fromChunks [a]) b a <.++.> b = fromChunks [a,b] infixr 5 <.++.> infixr 5 <.++> infixr 5 <++> infixr 5 <++.> Nothing b = b Just a b = a <++> b infixr 5 a <++?> Nothing = a a <++?> Just b = a <++> b infixr 5 <++?> bshow :: Show a => a -> ByteString bshow = L.pack . show instance NFData L.ByteString where rnf L.Empty = () rnf (L.Chunk _ b) = rnf b