summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_run/ffi002.hs
blob: 0186f327005ff312365c0f48a2ab56d7b3320406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{-# LANGUAGE ForeignFunctionInterface #-}
module Foo where

foreign export ccall foo :: Int -> IO Int

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

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