FFI typing issues [was: Typing f.e.d.]
Simon Marlow
simonmar at microsoft.com
Mon Apr 30 10:56:19 EDT 2001
> The first one is the typing of `foreign import dynamic', which is
> documented as
>
> Addr -> (prim_args -> IO prim_result)
(actually the Addr can currently be 'Ptr a' or 'FunPtr a' too).
> GHC currently implements more or less `Addr -> prim_type',
> but that's not
> the point here. I propose changing this to
>
> FunPtr prim_type1 -> prim_type2 -- where prim_type1 == prim_type2
>
> again deprecating and keeping the old typing. Apart from the purely
> technical `IO' (hmmmm, is this *really* necessary?), it makes things
> almost symmetrical to f.e.d.
Looks reasonable to me.
> Another point is the typing of `foreign label', which is
> currently simply
>
> Addr
>
> I propose to change this to *two* possible typings:
>
> Ptr a
> FunPtr a
I think it's currently Ptr a, FunPtr a, or Addr (see
TysWiredIn.isFFILabelTy).
> Should we make newtype completely transparent?
I think so, yes.
Cheers,
Simon
More information about the FFI
mailing list