Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not error on any AppT in sqlMaybeSelectProcessRowDec #406

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.5.13.1
========
- @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
Expand Down
2 changes: 1 addition & 1 deletion esqueleto.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cabal-version: 1.12

name: esqueleto

version: 3.5.13.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.
.
Expand Down
4 changes: 1 addition & 3 deletions src/Database/Esqueleto/Record.hs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
(c : _) -> pure c
[] -> fail $ "Cannot derive Esqueleto record for a type with no constructors: " ++ show name
let constructorName =
case head constructors of

Check warning on line 264 in src/Database/Esqueleto/Record.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8.1)

In the use of ‘head’

Check warning on line 264 in src/Database/Esqueleto/Record.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8.1)

In the use of ‘head’
RecC name' _fields -> name'
con -> error $ nonRecordConstructorMessage con
fields = getFields constructor
Expand Down Expand Up @@ -648,7 +648,7 @@
-- If there's GADTs where multiple constructors are declared with the
-- same type signature you're evil and furthermore this diagnostic will
-- only show you the first name.
(GadtC names _fields _ret) -> head names

Check warning on line 651 in src/Database/Esqueleto/Record.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8.1)

In the use of ‘head’

Check warning on line 651 in src/Database/Esqueleto/Record.hs

View workflow job for this annotation

GitHub Actions / build (3.10.2.1, 9.8.1)

In the use of ‘head’
(RecGadtC names _fields _ret) -> head names

makeToAliasInstance :: RecordInfo -> Q Dec
Expand Down Expand Up @@ -935,10 +935,8 @@
]
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
Expand Down
Loading