[Haskell] ANNOUNCE: Haskell 2010 Report (final)

Simon Marlow marlowsd at gmail.com
Wed Jul 14 05:13:56 EDT 2010

On 12/07/2010 13:09, John Meacham wrote:
> On Mon, Jul 12, 2010 at 11:57:18AM +0100, Simon Marlow wrote:
>> On 09/07/2010 18:46, John Meacham wrote:
>>> On Fri, Jul 09, 2010 at 12:39:38PM +0100, Simon Marlow wrote:
>>>> On 08/07/2010 22:46, John Meacham wrote:
>>>>> Ack, I just noticed that IntPtr,IntMax, and WordPtr and WordMax were
>>>>> left out of the report. These are fairly vital for writing portable FFI
>>>>> code.
>>>> Make a proposal to get them into Haskell 2011, I don't imagine it would
>>>> be controversial.
>>> That's the thing, They were already accepted as part of H'2010. At least
>>> according to the site:
>>> http://hackage.haskell.org/trac/haskell-prime/wiki/ForeignFunctionInterface
>> Ok, this is probably an oversight on my part, so sorry about that.  I
>> can treat it as errata and fix the report.
>> However I'm a bit confused.  Currently we have IntPtr and WordPtr
>> exported by Foreign.Ptr in base, but we don't have IntMax and WordMax
>> anywhere that I can see, and I don't recall any discussion about where
>> they should be defined, or what they should be defined to.
> Hmm... It appears there was some divergence between my initial proposal,
> what jhc implemented, and what ghc implemented. Is there any issue with
> declaring that IntPtr and WordPtr marshal to intptr_t and uintptr_t
> respectively? If not, then just having those in Foreign.Ptr like ghc
> does seems fine. In jhc I export them from Data.Word and Data.Int
> respectively, but I will change it to match ghc/the report.

I have added IntPtr and WordPtr to Foreign.Ptr, and added notes that 
they are compatible with intptr_t and uintptr_t, respectively.


Though I'm not sure this is the best solution, because we also have 
CIntPtr and CUIntPtr in Foreign.C.Types, which are guaranteed to be 
compatible with (u)intptr_t but do not have conversion operations.  We 
might want to revisit this in the future.

I also followed up with some other changes to the FFI spec that I 
overlooked in the Haskell 2010 merge, particularly to do with newtype 
marshalling in the definition of foreign type:


> I do think IntMax and WordMax are quite useful as haskell types and
> should be in Data.Int and Data.Word, but if we have CIntMax and CWordMax
> then they arn't strictly neccesary from a FFI standpoint.

I've left out IntMax and WordMax for now, as we don't even have them in 
GHC.  The best way to proceed here is with a library proposal and then a 
Haskell 2010 proposal.


More information about the Haskell mailing list