FFI docs

View: New views
2 Messages — Rating Filter:   Alert me  

FFI docs

by Simon Peyton-Jones :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Manuel

A couple of comments about the FFI spec.


I was trying to find out whether the automatic newtype unwrapping for
'foreign' declarations was part of the FFI spec.  I searched for
'newtype'.  Nothing.

Turns out that the *only* reference is in the sentence in 3.2:
        "The argument types ati produced by fatype must be marshallable
foreign types; that is, each
ati is either (1) a basic foreign type or (2) a type synonym or renamed
datatype of a marshallable
foreign type."

This is very quiet!  The "renamed datatype" nomenclature is never used
in practice (only in the Haskell report), and in any case the sentence
is hard to unpick without an example or two.


Second point.  Consider
        foreign import "dynamic" foo :: (Int -> IO Int) -> ...

I'm not sure whether (Int -> IO Int) is considered a "marshallable
foreign type", according to the defn in 3.2.

I also found the separation of 4.1.3 from 3.2 quite hard to understand.
I was searching in 3.2 for "wrapper" and "dynamic" in vain!  I don't
have a good solution to this, except perhaps some explicit fwd refs, and
a clear explanation of the logic behind the structure of the document.


Since some aspects of the FFI spec may change slightly for Haskell',
this seemed like a good moment to mention these points.

Simon
_______________________________________________
FFI mailing list
FFI@...
http://www.haskell.org/mailman/listinfo/ffi

Re: FFI docs

by Manuel M T Chakravarty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Simon,

I started to collect all pending issues concerning the FFI spec on the
H' wiki page for the FFI:

  http://hackage.haskell.org/trac/haskell-prime/wiki/ForeignFunctionInterface

There is also another issue concerning newtypes that SimonM brought up a while ago.

Manuel

> A couple of comments about the FFI spec.
>
>
> I was trying to find out whether the automatic newtype unwrapping for
> 'foreign' declarations was part of the FFI spec.  I searched for
> 'newtype'.  Nothing.
>
> Turns out that the *only* reference is in the sentence in 3.2:
> "The argument types ati produced by fatype must be marshallable
> foreign types; that is, each
> ati is either (1) a basic foreign type or (2) a type synonym or renamed
> datatype of a marshallable
> foreign type."
>
> This is very quiet!  The "renamed datatype" nomenclature is never used
> in practice (only in the Haskell report), and in any case the sentence
> is hard to unpick without an example or two.
>
>
> Second point.  Consider
> foreign import "dynamic" foo :: (Int -> IO Int) -> ...
>
> I'm not sure whether (Int -> IO Int) is considered a "marshallable
> foreign type", according to the defn in 3.2.
>
> I also found the separation of 4.1.3 from 3.2 quite hard to understand.
> I was searching in 3.2 for "wrapper" and "dynamic" in vain!  I don't
> have a good solution to this, except perhaps some explicit fwd refs, and
> a clear explanation of the logic behind the structure of the document.
>
>
> Since some aspects of the FFI spec may change slightly for Haskell',
> this seemed like a good moment to mention these points.
>
> Simon
> _______________________________________________
> FFI mailing list
> FFI@...
> http://www.haskell.org/mailman/listinfo/ffi

_______________________________________________
FFI mailing list
FFI@...
http://www.haskell.org/mailman/listinfo/ffi
LightInTheBox - Buy quality products at wholesale price