a cabal/database lib experience (was: [Haskell-cafe] Trivial database access in Haskell)

Claus Reinke claus.reinke at talk21.com
Mon Dec 11 20:13:40 EST 2006

>> if you're using Haskell at all, you *are* the Haskell community.

> [..lots of "I searched, I found, I tried, I got this error, I thought,
>    I tried this workaround, I got to this point, now I'm stuck here..]

I just wanted to comment that I find this kind of "experience report"
very helpful, especially if someone does not give up at the first hurdle,
and goes through the trouble of writing up all the frustrating steps and
thoughts rather than summarizing ("it didn't work"/"I got it to work 
after some fiddling") - thanks!

The problem with mindsets is that minds get set in them, and not only
do people outside find it very difficult to "get in", but the people inside
find it very difficult to understand what it is like "outside".

While you are looking for documentation of the supposedly easy first 
steps to get you started on your more detailed investigation, so you 
have just provided the rest of the community with some documentation
of what its works currently look like.

That situation seems to be slightly embarrassing (if only because we
are tempted to think that we have no time for the traditional README 
and INSTALL files - after all, all darcs/cabal stuff is self-explanatory, 
isn't it, and has been discussed to death somewhere, hasn't it, and the 
library does the obvious thing, doesn't it, and isn't quite ready for prime 
time yet anyway, at which time it is going to be carved in stone and 
documented thoroughly by a team of Pulitzer-price-winning authors?-)

Seriously, and as Simon PJ has been fond of reminding us: the user is
always right, so I very much hope that those of us involved with the
projects mentioned in your report will take note and do something 
about it (for easy reference I repeat it at the end of this message;-).

Some suggestions, gleaned from your experience (perhaps you could
comment on whether they'd have been of any use?):

    - the separation into interpreter/compiler and resource as Setup
        does not set up the right mindset in users. for instance, you can
        "runhaskell Setup.hs --help" as for most unixy tools, but who'd
        think of that in this situation, and how much does it help?

    + add a dedicated command "cabal", which does nothing more
        than "runhaskell Setup", but is more memorable and suggestive

    + when anything goes wrong, also mention "cabal --help" in the
        error message

    + in "cabal --help", explicitly and prominently mention the typical 
        usage cycle (configure/build/install); also point to cabal home 
        page, with more documentation, bug reports, newest version
        and known problem info, downloads, ..

    - the three step separation into configure/build/install is traditional
        and has good justifications, but is unhelpful for the most typical
        use case (I need a library for a part of my work, it isn't installed
        by default, it doesn't have an installer, so I have to do this cabal
        thing to get on with my work). if someone types "cabal install" 
        as the first command, cabal might engage in a simple dialogue:

        "would you like to configure then build then install 
         <program/library name> with default options [yes/no]?" y

        <cabal configure output>

        "please check configuration defaults [ok, continue/no, change]" n

        "thank you - no files were built or installed. please run 'cabal --help' 
         and 'cabal configure --help' for details on how to change the
         configuration defaults"

    - cabal/darcs/haddock are no replacement for minimal help texts:
        cabal should require the existence of a README (darcs should
        complain if there is a *.cabal, but no README..). that might
        be too specific a request for darcs, but perhaps the useful, but
        increasingly lengthy resource

        might start with a motivational section 0 on "the intended user
        experience" ?-)

the database libraries:
    - the cabal/README points above seem to apply, according to the
        experience report below, so getting started is more difficult than
        it needs to be

    - comparative evaluation/individual feature sets appear to be difficult,
        according to earlier email

    - sample code for "trivial queries" (aka, I know about databases, but
        I need to see the way this particular library handles things, so that I
        can figure out whether it is the right one for me) is not obvious to find

    - distributions are bare-boned:
>       - following the HDBC link on the Haskell Wiki leads to a huge list of
>         tar.gz files, with no indication of which one I might want :-(
>         Option 2, Takusen, leads to a file listing, but no downloadable package.
>         Option 3, HSQL, leads to a page which doesn't mention Oracle support
>         (even though the Wiki page does) so I'm put off trying further...

    - installing database libraries is not the main activity, it just gets in the way
        of running SQL queries from Haskell, and may well be the first experience
        with getting/building/installing 3rd party libs for Haskell
    - other languages and their bindings are tempting if potential users get stuck

I hope this summary/rephrasing of Paul's report is helpful. what do users and
implementors think (cc-ed to libraries list)?

> OK, thanks for the gentle push. After a bit of digging, I decided that
> the takusen link looked like a darcs repository, and I downloaded
> darcs and got takusen. I installed GHC 6.6 in a spare VM (no PC round
> I can install stuff on just now, I'll do this properly later). On the
> assumption that the takusen.cabal file means I should look at Cabal, I
> had a dig and found the incantation "runhaskell setup.hs".
> I got the error:
> F:\takusen>runhaskell setup.hs
> setup.hs:11:7:
>    Could not find module `Distribution.Compat.FilePath':
>      it is hidden (in package Cabal-1.1.6)
> I assume this relates to the note in setup.hs "For ghc-6.6 you will
> need to first install Cabal-", but as I got GHC from a Windows
> binary install, I'm not sure where to go from here. I found the Cabal
> webpage and downloaded Trying to install it, I got the
> following:
> F:\cabal->runhaskell Setup.lhs install
> Setup.lhs: error reading ./.setup-config; run "setup configure" command?
> F:\cabal->runhaskell Setup.lhs configure
> Configuring Cabal-
> configure: Dependency base-any: using base-2.0
> configure: Using install prefix: C:\Program Files
> configure: Binaries installed in: C:\Program Files\Haskell\bin
> configure: Libraries installed in: C:\Program
> Files\Haskell\Cabal-\ghc-6.6
> configure: Private binaries installed in: C:\Program Files\Cabal-
> configure: Data files installed in: C:\Program Files\Common Files\Cabal-
> configure: Using compiler: c:\ghc\ghc-6.6\bin\ghc.exe
> configure: Compiler flavor: GHC
> configure: Compiler version: 6.6
> configure: Using package tool: c:\ghc\ghc-6.6\bin\ghc-pkg.exe
> configure: Using ar found on system at: c:\ghc\ghc-6.6\bin\ar.exe
> configure: No haddock found
> configure: No pfesetup found
> configure: No ranlib found
> configure: Using runghc found on system at: c:\ghc\ghc-6.6\bin\runghc.exe
> configure: No runhugs found
> configure: No happy found
> configure: No alex found
> configure: Using hsc2hs: c:\ghc\ghc-6.6\bin\hsc2hs.exe
> configure: No c2hs found
> configure: No cpphs found
> configure: No greencard found
> F:\cabal->runhaskell Setup.lhs install
> Installing: C:\Program Files\Haskell\Cabal-\ghc-6.6 &
> C:\Program Files\Haskell\bin Cabal-
> Setup.lhs: Error: Could not find module: Distribution.Compiler with any suffix:
> ["hi"]
> OK, that's as far as I can go. Remember, what I *want* to do is to run
> some SQL against my database to get some data into a Haskell program.
> I'm not up to debugging a Cabal install. (At this point, if I was
> doing this for "real work", I'd be off to the Python website like a
> shot...)
> Can anyone help? I promise, I will document what I end up with!
> Paul.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list