typed-encoding-0.2.2.0: Type safe string transformations

Safe HaskellSafe
LanguageHaskell2010

Data.TypedEncoding.Conv.Text

Description

Text encoding combinators specific to Text @since 0.2.2.0

Synopsis

Documentation

>>> :set -XDataKinds -XTypeFamilies -XTypeApplications

pack :: Enc xs c String -> Enc xs c Text Source #

This assumes that each of the encodings in xs work work equivalently in String and Text.

unpack :: Enc xs c Text -> Enc xs c String Source #

This assumes that each of the encodings in xs work work equivalently in String and Text.

utf8Promote :: Enc xs c Text -> Enc (Snoc xs "r-UTF8") c Text Source #

Text is automatically "r-UTF8" encoded

>>> displ $ utf8Promote $ toEncoding () ("text" :: T.Text)
"MkEnc '[r-UTF8] () (Text text)"

utf8Demote :: UnSnoc xs ~ (,) ys "r-UTF8" => Enc xs c Text -> Enc ys c Text Source #

For Text "r-UTF8" is redundant

>>> displ . utf8Demote $ (unsafeSetPayload () "Hello" :: Enc '["r-UTF8"] () T.Text)
"MkEnc '[] () (Text Hello)"