Manuel M. T. Chakravarty <[EMAIL PROTECTED]> writes:
> 
> Sven Panne <[EMAIL PROTECTED]> wrote,
> 
> > [ Simply can't resist...  ;-) ]
> > 
> > Simon Marlow wrote:
> > > The easiest way is to declare mmap as a foreign function using
> > > foreign import, then build a little wrapper around it.
> > 
> > A problem will be: What Haskell types should be used for size_t and
> > off_t? Getting this done properly would require autoconf or 
> something
> > similar. Perhaps some more Haskell types (Size, Off, ...) should be
> > added to the FFI module. I'm not sure which ones exactly and if FFI
> > is the right place for it. Opinions?
> 
> I don't think that the standard FFI is the right place for
> that.  If you are programming the FFI by hand, autoconf is
> the right thing to use.  Otherwise, a tool can help.
> C->Haskell can compute the right type by analysing the C
> headers, ie, feeding it `sys/mman.h'.  H/Direct when fed
> `mman.h' might also do the right thing.
> 

I don't see why HDirect shouldn't.

This request is not a new one - having a module that provides
a Haskell mapping for the various 'abstract' types that
ISO/ANSI C defines (and POSIX.1 doesn't.) It was a bit painful
to introduce such a thing at the time (it very easily led
to mutual dep. between the 'posix' and 'misc' syslibs), but
perhaps the new library organization has untied the knot.

--sigbjorn

Reply via email to