database access recommendation

I'm teaching myself Haskell, and was wondering if anyone could recommend a library for accessing databases, PostgreSQL in particular. I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and HSQL looked promising, but I can't get it to install on Windows or FreeBSD, with Hugs or GHC. According to the FreeBSD ports system, it is marked as broken. It fails with Hugs on both platforms on the "runhugs Setup.lhs configure" step in the base HSQL library with: FreeBSD: ERROR "/usr/local/lib/hugs/libraries/Text/ParserCombinators/ReadP.hs":133 - Syntax error in type expression (unexpected `.') Windows: ERROR "C:\Program Files\WinHugs\libraries\Text\ParserCombinators\ReadP.hs":156 - Syntax error in type expression (unexpected `.') GHC crashes with no error on the "runghc Setup.lhs build" step in the base HSQL library in Windows. In FreeBSD I can completely build and install the base library, but in any of the database specific directories, "runghc Setup.lhs configure" yields: "Setup.lhs:17:71: Couldn't match `PackageDescription' against `LocalBuildInfo' Expected type: Args -> ConfigFlags -> LocalBuildInfo -> IO ExitCode Inferred type: [String] -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ExitCode In the `postConf' field of a record In the record update: defaultUserHooks {preConf = preConf, postConf = postConf} <interactive>:1:87: Failed to load interface for `Main': Bad interface file: Setup.hi Setup.hi: openBinaryFile: does not exist (No such file or directory)" Thanks, Brock

Hi
It fails with Hugs on both platforms on the "runhugs Setup.lhs configure" step in the base HSQL library with:
Windows:
ERROR "C:\Program Files\WinHugs\libraries\Text\ParserCombinators\ReadP.hs":156 - Syntax error in type expression (unexpected `.')
That looks like it requires haskell extensions (forall in particular), and Hugs is running without them. Try adding the -98 option to Hugs. The other option is to start WinHugs, click on Options, and under Haskell Extensions change it to Hugs/GHC extensions. Thanks Neil

On Thu, 2006-04-27 at 10:45 -0500, Brock Peabody wrote:
I'm teaching myself Haskell, and was wondering if anyone could recommend a library for accessing databases, PostgreSQL in particular.
I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and HSQL looked promising, but I can't get it to install on Windows or FreeBSD, with Hugs or GHC. According to the FreeBSD ports system, it is marked as broken.
There is also HDBC which is nearing a 1.0 release and in my experience is easier to install. (I package both HSQL & HDBC for Gentoo) http://quux.org/devel/hdbc/ In particular you'll want: http://quux.org/devel/hdbc/hdbc_0.99.2.tar.gz and the PostgreSQL backend: http://quux.org/devel/hdbc/hdbc-postgresql_0.99.2.1.tar.gz API docs: http://darcs.complete.org/hdbc/doc/Database-HDBC.html Duncan

From: Duncan Coutts [mailto:duncan.coutts@worc.ox.ac.uk]
There is also HDBC which is nearing a 1.0 release and in my experience is easier to install. (I package both HSQL & HDBC for Gentoo)
Thanks, I'll check that out. For some reason I saw HDBC and just assumed it was an interface for ODBC. Brock

On Thu, 2006-04-27 at 11:50 -0500, Brock Peabody wrote:
From: Duncan Coutts [mailto:duncan.coutts@worc.ox.ac.uk]
There is also HDBC which is nearing a 1.0 release and in my experience is easier to install. (I package both HSQL & HDBC for Gentoo)
Thanks, I'll check that out. For some reason I saw HDBC and just assumed it was an interface for ODBC.
It's that too! And SQLite and you can write other backends independently. Duncan

From: Duncan Coutts [mailto:duncan.coutts@worc.ox.ac.uk]
It's that too! And SQLite and you can write other backends independently.
Sounds cool! Unfortunately I'm having problems installing it but I think it's probably something simple this time. I can configure, build, and install hdbc. When I try to build hdbc-postgresql it fails because it can't include libpq-fe.h or pg_config.h, both of which are present in /usr/local/include. I noticed when I ran configure that it mentioned the absence of haddock, happy, and alex, so I am installing them just in case that had anything to do with it. Thanks, Brock

Hello Brock, Thursday, April 27, 2006, 7:45:16 PM, you wrote:
I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and
suffice it to say that this page don't reflects current state of the art. during many years it was not updated and when it was moved to the wiki half-year ago it's contents remains the stone-age better sources of information are HCAR ("Haskell Communities and Activities Report", http://www.haskell.org/communities/11-2005/html/report.html) and HWN (Haskell Weekly News, http://haskell.org/haskellwiki/HWN) as one person said, "There are three active database libraries: HDBC, HSQL and Takusen.". i've included here last announces on two of them (just searched my mail archives for "SQL"): I'm pleased to (at long last) announce the release of HDBC version 0.99.2, along with 0.99.2 versions of all database backends. If things go well, after a few weeks of testing, this version will become HDBC 1.0.0. HDBC is a multi-database interface system for Haskell -- more on it below. Since 0.99.0, several major things have been updated or enhanced: * Complete rework of memory management system. * Standardized memory management system for all database backends. * Support for querying metadata (type, size, etc.) about columns both in result sets and in database tables * Support for querying the level of transaction support in the underlying DB * ODBC driver has support for working with databases such as MySQL that don't support transactions * Testsuite enhancements for all the above I believe that these modifications will make HDBC suitable as a full-fledged backend for HaskellDB. HDBC is available from: http://quux.org/devel/hdbc gopher://quux.org/1/devel/hdbc Version 0.99.2 has also been uploaded to Debian unstable. Features of HDBC ---------------- * Ability to use replacable parameters to let one query be executed multiple times (eliminates the need for an escape function) * Ability to access returned rows by column number * Ability to read data from the SQL server on-demand rather than reading the entire result set up front * HUnit testsuite for each backend driver * Well-defined standard API and easy backend driver implementation * Lazy reading of the entire result set (think hGetContents, but for the results of SELECT) (see sFetchAllRows) * Support for translation between Haskell and SQL types * Support for querying database server properties * Add-on package (hdbc-missingh) to integrate with MissingH, providing a database backend for AnyDBM. * Support for querying metadata such as column names. In addition, there is extensive documentation for HDBC. Backend drivers exist for Sqlite v3, PostgreSQL, and ODBC. MySQL is supported via the ODBC driver and the ODBC testsuite passes against MySQL (saving the transaction tests, which aren't supported by MySQL). In addition, there is a odbc-missingh package that can turn and HDBC database into an AnyDBM backend for MissingH. (Sqlite3 could be very handy there) Darcs repositories are available for all of this at http://darcs.complete.org/ I am pleased to announce the HSQL library version 1.6. The HSQL is a simple library, which provides interface to multiple databases. MySQL, PostgreSQL, ODBC, SQLite and MSI (new) are currently supported. What is new? ~~~~~~~~~~ 1. HSQL is fully Cabalized. 2. Windows users don't need to have cygwin in order to build HSQL. The old build system was using ./configure script which is replaced with hooks in ./Setup.lhs script. 3. HSQL is split into multiple Cabal packages. There is one common package 'hsql' and multiple database specific packages: hsql-odbc, hsql-postgresql, hsql-mysql, hsql-sqlite, hsql-sqlite3, hsql-msi 4. There are two new database frontends: SQLite3 and MSI. The SQLite3 frontend is for SQLite version 3.0 and above. The old SQLite frontend still exists. MSI is fontend to Microsoft Installer database. Each .msi package is a relational database which you can query and modify using HSQL. [Haskell] ANNOUNCE: HSQL 1.7 released What is new? ~~~~~~~~~~ 1. Driver for Oracle 2. getFieldValueMB is deprecated. Now there is the instance declaration: instance SqlBind a => SqlBind (Maybe a) It allows to use getFieldValue instead of getFieldValueMB. Thanks to Frederik Eaton for this idea. 3. Database.HSQL.SQLite is renamed to Database.HSQL.SQLite2. The trouble was that with Hugs for each module with FFI is generated an extra .dll/.so library. In this case the library is SQLite.dll which on Windows overlaps with the name of the real sqlite.dll library. Home page ~~~~~~~~~ http://htoolkit.sourceforge.net Download from ~~~~~~~~~~~~~ https://sourceforge.net/project/showfiles.php?group_id=65248&package_id=93958 -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

bulat.ziganshin:
Hello Brock,
Thursday, April 27, 2006, 7:45:16 PM, you wrote:
I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and
suffice it to say that this page don't reflects current state of the art. during many years it was not updated and when it was moved to the wiki half-year ago it's contents remains the stone-age
better sources of information are HCAR ("Haskell Communities and Activities Report", http://www.haskell.org/communities/11-2005/html/report.html) and HWN (Haskell Weekly News, http://haskell.org/haskellwiki/HWN)
I'm not sure this is fair. About a month ago I went through the entire HWN archives, the haskell@ archives back to 1990 (Check the Old_news page!) and the last HCAR, adding over 100 entries to the libraries page. So, I argue it is the most complete list we have. And if anything's missing, you know how to edit the wiki. -- Don

Hello Donald, Friday, April 28, 2006, 12:29:38 PM, you wrote:
I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and
suffice it to say that this page don't reflects current state of the art. during many years it was not updated and when it was moved to the wiki half-year ago it's contents remains the stone-age
About a month ago I went through the entire HWN archives, the haskell@ archives back to 1990 (Check the Old_news page!) and the last HCAR, adding over 100 entries to the libraries page.
So, I argue it is the most complete list we have.
GREAT! but you don't announced this work on the haskell list, so noone can know about it -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Bulat Ziganshin wrote:
Hello Donald,
Friday, April 28, 2006, 12:29:38 PM, you wrote:
I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and
suffice it to say that this page don't reflects current state of the art. during many years it was not updated and when it was moved to the wiki half-year ago it's contents remains the stone-age
About a month ago I went through the entire HWN archives, the haskell@ archives back to 1990 (Check the Old_news page!) and the last HCAR, adding over 100 entries to the libraries page.
So, I argue it is the most complete list we have.
GREAT! but you don't announced this work on the haskell list, so noone can know about it
Point your favourite RSS reader at http://haskell.org/haskellwiki/?title=Special:Recentchanges&feed=atom and watch the changes! Cheers, Simon

Hi Bulat, Thanks for all the information. I'm giving HDBC a try as it seems to be the most actively maintained and because I was able to install it. Regards, Brock

Hello Brock, Thursday, April 27, 2006, 7:45:16 PM, you wrote:
I'm teaching myself Haskell, and was wondering if anyone could recommend a library for accessing databases, PostgreSQL in particular.
as Ketil Malde wrote to me in private mail, there is at least one more lib (aside from HDBC/HSQL/Takusen) - HaskellDB. i'm sorry that i have citated phrase that can be no (more) true -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (6)
-
Brock Peabody
-
Bulat Ziganshin
-
dons@cse.unsw.edu.au
-
Duncan Coutts
-
Neil Mitchell
-
Simon Marlow