base64-lens-0.3.1: Optics for the Base64 library
Copyright(c) 2019-2021 Emily Pillmore
LicenseBSD-style
MaintainerEmily Pillmore <emilypi@cohomolo.gy>
StabilityExperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Text.Short.Encoding.Base64.Lens

Description

This module contains Prisms and Iso's Base64-encoding and decoding ShortText values.

Synopsis

Prisms

_Base64 :: Prism' ShortText ShortText Source #

A Prism into the Base64 encoding of a ShortText value.

>>> _Base64 # "Sun"
"U3Vu"
>>> "U3Vu" ^? _Base64
Just "Sun"

_Base64Url :: Prism' ShortText ShortText Source #

A Prism into the Base64-url encoding of a ShortText value.

>>> _Base64Url # "Sun"
"U3Vu"
>>> "PDw_Pz8-Pg==" ^? _Base64Url
Just "<<???>>"

_Base64UrlUnpadded :: Prism' ShortText ShortText Source #

A Prism into the Base64-url encoding of a ShortText value.

Please note that unpadded variants should only be used when assumptions about the data can be made. In particular, if the length of the input is divisible by 3, then this is a safe function to call.

>>> _Base64UrlUnpadded # "<<??>>"
"PDw_Pz4-"
>>> "PDw_Pz4-" ^? _Base64UrlUnpadded
Just "<<??>>"

_Base64Lenient :: Iso' ShortText ShortText Source #

An Iso' into the Base64 encoding of a ShortText value using lenient decoding.

_Note:_ This is not a lawful Iso in general. Please take care!

>>> _Base64Lenient # "Sun"
"U3Vu"
>>> "U3Vu" ^. _Base64Lenient
"Sun"

_Base64UrlLenient :: Iso' ShortText ShortText Source #

An Iso' into the Base64url encoding of a ShortText value using lenient decoding.

_Note:_ This is not a lawful Iso in general. Please take care!

>>> _Base64UrlLenient # "<<??>>"
"PDw_Pz4-"
>>> "PDw_Pz4-" ^. _Base64UrlLenient
"<<??>>"

Patterns

pattern Base64 :: ShortText -> ShortText Source #

Unidirectional pattern synonym for base64-encoded ShortText values.

pattern Base64Url :: ShortText -> ShortText Source #

Unidirectional pattern synonym for base64url-encoded ShortText values.

pattern Base64UrlUnpadded :: ShortText -> ShortText Source #

Unidirectional pattern synonym for unpadded base64url-encoded ShortText values.

pattern Base64Lenient :: ShortText -> ShortText Source #

Bidirectional pattern synonym for leniently Base64-encoded ShortText values

pattern Base64UrlLenient :: ShortText -> ShortText Source #

Bidirectional pattern synonym for leniently Base64-encoded ShortText values