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 within the repository 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 and link in the ObjectiveHaskell library.
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.
Copyright (c) 2012 Justin Spahr-Summers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.