From 33d320039947542038a93188f6847ad07acdf6ab Mon Sep 17 00:00:00 2001 From: Evan Rutledge Borden Date: Fri, 17 Nov 2017 14:28:20 -0500 Subject: [PATCH 1/2] Fix constraints on get404 and getBy404 The constraints on `get404` and `getBy404` were overly powerful. They were constrained by `PersistStore` and `PersistStoreUnique`, which is an alias for `PersistStoreWrite...`. These only need `PersistStoreRead...` to accomplish their job. --- yesod-persistent/Yesod/Persist/Core.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yesod-persistent/Yesod/Persist/Core.hs b/yesod-persistent/Yesod/Persist/Core.hs index aecef655..3f99833f 100644 --- a/yesod-persistent/Yesod/Persist/Core.hs +++ b/yesod-persistent/Yesod/Persist/Core.hs @@ -134,7 +134,7 @@ respondSourceDB ctype = respondSource ctype . runDBSource -- | Get the given entity by ID, or return a 404 not found if it doesn't exist. #if MIN_VERSION_persistent(2,5,0) -get404 :: (MonadIO m, PersistStore backend, PersistRecordBackend val backend) +get404 :: (MonadIO m, PersistStoreRead backend, PersistRecordBackend val backend) => Key val -> ReaderT backend m val #else @@ -151,7 +151,7 @@ get404 key = do -- | Get the given entity by unique key, or return a 404 not found if it doesn't -- exist. #if MIN_VERSION_persistent(2,5,0) -getBy404 :: (PersistUnique backend, PersistRecordBackend val backend, MonadIO m) +getBy404 :: (PersistUniqueRead backend, PersistRecordBackend val backend, MonadIO m) => Unique val -> ReaderT backend m (Entity val) #else From cfb8fd9b215c35f56a98146eae3a050e630accf5 Mon Sep 17 00:00:00 2001 From: Evan Rutledge Borden Date: Fri, 17 Nov 2017 14:41:57 -0500 Subject: [PATCH 2/2] Version bump for get404 and getBy404 constraint changes. --- yesod-persistent/ChangeLog.md | 4 ++++ yesod-persistent/yesod-persistent.cabal | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/yesod-persistent/ChangeLog.md b/yesod-persistent/ChangeLog.md index ebb2d8e2..a7343ed8 100644 --- a/yesod-persistent/ChangeLog.md +++ b/yesod-persistent/ChangeLog.md @@ -1,3 +1,7 @@ +## 1.4.3 + +* Fix overly powerful constraints on get404 and getBy404. + ## 1.4.2 * Fix warnings diff --git a/yesod-persistent/yesod-persistent.cabal b/yesod-persistent/yesod-persistent.cabal index ed9a33ed..a2c255dd 100644 --- a/yesod-persistent/yesod-persistent.cabal +++ b/yesod-persistent/yesod-persistent.cabal @@ -1,5 +1,5 @@ name: yesod-persistent -version: 1.4.2 +version: 1.4.3 license: MIT license-file: LICENSE author: Michael Snoyman