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

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?):
cabal:
- 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
- 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)? Claus
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-1.1.6.1", 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 1.1.6.1. Trying to install it, I got the following:
F:\cabal-1.1.6.1>runhaskell Setup.lhs install Setup.lhs: error reading ./.setup-config; run "setup configure" command?
F:\cabal-1.1.6.1>runhaskell Setup.lhs configure Configuring Cabal-1.1.6.1... 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-1.1.6.1\ghc-6.6 configure: Private binaries installed in: C:\Program Files\Cabal-1.1.6.1 configure: Data files installed in: C:\Program Files\Common Files\Cabal-1.1.6.1 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-1.1.6.1>runhaskell Setup.lhs install Installing: C:\Program Files\Haskell\Cabal-1.1.6.1\ghc-6.6 & C:\Program Files\Haskell\bin Cabal-1.1.6.1... 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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

From: libraries-bounces@haskell.org [mailto:libraries-bounces@haskell.org] On Behalf Of Claus Reinke
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?-)
I guess I should comment, as one of the Takusen authors. Yes, this is embarrasing. We have made a number of assumptions which Paul exposed: - users should know to do darcs get, then runhaskell Setup.hs configure/build/install - users should know to look for Haddock docs - users should know how to look for and install dependent libraries (Cabal-1.1.6.1, in this case) If you're an experienced Haskell programmer then these assumptions are valid, so yes, we do need to do more for the novice. It is nice to actually get some kind of feedback, even if negative. It means we can make our library nicer to install and use, which hopefully will encourage more users to install and use it...
+ add a dedicated command "cabal", which does nothing more than "runhaskell Setup", but is more memorable and suggestive
Did you mean an executable that comes with cabal or the compiler (i.e. in ghc's bin), or something provided by the library author? From my POV (as a library author) I could provide a cabal.bat (for Windows users) and a cabal.sh (for everyone else), but that seems a bit messy.
- 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..).
Yes. I will create one of these.
- 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
We have made a reasonable effort in Takusen to document the API extensively, and give example code. The problem seems to be that the documentation is too well hidden: http://darcs.haskell.org/takusen/doc/html/Database-Enumerator.html The best thing I can think of now is to put a reference to this in the README file. Any other ideas? I wanted to keep the documentation in Haddock (so that it stays close to, and hopefully consistent with, the source) but maybe that's not the best idea for this kind of documentation, which is really a HOW-TO manual.
- distributions are bare-boned:
Option 2, Takusen, leads to a file listing, but no
downloadable package.
My fault for not providing a proper release. I'm still learning about darcs, so the instructions in http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program#Releas es are quite valuable. If you have any further Takusen-specific questions, don't hesitate to contact me. Also, if you're having trouble installing or chasing down dependent libraries then I should be able to help. Alistair ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. *****************************************************************

We have made a number of assumptions which Paul exposed: - users should know to do darcs get, then runhaskell Setup.hs configure/build/install - users should know to look for Haddock docs - users should know how to look for and install dependent libraries (Cabal-1.1.6.1, in this case)
and there you have the beginnings of your README file!-)
If you're an experienced Haskell programmer then these assumptions are valid, so yes, we do need to do more for the novice.
the difference, as far as it is relevant for getting going, is often just context, which can be rectified by surprisingly small steps, such as collecting the assumptions in one obvious-to-find file.
+ add a dedicated command "cabal", which does nothing more than "runhaskell Setup", but is more memorable and suggestive
Did you mean an executable that comes with cabal or the compiler
yes, part of the cabal infrastructure, not something from the library author. as Simon has pointed out, "cabal-setup" is going to do the job, and with a more descriptive name. thanks, claus

Claus Reinke wrote:
cabal: - 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
cabal-setup does this, but wasn't included with the latest release of Cabal. It should be in the next one, I hope. The plan is to deprecate 'runhaskell Setup.lhs' in favour of 'cabal-setup'. Feel free to suggest changing the name to 'cabal', although some might argue that 'cabal-get' is the high-level tool and should therefore get the name 'cabal' instead.
- cabal/darcs/haddock are no replacement for minimal help texts: cabal should require the existence of a README
absolutely, this has occurred to me too. There should be a stanard Cabal README file, and Don's mkcabal tool could drop it in the tree. Cheers, Simon

simonmarhaskell:
Claus Reinke wrote:
cabal: - 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
cabal-setup does this, but wasn't included with the latest release of Cabal. It should be in the next one, I hope. The plan is to deprecate 'runhaskell Setup.lhs' in favour of 'cabal-setup'. Feel free to suggest changing the name to 'cabal', although some might argue that 'cabal-get' is the high-level tool and should therefore get the name 'cabal' instead.
- cabal/darcs/haddock are no replacement for minimal help texts: cabal should require the existence of a README
absolutely, this has occurred to me too. There should be a stanard Cabal README file, and Don's mkcabal tool could drop it in the tree.
This occurred to me too. My current plan for mkcabal is that it creates: foo.cabal Setup.lhs README LICENSE based on a series of interactive questions, or command line args. -- Don

absolutely, this has occurred to me too. There should be a stanard Cabal README file, and Don's mkcabal tool could drop it in the tree.
This occurred to me too. My current plan for mkcabal is that it creates:
foo.cabal Setup.lhs README LICENSE
based on a series of interactive questions, or command line args.
is mkcabal going to be a standard part of cabal installations? btw, here is some suggested text for the useful "how to write.." page you started (I know it is a wiki, but I don't want to mess up the page at this point;-). thanks, claus -------------------------------------------- 0. The intended user experience When Haskell programmers go out in search of existing functionality, be it a library, a tool, or an application, the intended approach is roughly this: 1 visit haskell.org, 2 find the library/program they are looking for (if not found, try mailing list; if it is hidden, try improving haskell.org; if it does not exist, try contributing code/documentation/requirements/..) 3 download 4 install 5 enjoy but each of these steps is endangered by several potential road blocks, and code authors can do a lot to help code users avoid such blocks. Even if steps 1/2 are successful, and ensuring step 5 is the main concern of code authors and users, it is often steps 3/4 that get in the way: - which is the latest version? what state is it in? is it still maintained/in use? - what are its aims? where is the documentation? - which is the right version for given OS and Haskell implementation? - how is it packaged, and what tools are needed to get and unpack it? - how is it installed, and what tools are needed to install it? - how do we avoid IDR (infinite dependency recursion)? - how do we provide/acquire the knowledge and tool-chains needed? There is a well-established tradition for communicating the answers to these questions: the README text file, placed in a prominent position at the code's location (these days often accompanied, but not replaced, by a more extensive web page). But as other communities, the Haskell community has Haskell-specific answers to many of these questions, independent of the particular Haskell code to publish. This document is all about how to publish your Haskell code in such a way as to make the Haskell code users' experience as smooth as possible. Until there is a version of this text targetted more specifically at code users, they might find it helpful to browse this page for insights into the Haskell code authors' mind- and tool-set.

claus.reinke:
absolutely, this has occurred to me too. There should be a stanard Cabal README file, and Don's mkcabal tool could drop it in the tree.
This occurred to me too. My current plan for mkcabal is that it creates:
foo.cabal Setup.lhs README LICENSE
based on a series of interactive questions, or command line args.
is mkcabal going to be a standard part of cabal installations?
btw, here is some suggested text for the useful "how to write.." page you started (I know it is a wiki, but I don't want to mess up the page at this point;-).
Thanks Claus. I've added this text to the page: http://haskell.org/haskellwiki/How_to_write_a_Haskell_program#Guidelines_for... -- Don

On Tue, Dec 12, 2006 at 11:33:21PM +1100, Donald Bruce Stewart wrote:
simonmarhaskell:
- cabal/darcs/haddock are no replacement for minimal help texts: cabal should require the existence of a README
absolutely, this has occurred to me too. There should be a stanard Cabal README file, and Don's mkcabal tool could drop it in the tree.
This occurred to me too. My current plan for mkcabal is that it creates:
foo.cabal Setup.lhs README
Just a small point, but I'd expect README to be very specific to each project, whereas I'd expect to find the three "runhaskell Setup.hs" commands in INSTALL (similar to the generic ./configure;make;make install file you find with C programs.
LICENSE
Thanks Ian

Simon Marlow wrote:
+ add a dedicated command "cabal", which does nothing more than "runhaskell Setup", but is more memorable and suggestive
cabal-setup does this, but wasn't included with the latest release of Cabal. It should be in the next one, I hope. The plan is to deprecate 'runhaskell Setup.lhs' in favour of 'cabal-setup'. I'm possibly using cabal in a simplistic way, but I generally do either
./Setup.lhs configure -p ./Setup.lhs build ./Setup.lhs install or ./Setup.lhs configure -p --prefix=$HOME --user ./Setup.lhs build ./Setup.lhs install --user #perhaps not needed anymore? This is a lot of typing, and at least once I wrote a Makefile to automate it (oh, the irony of it!) Anyway, it would be nice if a 'cabal' command automated the whole sequence in one go, at least as an option. -k
participants (6)
-
Bayley, Alistair
-
Claus Reinke
-
dons@cse.unsw.edu.au
-
Ian Lynagh
-
Ketil Malde
-
Simon Marlow