From e59c1b9d73a2c91aa0103b9b7cf29d14dece81cd Mon Sep 17 00:00:00 2001 From: Cameron Samak Date: Tue, 26 Nov 2024 10:49:04 -0800 Subject: [PATCH 1/2] Do not error on any AppT in sqlMaybeSelectProcessRowDec No need to be this restrictive in deriveEsqueletoRecord For example, AppT ListT _ and AppT (ConT _) _ are both fine but would throw an error here before this change. --- changelog.md | 6 ++++++ esqueleto.cabal | 2 +- src/Database/Esqueleto/Record.hs | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 6f4dd4674..b225fcc65 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +3.5.14.0 +======== +- @csamak + - [#405](https://github.com/bitemyapp/esqueleto/pull/405) + - Fix a bug introduced in 3.5.12.0 where deriveEsqueletoRecord incorrectly errors + 3.5.13.0 ======== - @ac251 diff --git a/esqueleto.cabal b/esqueleto.cabal index 547741fff..1a64a9781 100644 --- a/esqueleto.cabal +++ b/esqueleto.cabal @@ -2,7 +2,7 @@ cabal-version: 1.12 name: esqueleto -version: 3.5.13.0 +version: 3.5.14.0 synopsis: Type-safe EDSL for SQL queries on persistent backends. description: @esqueleto@ is a bare bones, type-safe EDSL for SQL queries that works with unmodified @persistent@ SQL backends. Its language closely resembles SQL, so you don't have to learn new concepts, just new syntax, and it's fairly easy to predict the generated SQL and optimize it for your backend. Most kinds of errors committed when writing SQL are caught as compile-time errors---although it is possible to write type-checked @esqueleto@ queries that fail at runtime. . diff --git a/src/Database/Esqueleto/Record.hs b/src/Database/Esqueleto/Record.hs index cdc9913be..48b91c1f4 100644 --- a/src/Database/Esqueleto/Record.hs +++ b/src/Database/Esqueleto/Record.hs @@ -935,10 +935,8 @@ sqlMaybeSelectProcessRowDec RecordInfo {..} = do ] where wrapJust x = case x of - AppT (ConT ((==) ''Entity -> True)) _innerType -> id ((ConT ((==) ''Maybe -> True)) `AppT` _inner) -> AppE (ConE 'Just) - (ConT _) -> id - _ -> error $ show x + _ -> id -- | Generates the `sqlSelectColCount` declaration for an `SqlSelect` instance. sqlMaybeSelectColCountDec :: RecordInfo -> Q Dec From 17efd5806248df3d9d638b9aaa0e8ce83841fe27 Mon Sep 17 00:00:00 2001 From: Matt Parsons Date: Thu, 5 Dec 2024 13:40:29 -0700 Subject: [PATCH 2/2] Apply suggestions from code review --- changelog.md | 2 +- esqueleto.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index b225fcc65..a36dfe54d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -3.5.14.0 +3.5.13.1 ======== - @csamak - [#405](https://github.com/bitemyapp/esqueleto/pull/405) diff --git a/esqueleto.cabal b/esqueleto.cabal index 1a64a9781..5d2da3d39 100644 --- a/esqueleto.cabal +++ b/esqueleto.cabal @@ -2,7 +2,7 @@ cabal-version: 1.12 name: esqueleto -version: 3.5.14.0 +version: 3.5.13.1 synopsis: Type-safe EDSL for SQL queries on persistent backends. description: @esqueleto@ is a bare bones, type-safe EDSL for SQL queries that works with unmodified @persistent@ SQL backends. Its language closely resembles SQL, so you don't have to learn new concepts, just new syntax, and it's fairly easy to predict the generated SQL and optimize it for your backend. Most kinds of errors committed when writing SQL are caught as compile-time errors---although it is possible to write type-checked @esqueleto@ queries that fail at runtime. .