lens-4.4: Lenses, Folds and Traversals
Data.Text.Lens
Description
Synopsis
class IsText t whereSource
Traversals for strict or lazy Text
Text
Methods
packed :: Iso' String tSource
This isomorphism can be used to pack (or unpack) strict or lazy Text.
pack
unpack
pack x ≡ x ^. packed unpack x ≡ x ^. from packed packed ≡ from unpacked
^.
packed
from
unpacked
builder :: Iso' t BuilderSource
Convert between strict or lazy Text and a Builder.
Builder
fromText x ≡ x ^. builder
fromText
builder
text :: IndexedTraversal' Int t CharSource
Traverse the individual characters in strict or lazy Text.
text = unpacked . traversed
text
traversed
Instances
unpacked :: IsText t => Iso' t StringSource
This isomorphism can be used to unpack (or pack) both strict or lazy Text.
unpack x ≡ x ^. unpacked pack x ≡ x ^. from unpacked
This Iso is provided for notational convenience rather than out of great need, since
Iso
unpacked ≡ from packed
_Text :: IsText t => Iso' t StringSource
This is an alias for unpacked that makes it clearer how to use it with ('#').
('#')
_Text = from packed
_Text
>>> _Text # "hello" :: Strict.Text "hello"
>>>
_Text # "hello" :: Strict.Text