password-instances 0.1.0.0 → 0.2.0.0
raw patch · 2 files changed
+13/−1 lines, 2 filesdep +http-api-dataPVP ok
version bump matches the API change (PVP)
Dependencies added: http-api-data
API changes (from Hackage documentation)
+ Data.Password.Instances: instance Web.Internal.HttpApiData.FromHttpApiData Data.Password.Pass
Files
password-instances.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12 name: password-instances-version: 0.1.0.0+version: 0.2.0.0 category: Data synopsis: typeclass instances for password package description: A library providing typeclass instances for common libraries for the types from the password package.@@ -31,6 +31,7 @@ build-depends: base >=4.7 && <5 , aeson+ , http-api-data , password , persistent ghc-options:
src/Data/Password/Instances.hs view
@@ -44,6 +44,7 @@ import Data.Aeson (FromJSON) import Data.Password import Database.Persist.Class (PersistField)+import Web.HttpApiData (FromHttpApiData) -- $setup@@ -52,7 +53,9 @@ -- Import needed functions. -- -- >>> import Data.Aeson (decode)+-- >>> import Data.Text (Text) -- >>> import Database.Persist.Class (PersistField(toPersistValue))+-- >>> import Web.HttpApiData (parseUrlPiece) -- | This instance allows a 'Pass' to be created from a JSON blob.@@ -68,6 +71,14 @@ -- because we don't want to accidentally send the password hash to the end -- user. deriving newtype instance FromJSON Pass++-- | This instance allows a 'Pass' to be created with functions like+-- 'Web.HttpApiData.parseUrlPiece' or 'Web.HttpApiData.parseQueryParam'.+--+-- >>> let eitherPass = parseUrlPiece "foobar" :: Either Text Pass+-- >>> fmap unsafeShowPassword eitherPass+-- Right "foobar"+deriving newtype instance FromHttpApiData Pass -- | This instance allows a 'PassHash' to be stored as a field in a database using -- "Database.Persist".