FFI and GHC

Joćo Ferreira bracaman@box.sk
19 Oct 2002 20:41:52 +0100


Hello all,

I am trying to learn how to use FFI with GHC. I've tried the example in
GHC's user's guide but it didn't worked. Here it is:


1) The haskell code
===================

[bracaman@tucano hib]$ cat foo.hs
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))

2) The error
============

[bracaman@tucano hib]$ ghc -c foo.hs
foo.hs:3: Type signature given for an expression
[bracaman@tucano hib]$


I just can't understand why this is happening... can someone, please,
help?

Thank you in advance,
Joćo Ferreira