From 6a75190bffa05d1682061bd5d217998143e759af Mon Sep 17 00:00:00 2001 From: parsonsmatt Date: Wed, 28 Aug 2024 12:53:12 -0600 Subject: [PATCH] Fix type error message with AtLeastOneUniqueKey class --- persistent/ChangeLog.md | 6 ++++++ persistent/Database/Persist/TH.hs | 2 +- persistent/persistent.cabal | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/persistent/ChangeLog.md b/persistent/ChangeLog.md index 5028648dd..450f65df2 100644 --- a/persistent/ChangeLog.md +++ b/persistent/ChangeLog.md @@ -1,5 +1,11 @@ # Changelog for persistent +## 2.14.6.3 + +* []() + * Fix type error message when no unique keys are defined on a model and you + use a function with constraint `AtLeastOneUniqueKey`. + ## 2.14.6.2 * [#1536](https://github.com/yesodweb/persistent/pull/1536/) diff --git a/persistent/Database/Persist/TH.hs b/persistent/Database/Persist/TH.hs index eaa5e5595..de01e8f25 100644 --- a/persistent/Database/Persist/TH.hs +++ b/persistent/Database/Persist/TH.hs @@ -2306,7 +2306,7 @@ mkUniqueKeyInstances mps entDef = do typeErrorAtLeastOne :: Q [Dec] typeErrorAtLeastOne = do let impl = mkImpossible requireUniquesPName - cxt <- typeErrorMultipleCtx + cxt <- typeErrorNoneCtx pure [instanceD cxt atLeastOneUniqueKeyClass impl] singleUniqueKey :: Q [Dec] diff --git a/persistent/persistent.cabal b/persistent/persistent.cabal index f9ca5b295..1fb56f170 100644 --- a/persistent/persistent.cabal +++ b/persistent/persistent.cabal @@ -1,5 +1,5 @@ name: persistent -version: 2.14.6.2 +version: 2.14.6.3 license: MIT license-file: LICENSE author: Michael Snoyman