Git Product home page Git Product logo

Comments (4)

nurpax avatar nurpax commented on July 28, 2024

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.

nurpax avatar nurpax commented on July 28, 2024

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.

IreneKnapp avatar IreneKnapp commented on July 28, 2024

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 type Int' with actual typeForeign.C.Types.CInt'
In the second argument of (/=)', namelystmtParamCount'
In the first argument of when', 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.

IreneKnapp avatar IreneKnapp commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.