Summary of current change suggestions

Marcin 'Qrczak' Kowalczyk qrczak at
Thu Feb 22 08:56:22 EST 2001

Thu, 22 Feb 2001 12:08:22 -0000, Simon Marlow <simonmar at> pisze:

> Don't forget you might need multiple includes, eg. <sys/types.h> &
> <sys/socket.h> for socket(), and ordering is important.

Easy with my proposal:

foreign import "socket" include "<sys/types.h>" include "<sys/socket.h>"
    socket_c :: CInt -> CInt -> CInt -> IO CInt

include options accumulate instead of being overridden.

I insist on being able to write:

foreign default include "<sys/types.h>" include "<sys/socket.h>"

> Marcin: I guess hsc2hs should have some magic to insert the include
> specs automatically :)

Ugly magic. 'foreign default' is better.

#let my_includes name = "\"<sys/types.h>:<sys/socket.h>:%s\"", name

foreign import #my_includes "socket"
    socket_c :: CInt -> CInt -> CInt -> IO CInt

How would I omit the foreign name (to be derived from the Haskell name)
but specify headers?

No, making it a part of a string is bad. Optional attributes should be
expressed with an open set of defaultable pseudo-keywords like current

 __("<  Marcin Kowalczyk * qrczak at
  ^^                      SYGNATURA ZASTÊPCZA

More information about the FFI mailing list