From 9e48b4b8c1e343bdb0c6d7dcfddd48918d7909b6 Mon Sep 17 00:00:00 2001 From: Stephan Barth Date: Sun, 6 Oct 2024 16:57:30 +0200 Subject: [PATCH] chore(versionbump): Reverted old versionbump of CryptoID.hs and implemented a new one. --- src/CryptoID.hs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/CryptoID.hs b/src/CryptoID.hs index c5aea70a9..c5cb67f14 100644 --- a/src/CryptoID.hs +++ b/src/CryptoID.hs @@ -30,7 +30,7 @@ import qualified Data.Text as Text import qualified Data.CaseInsensitive as CI import Data.Aeson (withText) ---import Data.Aeson.Encoding (text) +import Data.Aeson.Encoding (text) import Text.Blaze (ToMarkup(..)) @@ -72,10 +72,8 @@ instance {-# OVERLAPS #-} PathPiece (E.CryptoID "Submission" (CI FilePath)) wher instance {-# OVERLAPS #-} ToJSON (E.CryptoID "Submission" (CI FilePath)) where toJSON = String . toPathPiece -instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "Submission" (CI FilePath)) --- Versionbump: Instance can be made automatically now; also old instance does not work any more due to type changes ---where --- toJSONKey = ToJSONKeyText toPathPiece (text . toPathPiece) +instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "Submission" (CI FilePath)) where + toJSONKey = ToJSONKeyText (fromText . toPathPiece) (text . toPathPiece) instance {-# OVERLAPS #-} FromJSON (E.CryptoID "Submission" (CI FilePath)) where parseJSON = withText "CryptoFileNameSubmission" $ maybe (fail "Could not parse CryptoFileNameSubmission") return . fromPathPiece instance {-# OVERLAPS #-} FromJSONKey (E.CryptoID "Submission" (CI FilePath)) where @@ -93,11 +91,8 @@ instance {-# OVERLAPS #-} PathPiece (E.CryptoID "User" (CI FilePath)) where instance {-# OVERLAPS #-} ToJSON (E.CryptoID "User" (CI FilePath)) where toJSON = String . toPathPiece -instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "User" (CI FilePath)) --- Versionbump: Instance can be made automatically now; also old instance does not work any more due to type changes --- where --- toJSONKey = ToJSONKeyText toPathPiece (text . toPathPiece) - +instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "User" (CI FilePath)) where + toJSONKey = ToJSONKeyText (fromText . toPathPiece) (text . toPathPiece) instance {-# OVERLAPS #-} FromJSON (E.CryptoID "User" (CI FilePath)) where parseJSON = withText "CryptoFileNameUser" $ maybe (fail "Could not parse CryptoFileNameUser") return . fromPathPiece instance {-# OVERLAPS #-} FromJSONKey (E.CryptoID "User" (CI FilePath)) where @@ -114,10 +109,8 @@ instance {-# OVERLAPS #-} PathPiece (E.CryptoID "PrintJob" (CI FilePath)) where toPathPiece = Text.pack . ("uwl" <>) . CI.foldedCase . ciphertext instance {-# OVERLAPS #-} ToJSON (E.CryptoID "PrintJob" (CI FilePath)) where toJSON = String . toPathPiece -instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "PrintJob" (CI FilePath)) --- Versionbump: Instance can be made automatically now; also old instance does not work any more due to type changes --- where --- toJSONKey = ToJSONKeyText toPathPiece (text . toPathPiece) +instance {-# OVERLAPS #-} ToJSONKey (E.CryptoID "PrintJob" (CI FilePath)) where + toJSONKey = ToJSONKeyText (fromText . toPathPiece) (text . toPathPiece) instance {-# OVERLAPS #-} FromJSON (E.CryptoID "PrintJob" (CI FilePath)) where parseJSON = withText "CryptoFileNameUser" $ maybe (fail "Could not parse CryptoPrintJob") return . fromPathPiece instance {-# OVERLAPS #-} FromJSONKey (E.CryptoID "PrintJob" (CI FilePath)) where