Hello,

I'm a beginner trying to use FFI. I copied the example given in :

The Glasgow Haskell Compiler User's Guide, Version 5.04
Chapter 8. Foreign function interface (FFI)

--------------------------------------------------------------------------
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))
--------------------------------------------------------------------------

Copied it verbatim. And simply tried to compile it using "ghc -c Foo.hs -o 
Foo.o" and always got the error :

Type signature given for an expression (at the line following the "foreign 
export")

I then tried to import the "Foreign" and "Foreign.C" modules but it didn't 
change anything.

I am missing something and I would be VERY grateful to anyone that tells me 
what.

Thank you

Francis Girard
Le Conquet (France)
[EMAIL PROTECTED]
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to