diff options
Diffstat (limited to 'Presence/ByteStringOperators.hs')
-rw-r--r-- | Presence/ByteStringOperators.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Presence/ByteStringOperators.hs b/Presence/ByteStringOperators.hs index 26b64bcf..2815f05a 100644 --- a/Presence/ByteStringOperators.hs +++ b/Presence/ByteStringOperators.hs | |||
@@ -3,6 +3,11 @@ module ByteStringOperators where | |||
3 | import qualified Data.ByteString as S (ByteString) | 3 | import qualified Data.ByteString as S (ByteString) |
4 | import Data.ByteString.Lazy.Char8 as L | 4 | import Data.ByteString.Lazy.Char8 as L |
5 | 5 | ||
6 | -- These two were imported to provide an NFData instance. | ||
7 | import qualified Data.ByteString.Lazy.Internal as L (ByteString(..)) | ||
8 | import Control.DeepSeq | ||
9 | |||
10 | |||
6 | (<++>) :: ByteString -> ByteString -> ByteString | 11 | (<++>) :: ByteString -> ByteString -> ByteString |
7 | (<++.>) :: ByteString -> S.ByteString -> ByteString | 12 | (<++.>) :: ByteString -> S.ByteString -> ByteString |
8 | (<.++>) :: S.ByteString -> ByteString -> ByteString | 13 | (<.++>) :: S.ByteString -> ByteString -> ByteString |
@@ -16,5 +21,20 @@ infixr 5 <.++> | |||
16 | infixr 5 <++> | 21 | infixr 5 <++> |
17 | infixr 5 <++.> | 22 | infixr 5 <++.> |
18 | 23 | ||
24 | Nothing <?++> b = b | ||
25 | Just a <?++> b = a <++> b | ||
26 | infixr 5 <?++> | ||
27 | |||
28 | a <++?> Nothing = a | ||
29 | a <++?> Just b = a <++> b | ||
30 | infixr 5 <++?> | ||
31 | |||
19 | bshow :: Show a => a -> ByteString | 32 | bshow :: Show a => a -> ByteString |
20 | bshow = L.pack . show | 33 | bshow = L.pack . show |
34 | |||
35 | |||
36 | instance NFData L.ByteString where | ||
37 | rnf L.Empty = () | ||
38 | rnf (L.Chunk _ b) = rnf b | ||
39 | |||
40 | |||