lens-2.8: Lenses, Folds and Traversals

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellNone

Data.ByteString.Strict.Lens

Description

 

Synopsis

Documentation

packedChars :: Simple Iso String ByteStringSource

pack (or unpack) a list of characters into a ByteString

When writing back to the ByteString it is assumed that every Char lies between '\x00' and '\xff'.

pack x = x ^. packedChars
unpack x = x ^. from packedChars

chars :: SimpleIndexedTraversal Int ByteString CharSource

Traverse the individual bytes in a ByteString as characters.

When writing back to the ByteString it is assumed that every Char lies between '\x00' and '\xff'.

chars = from packedChars . traverse
anyOf chars (== 'c') :: ByteString -> Bool