FFI 1.0 in GHC

Simon Marlow simonmar at microsoft.com
Mon Feb 4 09:49:54 EST 2002

> I have just committed the changes necessary to make GHC
> conform to the FFI Addendum 1.0 to the CVS repo.  The old
> style of foreign declarations is still supported, but causes
> deprecation warnings.

Fantastic. Thanks!

> I had to change one thing in the FFI Report.  I renamed the
> `IOErrorType' inspection functions from `MarshalError' to
>   alreadyExistsErrorType :: IOErrorType 
>   doesNotExistErrorType  :: IOErrorType 
>   alreadyInUseErrorType  :: IOErrorType 
>   fullErrorType		 :: IOErrorType 
>   eofErrorType	         :: IOErrorType 
>   illegalOperationType   :: IOErrorType 
>   permissionErrorType    :: IOErrorType 
>   userErrorType		 :: IOErrorType 
> The old proposal of using `userError' for the last function
> clashed with the function of the same name in the
> `Prelude'. 

Oh yes, I didn't notice that.  I think these renamings are fine.

> I was wondering whether we should have functions
> `isAlreadyExistsErrorType' etc, as otherwise, values of
> `IOErrorType' need to be wrapped into an `IOError' before
> they can be inspected with the standard routines from `IO'.
> But this would just be a convenience, which I am not sure
> whether it would really be needed much.  So, I haven't added
> it.  Opinions?

I think I mentioned before that I'd like to flesh out the support for
building/inspecting IOErrors a bit more.  I'd like to see:

  -- c.f. IO.ioeGetHandle etc.
  ioeGetType :: IOError -> IOErrorType

  isAlreadyExistsErrorType :: IOErrorType -> Bool
  isDoesNotExistErrorType  :: IOErrorType -> Bool

in the New Libraries I plan to export the IOError-manipulating
functionality from System.IO.Error.


More information about the FFI mailing list