justList breaks type-safety
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the reported SQLite reproduction using selectOne, in_, justList, and valList, then inspect the type signatures and implementation of in_ and justList. Compare the NULL behavior on SQLite and PostgreSQL, and consider the issue done when the inferred result type matches nullable values and coverage verifies the behavior on the supported database backends.
Written by the indexing model from the issue text.
Description
This query:
mBool <- selectOne $ do
pure $ val Nothing `in_` justList (valList [1, 2, 3 :: Int])
liftIO $ print mBool
Shows me:
PersistMarshalError "Failed to parse Haskell type `Bool`; expected boolean, integer, or bytestring of '1' or '0' from database, but received: PersistNull. Potential solution: Check that your database schema matches your Persistent model definitions."
HasCallStack backtrace:
collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception
toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
throwIO, called at ./Control/Monad/Trans/Resource.hs:195:13 in resourcet-1.3.0-BnXEVAikP2m1jrdnAev1wT:Control.Monad.Trans.Resource
In other words, the type of in_ is a lie, and should return Value (Maybe Bool) instead of Value Bool when the first argument can be NULL.
I ran this test on SQLite. I'm not sure what would/should happen on PostgreSQL.
- Dominant language
- Haskell
- Stars
- 401
- Forks
- 108
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bitemyapp/esqueleto
-
Difficulty 5/5 Over a week Newbie friendliness 8/100
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
All issues in bitemyapp/esqueleto
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
haskell/bytestring#730 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
seal-harness/seal-harness#399 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
fmidue/codeworld-tasks#124 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
reflex-frp/reflex#563 ·
-
The codecov job never gets a runner on macos-26 and is cancelledPossibly taken @yegor256 claimed this 1 day ago. Openbug
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
objectionary/phino#2524 · 1 comment ·
Maintainers usually reply within 1 day