ffi002.hs 159 Bytes
Newer Older
rrt's avatar
rrt committed
1 2
module Foo where

Simon Marlow's avatar
Simon Marlow committed
3
foreign export ccall foo :: Int -> IO Int
rrt's avatar
rrt committed
4 5 6 7 8 9 10 11

foo :: Int -> IO Int
foo n = return (length (f n))

f :: Int -> [Int]
f 0 = []
f n = n:(f (n-1))