summaryrefslogtreecommitdiff
path: root/Presence/ByteStringOperators.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/ByteStringOperators.hs')
-rw-r--r--Presence/ByteStringOperators.hs59
1 files changed, 0 insertions, 59 deletions
diff --git a/Presence/ByteStringOperators.hs b/Presence/ByteStringOperators.hs
deleted file mode 100644
index e8485134..00000000
--- a/Presence/ByteStringOperators.hs
+++ /dev/null
@@ -1,59 +0,0 @@
1{-# LANGUAGE CPP #-}
2module ByteStringOperators where
3
4import qualified Data.ByteString as S (ByteString)
5import Data.ByteString.Lazy.Char8 as L
6import Control.Applicative
7
8#if MIN_VERSION_bytestring(0,10,0)
9#else
10-- These two were imported to provide an NFData instance.
11import qualified Data.ByteString.Lazy.Internal as L (ByteString(..))
12import Control.DeepSeq
13#endif
14
15
16(<++>) :: ByteString -> ByteString -> ByteString
17(<++.>) :: ByteString -> S.ByteString -> ByteString
18(<.++>) :: S.ByteString -> ByteString -> ByteString
19(<.++.>) :: S.ByteString -> S.ByteString -> ByteString
20a <++> b = L.append a b
21a <++.> b = L.append a (fromChunks [b])
22a <.++> b = L.append (fromChunks [a]) b
23a <.++.> b = fromChunks [a,b]
24infixr 5 <.++.>
25infixr 5 <.++>
26infixr 5 <++>
27infixr 5 <++.>
28
29
30(<++$>) :: Functor f => ByteString -> f ByteString -> f ByteString
31(<$++>) :: Functor f => f ByteString -> ByteString -> f ByteString
32(<$++$>) :: Applicative f => f ByteString -> f ByteString -> f ByteString
33a <++$> b = fmap (a<++>) b
34a <$++> b = fmap (<++>b) a
35a <$++$> b = liftA2 (<++>) a b
36infixr 6 <++$>
37infixr 6 <$++>
38infixr 6 <$++$>
39
40(<?++>) :: Maybe ByteString -> ByteString -> ByteString
41Nothing <?++> b = b
42Just a <?++> b = a <++> b
43infixr 5 <?++>
44
45(<++?>) :: ByteString -> Maybe ByteString -> ByteString
46a <++?> Nothing = a
47a <++?> Just b = a <++> b
48infixr 5 <++?>
49
50bshow :: Show a => a -> ByteString
51bshow = L.pack . show
52
53
54#if MIN_VERSION_bytestring(0,10,0)
55#else
56instance NFData L.ByteString where
57 rnf L.Empty = ()
58 rnf (L.Chunk _ b) = rnf b
59#endif