FFI Report, CVS Id 1.11
Alastair David Reid
reid at cs.utah.edu
Mon Aug 20 16:20:52 EDT 2001
> NHC's current implementation of "foreign export"
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> From the discussion, it seems that NHC simply allows the
> phrase "foreign export" in front of the normal type signature of a
> function (as opposed to in addition to that type signature). I
> never had this in mind and it has always been different in GHC and
> in Sigbjorn's FFI spec. In fact, being able to have
> foo :: Num a => a -> a foo = ...
> foreign export foo :: Int -> Int
> was always sold as a feature of the system.
If I understand it, the big difference is that GHC will let you write
either 2 sigs (one a normal sig, one a foreign export sig) or 1 sig
(just the foreign export sig) whereas NHC lets you have just one.
I think I prefer to have both because of examples like your foo.
(But, Hugs doesn't implement this either because I couldn't quite
figure out the typechecker hooks I needed. I regard this (and
document it) as a bug.)
--
Alastair Reid reid at cs.utah.edu http://www.cs.utah.edu/~reid/
More information about the FFI
mailing list