Comments (4)
It'd be good to decide what to do about this before the next release, as this relates to the public API.
from direct-sqlite.
Hmm.. Now that I used it a bit more, it doesn't seem too bad, actually. Just need a few fromIntegrals here and there.
That being said, I feel like this is a bit leaky.
from direct-sqlite.
Yeah, I don't like it as CInt, but oh well, since I released before I saw this. I do think the CInt to Int change should happen and before next time,whenever that is.
Sent from my iPad
On Sep 28, 2012, at 11:38 AM, Janne Hellsten [email protected] wrote:
I wonder if this was intentional in @joeyadams new code:
newtype ParamIndex = ParamIndex CInt
deriving (Eq, Ord, Enum, Num, Real, Integral)
This specifies ParamIndex to be a CInt instead of just an Int. This has surprising consequences, like:-- in sqlite-simple code that uses direct-sqlite
ParamIndex stmtParamCount <- bindParameterCount stmt
when (length qp /= stmtParamCount) (throwColumnMismatch qp stmtParamCount)
Leads to a type error:Database/SQLite/Simple.hs:115:22:
Couldn't match expected typeInt' with actual type
Foreign.C.Types.CInt'
In the second argument of(/=)', namely
stmtParamCount'
In the first argument ofwhen', namely
(length qp /= stmtParamCount)'
In a stmt of a 'do' block:
when
(length qp /= stmtParamCount)
(throwColumnMismatch qp stmtParamCount)
stmtParamCount here will be a CInt which at least to me was a surprise. I would expect counts like these to just use normal Ints, rather than types that are used for C bindings.I think this will surprise users.
IMO the direct-sqlite public API should use just Ints, not CInts.
—
Reply to this email directly or view it on GitHub.
from direct-sqlite.
Hmm, I had forgotten about this old issue. I think I agree that Int would be better than CInt. Now we just need to remember to do it before 3.0 sometime. :)
from direct-sqlite.
Related Issues (20)
- Enable math functions HOT 3
- Test suite depends on specific directory structure, doesn't always exist HOT 4
- SQLite Threading Mode HOT 5
- Test suite failure with GHC 8
- How to add FTS5? HOT 5
- Any need to apply stat64 workaround? HOT 4
- Unreliable sqlErrorDetails in parallelized environments HOT 5
- Inaccurate version bound / build failure for GHC < 7.10 HOT 1
- Upgrading SQLite to v3.27.2
- Add a flag for compiling sqlite in Multi-thread mode HOT 3
- Upgrade embedded SQLite library HOT 2
- Test failure with system sqlite 3.34.1 HOT 1
- Nondeterministic `ErrorMisuse` on multiple runs of the same application test HOT 9
- Add Bindings to sqlite3_status and sqlite3_status64 HOT 1
- Slowness on `stepNoCB` HOT 1
- Updating test case for upgrading SQLite HOT 1
- Allow semigroup-0.20 HOT 1
- ICU extension flag HOT 3
- Allow opening sqllite from bytestring via sqllite3_deserialize directive HOT 4
- Can't use URI HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from direct-sqlite.