[Haskell] [Haskell-cafe] ANNOUNCE: system-filepath 0.4.5 and system-fileio 0.3.4

Ian Lynagh igloo at earth.li
Thu Feb 16 22:20:02 CET 2012


On Thu, Feb 09, 2012 at 11:40:28AM -0800, John Meacham wrote:
> On Thu, Feb 9, 2012 at 11:23 AM, Ian Lynagh <igloo at earth.li> wrote:
> > On Thu, Feb 09, 2012 at 04:52:16AM -0800, John Meacham wrote:
> >>
> >> Since CSigSet has "sigset_t" associated with it, 'Ptr CSigSet' ends up turning
> >> into 'sigset_t *' in the generated code. (Ptr (Ptr CChar)) turns into char**
> >> and so forth.
> >
> > What does the syntax for associating sigset_t with CSigSet look like?
> 
> There currently isn't a user accessable once,
>
> My current syntax idea is.
> 
> data CFile = foreign "stdio.h FILE"
> 
> but it doesn't extend easily to 'newtype's
> or maybe a {-# CTYPE "FILE" #-} pragma...

I've now implemented this in GHC. For now, the syntax is:

type    {-# CTYPE "some C type" #-} Foo = ...
newtype {-# CTYPE "some C type" #-} Foo = ...
data    {-# CTYPE "some C type" #-} Foo = ...

The magic for (Ptr a) is built in to the compiler.


Thanks
Ian




More information about the Haskell mailing list