Friday, February 1, 2008

Haskell HSQL/SQLite with ghc 6.8 setup is ...a little...messed up?

I am doing my research on the intertubes and it looks like database access with ghc/haskell is not that high on the list of priorities. I am sure, somewhere in the that haskell source is working code. It is just a matter of getting it to work with the most recent stuff; like Cabal 1.2+, GHC6.8+, and gasp Sqlite. I didn't even think about messing with postgres/sqlite.

This the difference between opensource and commercial software. Not that there are sometimes issues with the code. It is an issue of doing the right thing and/or making people happy. Most opensource projects do it the right way? Huh? Ideally, you don't want to mix the base haskell system with the database drivers. GHC has done just that. E.g. Java may include a whole mess of garbage that you don't normally need. In theory, it doesn't make sense.

But, if you are a lazy developer, sometimes being able to just run your database code is a lot easier even though, theoretically, the base compiler should be separate from
external libraries.

It would nice if I could just write my SQL code and go about my day, but I can understand the decoupling of components. Only drawback is that the things that normally would be be important in modern development like database access. Shrug.

I will keep you up to date.

Some of my research.

"> something seemed to have changed in cabal
> (compiling hsql-1.7 with ghc version 6.8.0.20070921)
>
> HSQL/MySQL$ runhaskell Setup.lhs configure -p -O
>
> Setup.lhs:8:33:
> Module
> `Distribution.Simple.Utils'
> does not export
> `rawSystemVerbose'
>
> (same: http://hackage.haskell.org/packages/archive/hsql-mysql/1.7/log )
>
> is there a workaround?

The api that the Setup.lhs is using has changed, it's not just rawSystemVerbose.
The return types are now IO () not IO ExitCode and verbosity is now a proper
Verbosity type, not an Int. The Setup.lhs can be considerably simplified by
using configurations and other new features.

So basically it needs updating for the newer cabal. It may also need to be
updated for the fact that many modules from the base package have been split off.

I've attached an example updated Setup.lhs and hsql-mysql.cabal files.

Don was suggesting we start a wiki page with advice to package maintainers on
what updates are common for the transition to ghc-6.8 and cabal-1.2. This is a
certainly a good idea. By trying a range of packages it should also tell us if
there are any minor cabal changes that we could do to make the transition
smoother (eg adding back rawSystemVerbose with a deprecation warning)."

No comments: