Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is fairly easy using <a href="http://projects.haskell.org/ghc-iphone/downloads/GHC-iPhone.pdf" rel="noreferrer">GHC-iPhone</a> and the <a href="http://www.haskell.org/haskellwiki/Foreign_Function_Interface" rel="noreferrer">Foreign Function Interface</a></p> <p>For reference, David Pollak has an example implementing a Lisp interpreter written in Haskell, running inside an iPad app:</p> <blockquote> <p><a href="https://github.com/dpp/LispHaskellIPad" rel="noreferrer">https://github.com/dpp/LispHaskellIPad</a></p> </blockquote> <p>An example declaring the Haskell main in <code>main.m</code>:</p> <pre><code>extern int Haskell_main(int argc, char* argv[]); int main(int argc, char* argv[]) { Haskell_main(argc, argv); } </code></pre> <p>and in his <code>Main.hs</code>, a series of foreign function declarations granting him access to the Cocoa libs:</p> <pre><code>foreign import ccall safe "openWindow" openWindow :: IO CInt data ViewController_struct type ViewController = Ptr ViewController_struct type RunStr = ViewController -&gt; CString -&gt; IO () foreign import ccall safe "wrapper" wrapFuncInvoke :: RunStr -&gt; IO (FunPtr RunStr) foreign import ccall safe "setLispEval" setLispEval :: ViewController -&gt; FunPtr RunStr -&gt; IO () foreign import ccall safe "addToResult" addToResult :: ViewController -&gt; CString -&gt; IO () data ObjCId_struct type ObjCId = Ptr ObjCId_struct data ObjCSEL_struct type ObjCSEL = Ptr ObjCSEL_struct foreign import ccall safe "objc_msgSend" objc_msgSend :: ObjCId -&gt; ObjCSEL -&gt; IO ObjCId foreign import ccall safe "objc_msgSend" objc_msgSendInt :: ObjCId -&gt; ObjCSEL -&gt; Int -&gt; IO ObjCId foreign import ccall safe "sel_registerName" sel_registerName :: CString -&gt; IO ObjCSEL foreign import ccall safe "objc_lookUpClass" objc_lookUpClass :: CString -&gt; IO ObjCId </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload