
Hi, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bindings This is a package aimed at library writers, not to the everyday Haskell programmer. This the beggining of my goal to create a set of packages like: bindings-common bindings-sqlite3 bindings-openusb bindings-gsl bindings-yourFavoriteLibrary Those are not going to be Haskell style bindings. Instead, what I want is to create a set of low level bindings to the best libraries available, so that if you want to write your Haskell wrap to a foreign library using the latest Haskell features, you can do that relying on low level bindings that are comprehensive, well tested and well behaved, and with all problems regarding building and portability already solved in the best way the community was able to do. Beneficts you get by using it: - If 10 people are trying to write modules over, say, 'gsl', all of then will help contribute with bug-hunting and thoughts to the common package 'bindings-gsl'. - Use your time to write cool experiences with GADTs and Template Haskell. Leave the boring low level stuff to 'bindings-*'. - HUnit tests can be created to all bindings. If you suggest one in a ticket, and it does hold, it will be added to a test package. If you know library 'foo' very well, you won't need to read the documentation for 'bindings-foo'. A set of guidelines ensure that all these low-level bindings can be used after the original library documentation. If you know the guidelines and you know 'foo', you can use 'bindings-foo' after reading in the worst case just a few comments. These guidelines, actually, are community driven. You can find the current set here: http://hackage.haskell.org/packages/archive/bindings/0.1/doc/html/Bindings.h... If you want changes or features, just open a ticket at package home: http://bitbucket.org/mauricio/bindings What I really need now is help from libraries experts. If you know your favorite library very well (specially its build process and compile time options) and are willing to answer a few questions on how it works, I'll add a binding to it. This package is a byproduct of professional, paid work. If it achieves some success, it will be maintained in the long term and, if something important depends on it, I'm willing to give maintenance to someone better than me. Best, Maurício

Maurício wrote:
These guidelines, actually, are community driven. You can find the current set here:
http://hackage.haskell.org/packages/archive/bindings/0.1/doc/html/Bindings. html
Prefixing uppercase with underscore seems wrong; some people think we should have "caseless underscore". Is simply lowercasing the first letter a bad policy? "All foreign functions are declared safe. Also, they should all result in a System.IO.IO, even when they are supposed to be effect-free." This may be insufficient for some speed purposes: probably we'll just wait and see. class Bindings.Utilities.Callback confuses me. Do you have an example where it's used/needed? This generally looks practical for bindings to C. For binding to fancier languages such as Python (even if we had the technology to do so), some further design decisions might have to be made. -Isaac

These guidelines, actually, are community driven. You can find the current set here:
http://hackage.haskell.org/packages/archive/bindings/0.1/doc/html/Bindings.h...
Prefixing uppercase with underscore seems wrong; some people think we should have "caseless underscore". Is simply lowercasing the first letter a bad policy?
No. As long as it is a policy. If I get feedback, anything can be changed.
"All foreign functions are declared safe. Also, they should all result in a System.IO.IO, even when they are supposed to be effect-free."
This may be insufficient for some speed purposes: probably we'll just wait and see.
Yes, maybe I'm beeing paranoid here. There are many ways in which exceptions can be safely accepted.
class Bindings.Utilities.Callback confuses me. Do you have an example where it's used/needed?
The point here was just to avoid a complicated policy on callback names. To see an example, check the C code in the botton of the page below: http://sqlite.org/quickstart.html There's a corresponding file named '5minutes.hs' in the distribution where a callback type is used. Maybe a different policy on how to type and use callbacks could be done.
(...) For binding to fancier languages such as Python (even if we had the technology to do so), some further design decisions might have to be made.
Sure. Thanks for your thoughts! Maurício

Maurício wrote:
class Bindings.Utilities.Callback confuses me. Do you have an example where it's used/needed?
The point here was just to avoid a complicated policy on callback names. To see an example, check the C code in the botton of the page below:
http://sqlite.org/quickstart.html
There's a corresponding file named '5minutes.hs' in the distribution where a callback type is used. Maybe a different policy on how to type and use callbacks could be done.
I'm sorry, I couldn't find where '5minutes.hs' is? I downloaded the 0.1 .tar.gz from Hackage... and tried Googling -Isaac

The point here was just to avoid a complicated policy on callback names. To see an example, check the C code in the botton of the page below:
http://sqlite.org/quickstart.html
There's a corresponding file named '5minutes.hs' in the distribution where a callback type is used. Maybe a different policy on how to type and use callbacks could be done.
I'm sorry, I couldn't find where '5minutes.hs' is? I downloaded the 0.1 .tar.gz from Hackage... and tried Googling
It is in: bindings-0.1/traduttoreTraditore/sqlite3/5minutes.hs ('traduttoreTraditore' is the directory for Haskell versions of libraries examples. Check: http://en.wikipedia.org/wiki/Traduttore_traditore if you are curious about the name.) Best, Maurício
participants (3)
-
Isaac Dupree
-
Maurício
-
Maurício