summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.md4
-rw-r--r--src/Data/UUID/Typed.hs46
-rw-r--r--typed-uuid.cabal6
3 files changed, 27 insertions, 29 deletions
diff --git a/ChangeLog.md b/ChangeLog.md
index a65ef28..0d25e5a 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -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
diff --git a/src/Data/UUID/Typed.hs b/src/Data/UUID/Typed.hs
index 78a5b5f..5051a04 100644
--- a/src/Data/UUID/Typed.hs
+++ b/src/Data/UUID/Typed.hs
@@ -1,6 +1,7 @@
-{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE OverloadedStrings #-}
module Data.UUID.Typed where
@@ -28,26 +29,19 @@ import Data.Validity.UUID ()
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 :: String -> Maybe (UUID a)
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
diff --git a/typed-uuid.cabal b/typed-uuid.cabal
index 168d08a..893466f 100644
--- a/typed-uuid.cabal
+++ b/typed-uuid.cabal
@@ -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