यह काफी GHC-iPhone और Foreign Function Interface
संदर्भ के लिए का उपयोग कर के लिए आसान है, डेविड पोलाक एक उदाहरण एक लिस्प हास्केल में लिखा दुभाषिया को लागू किया है, एक iPad ऐप्लिकेशन के अंदर चल रहा है:
https://github.com/dpp/LispHaskellIPad
main.m
में हास्केल मुख्य घोषित करने वाला एक उदाहरण:
extern int Haskell_main(int argc, char* argv[]);
int main(int argc, char* argv[])
{
Haskell_main(argc, argv);
}
और में अपने Main.hs
, उसे कोको libs में पहुंच प्रदान करना विदेशी समारोह घोषणाओं की एक श्रृंखला:
foreign import ccall safe "openWindow" openWindow
:: IO CInt
data ViewController_struct
type ViewController = Ptr ViewController_struct
type RunStr = ViewController -> CString -> IO()
foreign import ccall safe "wrapper" wrapFuncInvoke :: RunStr -> IO (FunPtr RunStr)
foreign import ccall safe "setLispEval" setLispEval :: ViewController -> FunPtr RunStr -> IO()
foreign import ccall safe "addToResult" addToResult :: ViewController -> CString -> 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 -> ObjCSEL -> IO ObjCId
foreign import ccall safe "objc_msgSend" objc_msgSendInt :: ObjCId -> ObjCSEL -> Int -> IO ObjCId
foreign import ccall safe "sel_registerName" sel_registerName :: CString -> IO ObjCSEL
foreign import ccall safe "objc_lookUpClass" objc_lookUpClass :: CString -> IO ObjCId
आप एक पटकथा भाषा पर विचार करने की lua चाहते हो सकता है के लिए देख रहे हैं। – Femi
कोशिश करें [हग्स] (http://www.haskell.org/hugs/)। –
@ फेमी मैं वर्तमान में लुआ का उपयोग कर रहा हूं :) लेकिन मैं हास्केल पर स्विच करना चाहता हूं। – Eonil