|
4 | 4 | {-# LANGUAGE MultiParamTypeClasses #-} |
5 | 5 |
|
6 | 6 | module HaskellWorks.Data.Xml.Internal.ToIbBp64 |
7 | | - ( toBalancedParens64 |
8 | | - , toInterestBits64 |
9 | | - , toBalancedParens64' |
| 7 | + ( toBalancedParens64' |
10 | 8 | , toInterestBits64' |
11 | 9 | , toIbBp64 |
12 | 10 | ) where |
13 | 11 |
|
14 | | -import Control.Applicative |
15 | | -import Data.Word |
| 12 | +import Data.ByteString (ByteString) |
16 | 13 | import HaskellWorks.Data.Xml.Internal.BalancedParens |
17 | 14 | import HaskellWorks.Data.Xml.Internal.List |
18 | 15 | import HaskellWorks.Data.Xml.Succinct.Cursor.BlankedXml (BlankedXml (..)) |
19 | | -import HaskellWorks.Data.Xml.Succinct.Cursor.InterestBits (blankedXmlToInterestBits, genInterestForever) |
| 16 | +import HaskellWorks.Data.Xml.Succinct.Cursor.InterestBits (blankedXmlToInterestBits) |
20 | 17 |
|
21 | | -import qualified Data.ByteString as BS |
22 | | -import qualified Data.Vector.Storable as DVS |
23 | | - |
24 | | -genBitWordsForever :: BS.ByteString -> Maybe (Word8, BS.ByteString) |
25 | | -genBitWordsForever bs = BS.uncons bs <|> Just (0, bs) |
26 | | -{-# INLINABLE genBitWordsForever #-} |
27 | | - |
28 | | -toBalancedParens64 :: BlankedXml -> DVS.Vector Word64 |
29 | | -toBalancedParens64 (BlankedXml bj) = DVS.unsafeCast (DVS.unfoldrN newLen genBitWordsForever interestBS) |
30 | | - where interestBS = BS.concat (compressWordAsBit (blankedXmlToBalancedParens bj)) |
31 | | - newLen = (BS.length interestBS + 7) `div` 8 * 8 |
32 | | - |
33 | | -toBalancedParens64' :: BlankedXml -> [BS.ByteString] |
| 18 | +toBalancedParens64' :: BlankedXml -> [ByteString] |
34 | 19 | toBalancedParens64' (BlankedXml bj) = compressWordAsBit (blankedXmlToBalancedParens bj) |
35 | 20 |
|
36 | | -toInterestBits64 :: BlankedXml -> DVS.Vector Word64 |
37 | | -toInterestBits64 (BlankedXml bj) = DVS.unsafeCast (DVS.unfoldrN newLen genInterestForever interestBS) |
38 | | - where interestBS = BS.concat (blankedXmlToInterestBits bj) |
39 | | - newLen = (BS.length interestBS + 7) `div` 8 * 8 |
40 | | - |
41 | | -toInterestBits64' :: BlankedXml -> [BS.ByteString] |
| 21 | +toInterestBits64' :: BlankedXml -> [ByteString] |
42 | 22 | toInterestBits64' (BlankedXml bj) = blankedXmlToInterestBits bj |
43 | 23 |
|
44 | | -toIbBp64 :: BlankedXml -> [(BS.ByteString, BS.ByteString)] |
| 24 | +toIbBp64 :: BlankedXml -> [(ByteString, ByteString)] |
45 | 25 | toIbBp64 bj = zip (toInterestBits64' bj) (toBalancedParens64' bj) |
0 commit comments