base64-lens 0.1.0.3 → 0.2.0
raw patch · 5 files changed
+13/−83 lines, 5 filesdep ~base64dep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base64, lens
API changes (from Hackage documentation)
- Data.ByteString.Base64.Lens: _Base64Unpadded :: Prism' ByteString ByteString
- Data.ByteString.Base64.Lens: pattern Base64Unpadded :: ByteString -> ByteString
- Data.Text.Encoding.Base64.Lens: _Base64Unpadded :: Prism' Text Text
- Data.Text.Encoding.Base64.Lens: pattern Base64Unpadded :: Text -> Text
Files
- CHANGELOG.md +7/−1
- README.md +4/−8
- base64-lens.cabal +2/−2
- src/Data/ByteString/Base64/Lens.hs +0/−36
- src/Data/Text/Encoding/Base64/Lens.hs +0/−36
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for base64-lens -## 0.1.0.0 -- YYYY-mm-dd+## 0.2++* Bump `base64` dependency to settle on 0.4 with the "finalized" api.+* Remove `_Base64Unpadded` prism and `Base64Unpadded` patterns from `ByteString` and `Text`+* Kill all CPP++## 0.1.0.0 * First version. Released on an unsuspecting world.
README.md view
@@ -12,25 +12,23 @@ ```haskell pattern Base64 :: ByteString -> ByteString pattern Base64Url :: ByteString -> ByteString-pattern Base64Unpadded :: ByteString -> ByteString pattern Base64UrlUnpadded :: ByteString -> ByteString -- and pattern Base64 :: Text -> Text pattern Base64Url :: Text -> Text-pattern Base64Unpadded :: Text -> Text pattern Base64UrlUnpadded :: Text -> Text -- additionally if using >=base64-0.3 -Base64Lenient :: ByteString -> ByteString-Base64UrlLenient :: ByteString -> ByteString+pattern Base64Lenient :: ByteString -> ByteString+pattern Base64UrlLenient :: ByteString -> ByteString -- and -Base64Lenient :: Text -> Text-Base64UrlLenient :: Text -> Text+pattern Base64Lenient :: Text -> Text+pattern Base64UrlLenient :: Text -> Text ``` These provide a convenient high level interface for passing Base64 encoded values.@@ -44,14 +42,12 @@ ```haskell _Base64 :: Prism' ByteString ByteString _Base64Url :: Prism' ByteString ByteString-_Base64Unpadded :: Prism' ByteString ByteString _Base64UrlUnpadded :: Prism' ByteString ByteString -- and _Base64 :: Prism' Text Text _Base64Url :: Prism' Text Text-_Base64Unpadded :: Prism' Text Text _Base64UrlUnpadded :: Prism' Text Text -- additionally if using >=base64-0.3
base64-lens.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.24 name: base64-lens-version: 0.1.0.3+version: 0.2.0 synopsis: Optics for the Base64 library description: Prisms and pattern synonyms for the Base64 library@@ -37,7 +37,7 @@ , Data.Text.Encoding.Base64.Lens build-depends: base >=4.10 && <5- , base64 >=0.2 && <0.4+ , base64 >=0.4 && <0.5 , bytestring >=0.10 && <0.11 , lens >=4.0 && <4.19 , text >=1.2 && <1.3
src/Data/ByteString/Base64/Lens.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ViewPatterns #-} -- |@@ -17,21 +16,15 @@ ( -- * Prisms _Base64 , _Base64Url-, _Base64Unpadded , _Base64UrlUnpadded-#if MIN_VERSION_base64(0,3,0) , _Base64Lenient , _Base64UrlLenient-#endif -- * Patterns , pattern Base64 , pattern Base64Url-, pattern Base64Unpadded , pattern Base64UrlUnpadded-#if MIN_VERSION_base64(0,3,0) , pattern Base64Lenient , pattern Base64UrlLenient-#endif ) where @@ -82,25 +75,6 @@ Right a -> Just a {-# INLINE _Base64Url #-} --- | A 'Prism'' into the unpadded Base64 encoding of a--- 'ByteString' 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.------ >>> _Base64Unpadded # "Sun"--- "U3Vu"------ >>> "U3Vu" ^? _Base64Unpadded--- Just "Sun"----_Base64Unpadded :: Prism' ByteString ByteString-_Base64Unpadded = prism' B64.encodeBase64Unpadded' $ \s -> case B64.decodeBase64Unpadded s of- Left _ -> Nothing- Right a -> Just a-{-# INLINE _Base64Unpadded #-}- -- | A 'Prism'' into the Base64url encoding of a 'ByteString' value -- -- Please note that unpadded variants should only be used@@ -119,7 +93,6 @@ Right a -> Just a {-# INLINE _Base64UrlUnpadded #-} -#if MIN_VERSION_base64(0,3,0) -- | An 'Iso'' into the Base64 encoding of a 'ByteString' value -- using lenient decoding. --@@ -149,7 +122,6 @@ -- _Base64UrlLenient :: Iso' ByteString ByteString _Base64UrlLenient = iso B64U.encodeBase64' B64U.decodeBase64Lenient-#endif -- -------------------------------------------------------------------------- -- -- Patterns@@ -166,19 +138,12 @@ pattern Base64Url a <- (preview _Base64Url -> Just a) where Base64Url a = _Base64Url # a --- | Bidirectional pattern synonym for unpadded base64-encoded 'ByteString' values.----pattern Base64Unpadded :: ByteString -> ByteString-pattern Base64Unpadded a <- (preview _Base64Unpadded -> Just a) where- Base64Unpadded a = _Base64Unpadded # a- -- | Bidirectional pattern synonym for unpadded base64url-encoded 'ByteString' values. -- pattern Base64UrlUnpadded :: ByteString -> ByteString pattern Base64UrlUnpadded a <- (preview _Base64UrlUnpadded -> Just a) where Base64UrlUnpadded a = _Base64UrlUnpadded # a -#if MIN_VERSION_base64(0,3,0) -- | Bidirectional pattern synonym for leniently Base64-encoded 'ByteString' values -- pattern Base64Lenient :: ByteString -> ByteString@@ -192,4 +157,3 @@ pattern Base64UrlLenient a <- (view (from _Base64UrlLenient) -> a) where Base64UrlLenient a = view _Base64UrlLenient a {-# COMPLETE Base64UrlLenient #-}-#endif
src/Data/Text/Encoding/Base64/Lens.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ViewPatterns #-} -- |@@ -17,21 +16,15 @@ ( -- * Prisms _Base64 , _Base64Url-, _Base64Unpadded , _Base64UrlUnpadded-#if MIN_VERSION_base64(0,3,0) , _Base64Lenient , _Base64UrlLenient-#endif -- * Patterns , pattern Base64 , pattern Base64Url-, pattern Base64Unpadded , pattern Base64UrlUnpadded-#if MIN_VERSION_base64(0,3,0) , pattern Base64Lenient , pattern Base64UrlLenient-#endif ) where import Control.Lens@@ -80,25 +73,6 @@ Right a -> Just a {-# INLINE _Base64Url #-} --- | A 'Prism' into the unpadded Base64 encoding of a--- 'Text' 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.------ >>> _Base64Unpadded # "Sun"--- "U3Vu"------ >>> "U3Vu" ^? _Base64Unpadded--- Just "Sun"----_Base64Unpadded :: Prism' Text Text-_Base64Unpadded = prism' B64T.encodeBase64Unpadded $ \s -> case B64T.decodeBase64Unpadded s of- Left _ -> Nothing- Right a -> Just a-{-# INLINE _Base64Unpadded #-}- -- | A 'Prism' into the Base64-url encoding of a 'Text' value. -- -- Please note that unpadded variants should only be used@@ -117,7 +91,6 @@ Right a -> Just a {-# INLINE _Base64UrlUnpadded #-} -#if MIN_VERSION_base64(0,3,0) -- | An 'Iso'' into the Base64 encoding of a 'Text' value -- using lenient decoding. --@@ -147,7 +120,6 @@ -- _Base64UrlLenient :: Iso' Text Text _Base64UrlLenient = iso B64TU.encodeBase64 B64TU.decodeBase64Lenient-#endif -- -------------------------------------------------------------------------- -- -- Patterns@@ -164,19 +136,12 @@ pattern Base64Url a <- (preview _Base64Url -> Just a) where Base64Url a = _Base64Url # a --- | Unidirectional pattern synonym for unpadded base64-encoded 'Text' values.----pattern Base64Unpadded :: Text -> Text-pattern Base64Unpadded a <- (preview _Base64Unpadded -> Just a) where- Base64Unpadded a = _Base64Unpadded # a- -- | Unidirectional pattern synonym for unpadded base64url-encoded 'Text' values. -- pattern Base64UrlUnpadded :: Text -> Text pattern Base64UrlUnpadded a <- (preview _Base64UrlUnpadded -> Just a) where Base64UrlUnpadded a = _Base64UrlUnpadded # a -#if MIN_VERSION_base64(0,3,0) -- | Bidirectional pattern synonym for leniently Base64-encoded 'Text' values -- pattern Base64Lenient :: Text -> Text@@ -190,4 +155,3 @@ pattern Base64UrlLenient a <- (view (from _Base64UrlLenient) -> a) where Base64UrlLenient a = view _Base64UrlLenient a {-# COMPLETE Base64UrlLenient #-}-#endif