Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Manuel M T Chakravarty
Simon Marlow [EMAIL PROTECTED] wrote, data Point foreign import getMousePos :: Ptr Point - IO () foreign import getX :: Ptr Point - IO Int foreign import getY :: Ptr Point - IO Int vs data Point = Point (Ptr Point) foreign import getMousePos ::

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Alastair Reid
ok, I'm convinced. The semantics of empty datatypes can be a type inhabited only by bottom. Hugs implements exactly that. [Except in the special case of a few magical names (Int, Float, etc) when they occur in the Prelude (and only then). Since it is only usable in the Prelude, they can be

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Manuel M T Chakravarty
Ross Paterson [EMAIL PROTECTED] wrote, Minor nits: there's a footnote saying Finalizers in Haskell cannot be savely [sic] realised without requiring support for pre-emptive concurrency. I'd suggest dropping pre-emptive: with cooperative concurrency it's perfectly safe to collect the

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Manuel M T Chakravarty
Simon Marlow [EMAIL PROTECTED] wrote, Manuel M T Chakravarty [EMAIL PROTECTED] writes: -=- Changes since RC 9 * 6.2: All the types in CTypes must be newtypes that are exported abstractly. This change makes things highly inconvenient in nhc98. A newtype can

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Malcolm Wallace
* 6.2: All the types in CTypes must be newtypes that are exported abstractly. How about exporting them non-abstractly for nhc98 only, and adding a comment to explain why the workaround is necessary? That's what I prefer, too. OK, that's what I've done. The spec can

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Manuel M T Chakravarty
Simon Marlow [EMAIL PROTECTED] wrote, We routinely use code like this: data Point foreign import getMousePos :: Ptr Point - IO () foreign import getX :: Ptr Point - IO Int foreign import getY :: Ptr Point - IO Int The idea being that: 1) there is a foreign type

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Malcolm Wallace
Let's be clear about the role of Point here: it is a dummy type argument to Ptr, used to disambiguate the type 'Ptr Point' from any other kind of Ptr. It is for type-safety in the Haskell code. It doesn't matter how many values of the type Point there are. I could use any Haskell

RE: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-05 Thread Simon Marlow
data Point foreign import getMousePos :: Ptr Point - IO () foreign import getX :: Ptr Point - IO Int foreign import getY :: Ptr Point - IO Int vs data Point = Point (Ptr Point) foreign import getMousePos :: Point - IO () I like the second idiom. You are

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 9

2003-06-05 Thread Ross Paterson
On Wed, Jun 04, 2003 at 11:09:43PM +1000, Manuel M T Chakravarty wrote: StablePtr are used to export references to Haskell values to C, where they are treated as abstract data. In C one traditionally uses (void *) for that purpose (see man qsort(3)). We want to make sure HsStablePtr is not