[nhc-bugs] nhc98 1.14 FFI issues

Manuel M T Chakravarty chak@cse.unsw.edu.au
Fri, 06 Sep 2002 11:42:27 +1000 (EST)


As I am about to make a release of c2hs (and also Gtk+HS), I
made another attempt at compiling the packages with the
latest nhc98 (ie, 1.14), which unfortunately fails.  The
issues are the following:

* nhc98 exports its FFI libraries from a module called `FFI',
  whereas all other systems (and the standard) use `Foreign'
  for the language-independent and `CForeign' for the
  C-dependent libraries.

  This should be pretty easy to fix.  (If you insist on
  providing the `FFI' module, you could just re-export
  parts of `FFI' in `Foreign' and `CForeign'.)

* The FFI includes a `Bits' modules that differs from
  nhc98's `Bit' module (different function names).

  Should also be easy to fix.

* There seems to be a problem with re-exporting identifiers,
  which have been imported qualified.  I vaguely remember
  that Malcolm once told me that nhc98 has a problem with
  that.  

  I am currently working around this by excluding that
  module when compiling with nhc98 (as it is a library
  module that is not really needed for c2hs).

* I get a set of strange error messages:

  ======	Errors after type inference/checking:
  No default for  Parsers.Token at 282:3.(1378,[(173,1432)])
  No default for  Parsers.Token at 254:32.(1267,[(173,1433)])
  No default for  Parsers.Token at 223:1.(1061,[(173,1188)])
  No default for  Parsers.Token at 204:25.(1180,[(173,1187)])

  All of the error positions are in the first equation of a
  functions that have `Token t' as the class context in
  their signature.  The Token class is defined as 

    class (Pos t, Show t, Eq t, Ord t) => Token t

  and I am not sure what these error messages are supposed
  to tell me.  GHC doesn't have a problem with it and it is
  legal H98 as far as I can see.  Strange is also that there
  are many functions that have the same class context about
  which nhc98 doesn't complain.

  Any ideas what this is about?

Cheers,
Manuel