packages feed

typed-uuid 0.0.0.0 → 0.0.0.1

raw patch · 3 files changed

+27/−29 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,3 +1,7 @@ # Changelog for typed-uuid  ## Unreleased changes++## [0.0.0.1] - 2020-02-12++Got typed-uuid to compile with GHC 8.8.x
src/Data/UUID/Typed.hs view
@@ -1,6 +1,7 @@-{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE OverloadedStrings #-}  module Data.UUID.Typed where @@ -28,26 +29,19 @@ import qualified Data.UUID as UUID import qualified Data.UUID.V4 as UUID -newtype UUID a = UUID+newtype UUID a =+  UUID     { unUUID :: UUID.UUID-    } deriving ( Eq-               , Ord-               , Generic-               , Data-               , Storable-               , Binary-               , NFData-               , Hashable-               , Random-               )+    }+  deriving (Eq, Ord, Generic, Data, Storable, Binary, NFData, Hashable, Random)  instance Validity (UUID a)  instance Show (UUID a) where-    show (UUID u) = show u+  show (UUID u) = show u  instance Read (UUID a) where-    readPrec = UUID <$> readPrec+  readPrec = UUID <$> readPrec  uuidBs :: UUID a -> SB.ByteString uuidBs (UUID uuid) = UUID.toASCIIBytes uuid@@ -71,31 +65,31 @@ parseUUIDString = fmap UUID . UUID.fromString  instance FromJSONKey (UUID a) where-    fromJSONKey = FromJSONKeyTextParser textJSONParseUUID+  fromJSONKey = FromJSONKeyTextParser textJSONParseUUID  instance ToJSONKey (UUID a) where-    toJSONKey = toJSONKeyText (UUID.toText . unUUID)+  toJSONKey = toJSONKeyText (UUID.toText . unUUID)  instance FromJSON (UUID a) where-    parseJSON = jsonParseUUID+  parseJSON = jsonParseUUID  jsonParseUUID :: Value -> Parser (UUID a) jsonParseUUID = withText "UUID" textJSONParseUUID  textJSONParseUUID :: Text -> Parser (UUID a) textJSONParseUUID t =-    case UUID.fromText t of-        Nothing -> fail "Invalid Text when parsing UUID"-        Just u -> pure $ UUID u+  case UUID.fromText t of+    Nothing -> fail "Invalid Text when parsing UUID"+    Just u -> pure $ UUID u  instance ToJSON (UUID a) where-    toJSON (UUID u) = JSON.String $ UUID.toText u+  toJSON (UUID u) = JSON.String $ UUID.toText u  instance FromHttpApiData (UUID a) where-    parseUrlPiece t =-        case UUID.fromText t of-            Nothing -> fail $ "Invalid UUID in Url Piece: " ++ T.unpack t-            Just uuid -> pure $ UUID uuid+  parseUrlPiece t =+    case UUID.fromText t of+      Nothing -> Left $ "Invalid UUID in Url Piece: " <> t+      Just uuid -> pure $ UUID uuid  instance ToHttpApiData (UUID a) where-    toUrlPiece (UUID uuid) = UUID.toText uuid+  toUrlPiece (UUID uuid) = UUID.toText uuid
typed-uuid.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: f564cfded862f8dd6830c839a9b9ad4a464a251ad0254961b2362973c1552fa5+-- hash: 769c1f73f1704a0392cee02b6b1c7464746fae5134013c68a8226c0952bee3ad  name:           typed-uuid-version:        0.0.0.0+version:        0.0.0.1 synopsis:       Phantom-Typed version of UUID description:    Please see the README on Github at <https://github.com/NorfairKing/typed-uuid#readme> category:       Data