Tools for making it easier to integrate Haskell and Objective-C.
Only Mac OS X is supported at the moment. iOS may be supported in the future.
To obtain Objective-Haskell:
$ git clone git://github.com/jspahrsummers/ObjectiveHaskell.git $ cd ObjectiveHaskell $ git submodule update --init --recursive
You will also need to have the following packages installed using Homebrew and
cabal (part of the
$ brew install `haskell-platform` $ cabal install aeson
To add Objective-Haskell to a project:
- Add ObjectiveHaskell.xcodeproj to your main project file.
- In your project's Info pane, under Configurations:
- Under Debug and next to the line with your project, select ObjectiveHaskell-Debug from the drop-down.
- Under Release, select ObjectiveHaskell-Release.
- In your project's Build Settings, add the ObjectiveHaskell folder to your Header Search Paths. (It does not need to be recursive.)
For each target in your project that may have Haskell sources:
- Set up a dependency on the ObjectiveHaskell target.
Add a build rule for files matching
*.hswhich executes the following script (where
ObjectiveHaskellis the path to the repository):
and has the output files:
If you want to pass any additional flags to GHC, you may pass them to
compileHaskell.shwithin the build rule.
#import "ObjectiveHaskell.h"in your project's prefix header.
- In files where you want to use Haskell functions,
#import "MODULE_stub.h", where
MODULEis the name of your Haskell file.
Some of these steps will probably be automated or simplified in the future.
Note that when adding Haskell sources to a target, Xcode puts them in the Copy Bundle Resources phase by default. You will have to manually add them to the Compile Sources phase instead.
This project is released into the public domain, and can be used for free and without attribution for any use.