From simonpj at microsoft.com Fri Apr 14 06:41:34 2006 From: simonpj at microsoft.com (Simon Peyton-Jones) Date: Fri Apr 14 06:36:36 2006 Subject: FFI docs Message-ID: <036EAC76E7F5EC4996A3B3C3657D4116051DC0A1@EUR-MSG-21.europe.corp.microsoft.com> 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 From chak at cse.unsw.edu.au Sat Apr 15 16:04:30 2006 From: chak at cse.unsw.edu.au (Manuel M T Chakravarty) Date: Sat Apr 15 15:59:41 2006 Subject: FFI docs In-Reply-To: <036EAC76E7F5EC4996A3B3C3657D4116051DC0A1@EUR-MSG-21.europe.corp.microsoft.com> References: <036EAC76E7F5EC4996A3B3C3657D4116051DC0A1@EUR-MSG-21.europe.corp.microsoft.com> Message-ID: <1145131470.2310.22.camel@AttitudeAdjuster.localdomain> 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@haskell.org > http://www.haskell.org/mailman/listinfo/ffi