[Haskell] Re: Haskell DB bindings (was Re: ANN: HDBC (Haskell Database Connectivity)

Keean Schupke k.schupke at imperial.ac.uk
Tue Jan 17 10:08:24 EST 2006

John  wrote:

>On 2006-01-14, Keean Schupke <k.schupke at imperial.ac.uk> wrote:
>>Erm, has nobody replied to this yet? I want a robust interface, that 
>>uses bracket notation all the way down, so that any error is caught and 
>>resources are freed appropriately without the use of finalizers (which 
>>may not get run and lead to resource starvation - they are not reliable 
>To be sure, your only failure situation in this case is if you're
>dealing with many connections *and* creating/destroying them frequently.
>Hopefully you wouldn't be.
You could be using connection pooling in the database driver or ODBC 
layer... Here the minimal
overhead of opening/closing allows you to use a "bracket" within each 
connection, rather than around
the whole server. Besides which the goal is not just to be safe in 
practice, but to be theoretically safe in all
circumstances. If you allow the programmer to shoot themselves in the 
foot, then they often will (for example
memory management and buffer overflows)... Its no good to partly remove 
responsibility, as that makes bugs
more likely not less likely (If the programmer has to deal with an 
opaque system with flaws, unless the programmer
is highly aware of those flaws they will take no account of them in 
their coding). The only way you can give the
programmer a genuine black box to play with, is if it is theoretically 
safe, then the programmer can (ab)use it
how they wish without accidentally breaking the conditions of usage.


More information about the Haskell mailing list