Git Product home page Git Product logo

language-c-inline's Introduction

Inline C & Objective-C in Haskell

This library uses Template Haskell and language-c-quote, a quasi-quotation library for C-like languages, to provide inline C and Objective-C in Haskell. It extracts the C/Objective-C code automatically, when compiling the Haskell program, and generates marshalling code for common types. The wiki on GitHub details the motivation for this approach.

For further motivation, you might like to watch the YouTube video (matching slides) of my talk at the Haskell Symposium 2014 (Gothenburg, Sweden), or look at the slides of my YOW! Lambda Jam 2014 talk Foreign Inline Code in Haskell.

Building

To build the library, just use cabal install as usual from the source code directory or by installing from Hackage.

You may like to have a look at a minimal example of its use, which you can build as follows:

  • Execute cd tests/objc/minimal; make.
  • Now run the demo executable with ./Minimal.

To build the proof of concept example, do the following:

  • Execute cd tests/objc/concept; make.
  • Now run the demo executable with ./InlineObjC.

To build an example class wrapping a Haskell record, do the following:

  • Execute cd tests/objc/record; make.
  • Now run the demo executable with ./Particle.

To build the more complex Haskell interpreter app:

  • Execute cd tests/objc/app; make.
  • Now open -a HSApp.app.

Status

Update: For various reasons (mostly lack of time on my side), all my recent changes have been on the release/0.7 branch, which also hosts the version that you can find on Hackage. That version has been used in production. It is the glue between the Haskell and Swift part of Haskell for Mac. For a larger open-source example of using language-c-inline, see HaskellSpriteKit.

Unfortunately, I haven't been able to find the time to merge all the improvements on release/0.7 back into master.

The library is in beta and focuses mostly on Objective-C. Automatic marshalling support is still somewhat limited. However, it is quite easy to add more types, and I do welcome pull request!

language-c-inline's People

Contributors

mchakravarty avatar erikd avatar mxswd avatar dougburke avatar abhinav avatar dennda avatar konn avatar pjonsson avatar

Watchers

James Cloos avatar

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.