Giter VIP home page Giter VIP logo

Comments (3)

deech avatar deech commented on July 22, 2024

Hi,
I unfortunately was not notified of any issues or PRs until today when someone directly @'ed me. In any case, we should at least be able to test the size of a bool locally and generate either a CInt or CChar. The only concern is that will break codebases that now depend on a bool marshalling to CInt.

I agree that using CBool is the cleanest solution but I'm not sure how many people are still using c2hs on GHC's older than 2017.

Any thoughts?

from c2hs.

drone29a avatar drone29a commented on July 22, 2024

Hi deech,
Oh no, I'm glad to hear there was only a notifications issue but sorry you have to deal with a backlog.

I think the right approach for C2HS is to maintain backwards compatibility as much as possible. After looking at the available C types in Foreign.C.Types again, using CUChar (rather than CChar as I originally suggested) for a one-byte representation of C's bool and selecting which C type to use based on the bool size test seems like a good plan.

There should be no functional difference between CUChar and CBool as both are newtypes wrapping a Word8 and we would still use toBool to convert to Haskell's Bool. A quick peek at the CBool definitions for various classes like Eq seems to show they are derived from Word8. I'm not entirely comfortable reading that code quickly, so it wouldn't hurt to double check.

from c2hs.

drone29a avatar drone29a commented on July 22, 2024

Hi @deech, I ran into this problem again. Were you ok with the solution I proposed earlier? I'd like to fix it instead of writing workarounds in my own code.

from c2hs.

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.