diff options
Diffstat (limited to 'Presence/ByteStringOperators.hs')
-rw-r--r-- | Presence/ByteStringOperators.hs | 59 |
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 #-} | ||
2 | module ByteStringOperators where | ||
3 | |||
4 | import qualified Data.ByteString as S (ByteString) | ||
5 | import Data.ByteString.Lazy.Char8 as L | ||
6 | import Control.Applicative | ||
7 | |||
8 | #if MIN_VERSION_bytestring(0,10,0) | ||
9 | #else | ||
10 | -- These two were imported to provide an NFData instance. | ||
11 | import qualified Data.ByteString.Lazy.Internal as L (ByteString(..)) | ||
12 | import 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 | ||
20 | a <++> b = L.append a b | ||
21 | a <++.> b = L.append a (fromChunks [b]) | ||
22 | a <.++> b = L.append (fromChunks [a]) b | ||
23 | a <.++.> b = fromChunks [a,b] | ||
24 | infixr 5 <.++.> | ||
25 | infixr 5 <.++> | ||
26 | infixr 5 <++> | ||
27 | infixr 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 | ||
33 | a <++$> b = fmap (a<++>) b | ||
34 | a <$++> b = fmap (<++>b) a | ||
35 | a <$++$> b = liftA2 (<++>) a b | ||
36 | infixr 6 <++$> | ||
37 | infixr 6 <$++> | ||
38 | infixr 6 <$++$> | ||
39 | |||
40 | (<?++>) :: Maybe ByteString -> ByteString -> ByteString | ||
41 | Nothing <?++> b = b | ||
42 | Just a <?++> b = a <++> b | ||
43 | infixr 5 <?++> | ||
44 | |||
45 | (<++?>) :: ByteString -> Maybe ByteString -> ByteString | ||
46 | a <++?> Nothing = a | ||
47 | a <++?> Just b = a <++> b | ||
48 | infixr 5 <++?> | ||
49 | |||
50 | bshow :: Show a => a -> ByteString | ||
51 | bshow = L.pack . show | ||
52 | |||
53 | |||
54 | #if MIN_VERSION_bytestring(0,10,0) | ||
55 | #else | ||
56 | instance NFData L.ByteString where | ||
57 | rnf L.Empty = () | ||
58 | rnf (L.Chunk _ b) = rnf b | ||
59 | #endif | ||