HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleoptics-extra-0.4.2.1Haskell2010

Data.Text.Lazy.Optics

This module provides Isos for converting lazy Text to or from a String or Builder, and an IxTraversal for traversing the individual characters of a Text.

If you need to work with both strict and lazy text, Data.Text.Optics provides combinators that support both varieties using a typeclass.

  • 6 values
valueunpacked :: Iso' Text String
#

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

Example1 expression
Text.pack "hello" ^. unpacked -- :: String"hello"
pack x ≡ x ^. re unpacked
unpack x ≡ x ^. packed

This Iso is provided for notational convenience rather than out of great need, since

unpacked ≡ re packed

Encode/Decode a lazy Text to/from lazy ByteString, via UTF-8.

Note: This function does not decode lazily, as it must consume the entire input before deciding whether or not it fails.

Example1 expression
LBS.unpack (utf8 # Text.pack "☃")[226,152,131]