| Portability | non-portable |
|---|---|
| Stability | experimental |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Safe Haskell | None |
Data.ByteString.Lens
Description
- class IsByteString t where
- packedBytes :: Simple Iso [Word8] t
- packedChars :: Simple Iso String t
- bytes :: SimpleIndexedTraversal Int t Word8
- chars :: SimpleIndexedTraversal Int t Char
Documentation
class IsByteString t whereSource
Traversals for ByteStrings.
Methods
packedBytes :: Simple Iso [Word8] tSource
pack (or unpack) a list of bytes into a strict or lazy ByteString
packx = x^.packedBytes
unpackx = x^.frompackedBytes
packedChars :: Simple Iso String tSource
pack (or unpack) a list of characters into a strict or lazy ByteString
When writing back to the ByteString it is assumed that every Char
lies between '\x00' and '\xff'.
packx = x^.packedChars
unpackx = x^.frompackedChars
bytes :: SimpleIndexedTraversal Int t Word8Source
Traverse each Word8 in a strict or lazy ByteString
bytes=frompackedBytes.>itraversed
anyOfbytes(==0x80) ::ByteString->Bool
chars :: SimpleIndexedTraversal Int t CharSource
Traverse the individual bytes in a strict or lazy ByteString as characters.
When writing back to the ByteString it is assumed that every Char
lies between '\x00' and '\xff'.
chars=frompackedChars.traverse
anyOfchars(=='c') ::ByteString->Bool
Instances