Safe Haskell | None |
---|---|
Language | Haskell2010 |
An implementation of Int
-mapped ByteString
s with internalization.
Wrap a ByteString
with ibs
to receive a IBS
. This internalizes the
given ByteString
, meaning that two bytestring inputs x
and y
will
yield the same IBS
if they have the same bytestring representation.
For convenience, conversion from and to text is possible as well and
uses UTF8
encoding.
Since internalized ByteString
values are never released, be sure to
use it sparingly. I.e. to internalize words, not full sentences.
NOTE Currently, we use a ByteString
internally and can not compact
the structure. The code remains, though as comments in case we switch to
another structure.
Synopsis
- pattern V_IBS :: (Vector Int) -> Vector (IBS k)
- pattern MV_IBS :: (MVector s Int) -> MVector s (IBS k)
- newtype IBS k = IBS {}
- ibs :: ByteString -> IBS k
- ibsText :: Text -> IBS k
- ibsFrom :: ConvertibleStrings x Text => x -> IBS k
- ibsTo :: ConvertibleStrings Text x => IBS k -> x
- ibsToText :: IBS k -> Text
- ibsToUtf8 :: IBS k -> ByteString
Documentation
An IBS
behaves much like a ByteString
, but is represented as an
Int
internally. Its phantom type is polykinded, since we might want to
use type-level strings to name things.
Instances
ibs :: ByteString -> IBS k Source #
ibsFrom :: ConvertibleStrings x Text => x -> IBS k Source #
Convert into an IBS
, using a Text
intermediate for proper UTF8
conversion.
ibsToUtf8 :: IBS k -> ByteString Source #