lens-4.19.2: Lenses, Folds and Traversals
Copyright(C) 2012-16 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Text.Lens

Description

 
Synopsis

Documentation

class IsText t where #

Traversals for strict or lazy Text

Minimal complete definition

packed, builder

Methods

packed :: Iso' String t #

This isomorphism can be used to pack (or unpack) strict or lazy Text.

pack x ≡ x ^. packed
unpack x ≡ x ^. from packed
packedfrom unpacked

builder :: Iso' t Builder #

Convert between strict or lazy Text and a Builder.

fromText x ≡ x ^. builder

text :: IndexedTraversal' Int t Char #

Traverse the individual characters in strict or lazy Text.

text = unpacked . traversed

Instances

Instances details
IsText String # 
Instance details

Defined in Data.Text.Lens

IsText Text # 
Instance details

Defined in Data.Text.Lens

IsText Text # 
Instance details

Defined in Data.Text.Lens

unpacked :: IsText t => Iso' t String #

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

unpackedfrom packed

_Text :: IsText t => Iso' t String #

This is an alias for unpacked that makes it clearer how to use it with (#).

_Text = from packed
>>> _Text # "hello" :: Strict.Text
"hello"

pattern Text :: IsText s => [Char] -> s #