problems with ghc ffi

David Abbs u0da2@dcs.shef.ac.uk
Mon, 4 Nov 2002 14:38:14 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C2840F.CE869EA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am having problems with the GHC FFI, I am using GHC version 5.04.1 and =
am trying to compile the sample code given on=20
the web site
_______________________________________
module Foo where

foreign export ccall foo :: Int -> IO Int

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

f :: Int -> [Int]
f 0 =3D []
f n =3D n:(f (n-1))
_____________________________________
when I enter
c:/ghc M.hs=20
to compile the code I get the following error
M.hs:5: Type signature given for an expression
I have tried compiling the code using GHC 5.04.1 on windows 98, XP and =
on Linux any help on would be=20
greatly appreciated.
_____________________________________________David Abbs 3rd year =
Undergraduate in Computer Science at the University Of =
Sheffield_____________________________________________u0da2@dcs.shef.ac.u=
k
Have a very nice day !!
=20


------=_NextPart_000_0020_01C2840F.CE869EA0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial><PRE class=3DPROGRAMLISTING><FONT face=3DArial =
size=3D2>I am having problems with the GHC FFI, I am using GHC version =
5.04.1 and am trying to compile the sample code given on =
</FONT></PRE><PRE class=3DPROGRAMLISTING><FONT face=3DArial size=3D2>the =
web site</FONT></PRE><PRE class=3DPROGRAMLISTING><FONT face=3DArial =
size=3D2>_______________________________________</FONT></PRE><PRE =
class=3DPROGRAMLISTING><FONT face=3DArial size=3D2>module Foo where

foreign export ccall foo :: Int -&gt; IO Int

foo :: Int -&gt; IO Int
foo n =3D return (length (f n))

f :: Int -&gt; [Int]
f 0 =3D []
f n =3D n:(f (n-1))</FONT></PRE><PRE class=3DPROGRAMLISTING><FONT =
face=3DArial =
size=3D2>_____________________________________</FONT></PRE><PRE =
class=3DPROGRAMLISTING><FONT size=3D2>when I enter</FONT></PRE><PRE =
class=3DPROGRAMLISTING><FONT size=3D2>c:/ghc M.hs </FONT></PRE><PRE =
class=3DPROGRAMLISTING><FONT size=3D2>to compile the code I get the =
following error</FONT></PRE><PRE class=3DPROGRAMLISTING><FONT =
size=3D2>M.hs:5: Type signature given for an expression</FONT></PRE><PRE =
class=3DPROGRAMLISTING>I have tried compiling the code using GHC <FONT =
face=3DArial size=3D2>5.04.1 on windows 98, XP and on Linux any help on =
would be </FONT></PRE><PRE class=3DPROGRAMLISTING><FONT face=3DArial =
size=3D2>greatly appreciated.</FONT></PRE><PRE =
class=3DPROGRAMLISTING><FONT face=3DArial =
size=3D2>_____________________________________________<BR>David Abbs 3rd =
year Undergraduate in Computer Science <BR>at the University Of =
Sheffield<BR>_____________________________________________<BR><A =
href=3D"mailto:u0da2@dcs.shef.ac.uk">u0da2@dcs.shef.ac.uk</A></FONT></PRE=
><PRE class=3DPROGRAMLISTING><FONT face=3DArial size=3D2>Have a very =
nice day !!</FONT></PRE><PRE class=3DPROGRAMLISTING><FONT face=3DArial =
size=3D2></FONT>&nbsp;</PRE></FONT></DIV></BODY></HTML>

------=_NextPart_000_0020_01C2840F.CE869EA0--