Installing GHC iOS

Using GHC iOS

{-# LANGUAGE ForeignFunctionInterface #-}
module Counter where
import Control.Concurrent
import Control.Monad
foreign export ccall startCounter :: Int -> IO ()
startCounter :: Int -> IO ()
startCounter = void . forkIO . void . loop
    where loop i = do
            putStrLn (replicate i 'o')
            threadDelay (10^6)
            loop (i + 1)
ghc-ios Counter

(Counter.a will be a fat binary that works with both devices and the simulator.)

Using GHC iOS with Cabal