Search code examples
iphonehaskellschemesmlgambit

Is there a Haskell/ML-like compiler to C?


People have written games for the iPhone in Scheme. Because (some) Scheme-compilers compile down to C, it was easy to mix with Objective-C and integrate with XCode.

I am aware of patches for Haskell and OCaml compilers to enable ARM/iOS-backends. But those appear unofficial and experimental/unstable.

I prefer a static haskell/ML-type type-system over Scheme's dynamic typing. Is there a stable ML/SML/Haskell compiler which generates C-code so that it can be used in a similar way as Scheme/Gambit-C?


Solution

  • I can't help with ML, but have you looked at JHC? JHC is a whole-program optimizing Haskell compiler that targets portable C, and iPhone support can be added by putting

    [iphone]
    cc=arm-apple-darwin-gcc
    merge=le32
    

    in ~/.jhc/targets.ini

    More Haskell information is on the Haskell wiki and the JHC manual.