• Stars
    star
    147
  • Rank 251,347 (Top 5 %)
  • Language
    Haskell
  • License
    Other
  • Created almost 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Inline C & Objective-C in Haskell

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!

More Repositories

1

CodeEditorView

SwiftUI code editor view for iOS and macOS
Swift
564
star
2

HaskellSpriteKit

Haskell binding to Apple's SpriteKit framework
Haskell
172
star
3

BigPixel

Pixel art for games
Haskell
137
star
4

lets-program

Let's program! Get into programming writing a simple game.
Haskell
76
star
5

lazy-lambda

Lazy Lambda — a Flappy Bird clone in Haskell with SpriteKit
Haskell
73
star
6

goalsapp

Track periodic goals — a sample iPhone app
Swift
27
star
7

haskell.sty

LaTeX style file to typeset functional languages like Haskell
26
star
8

ProjectNavigator

SwiftUI project navigation view for macOS and iOS
Swift
21
star
9

gloss-game

A convenience wrapper around the Gloss library to make writing games in Haskell even easier
Haskell
17
star
10

hoas-conv

Toy language to show the conversion of embedded higher-order abstract syntax (HOAS)
Haskell
17
star
11

CodeEditorDemo

Demo app for CodeEditorView
Swift
16
star
12

language-swift-quote

Quasiquotation for Swift in Haskell
9
star
13

welcome-to-fp-workshop

Support material for the “Introduction to Functional Programming” workshop @ the "Welcome to Functional Programming" day of YOW! Lambda Jam, Sydney, 2018 & 2019
8
star
14

fp-in-swift

Support material for "Functional Programming in Swift" @ Functional Conf, Bangalore, 2017
Swift
7
star
15

accelerate-agda

Accelerate in Agda
Haskell
6
star
16

ylj14-workshop

Code for the YOW! Lambda Jam Workshop on Inline C in Haskell
Haskell
3
star
17

galactico

Drive the economy of galactic colonies
Haskell
3
star
18

haskell-containers

Docker container images for Haskell apps
2
star
19

lets-code

Let's code! A playful introduction to coding
Haskell
1
star