One minor annoyance when using Cabal to install stuff is that not every project agrees on whether the Setup script should be an .hs or an .lhs file. The consequence is that when doing a bunch of installations, I'll hit the up arrow to re-run, say,
runhaskell Setup.lhs configure and it will complain that the file is not found, because this project uses .hs and the project just before uses .lhs.
What I'm wondering, though is if it would be a good idea for projects to distribute
both files? We could even use something like this to have the same file regardless of extension:
#!/usr/bin/env runhaskell
{-
> import Distribution.Simple
> main = defaultMain
-}
import Distribution.Simple
main = defaultMain
I guess that once cabal-install comes out, none of this would really matter since all that building-of-dependencies stuff would be taken care of automatically.
One minor annoyance when using Cabal to install stuff is that not every project agrees on whether the Setup script should be an .hs or an .lhs file. The consequence is that when doing a bunch of installations, I'll hit the up arrow to re-run, say,
runhaskell Setup.lhs configure and it will complain that the file is not found, because this project uses .hs and the project just before uses .lhs.
What I'm wondering, though is if it would be a good idea for projects to distribute
both files? We could even use something like this to have the same file regardless of extension:
#!/usr/bin/env runhaskell
{-
> import Distribution.Simple
> main = defaultMain
-}
import Distribution.Simple
main = defaultMain
I guess that once cabal-install comes out, none of this would really matter since all that building-of-dependencies stuff would be taken care of automatically.
Setup.(l)hs
4 comments:
Two points:
1) Hopefully we'll slowly be moving to less Setup files, so people can use the default Cabal install tool. This is a while off, but is the right long term answer.
2) In the short term, just type Setup, not Setup.[l]hs. runhaskell will pick the right one. I realise you give up tab completion, but you've already typed a 10 character program before it, so your fingers are already warmed up.
The True Solution is to write a script. Here's my ~/bin/cabal-build:
#! /bin/sh
#set -e
F="runhaskell `([ -e Setup.lhs ] && echo Setup.lhs) || echo Setup.hs`"
$F clean && $F configure --prefix=/home/stefan --user "$@" && $F build && $F install
We already have such a program. It's currently called cabal-setup:
http://darcs.haskell.org/cabal-setup/
We're currently merging this wrapper with cabal-install so that the one tool will be able to do all the stuff that Setup.[l]hs does and the extra things that cabal-install does. But in the mean time cabal-setup is very useful. I use it all the time.
Doh! I hadn't thought of just leaving the extension out. I don't mind hitting backspace a few times after tab-completion. I probably type it out anyway without thinking about it. Thanks, all (and for pointing out my ()/[] confusion)
Can't wait till this setup/dependency management stuff becomes standard Cabal. Makes a great first impression when installing libraries (etc) becomes easy-breezy.
Post a Comment