ANN: bindings-common 0.2.1

Maurí­cio briqueabraque at yahoo.com
Mon Jul 27 14:15:26 EDT 2009


bindings-* packages provide low level bindings to well known
foreign libraries like sqlite3 and libusb. They are supposed
to be used by high level module developers who needs special
functionality already available outside Haskell. Natural examples
of such modules would be higher level versions of such bindings.

bindings-common offers basic code that makes writing such packages
easier, and provide a common design standard.

http://hackage.haskell.org/package/bindings-common

The major new feature of this release is the availability of
hsc2hs custom macros, and a corresponding big reduction in code
size. As an example, the code below is all that is necessary to
write a Haskell version of a C struct, with Storable instance:

-- This is 'hostent' struct from posix <netdb.h>:

#bindings_starttype struct hostent
#bindings_field h_name , CString
#bindings_field h_aliases , Ptr CString
#bindings_field h_addrtype , CInt
#bindings_field h_length , CInt
#bindings_field h_addr_list , Ptr CString
#bindings_stoptype _

That results in

http://hackage.haskell.org/packages/archive/bindings-posix/0.0.2/doc/html/Bindings-Posix.html#t%3AHostent

Those hsc2hs macros have been used to map the standard C library
(see module Bindings.C), as well as posix standard library (in a
separate package), and are made available to modules depending on
bindings-common.

Best,
Maurício



More information about the Libraries mailing list