I'm doing a lot of switching between
ghc 6.6 and ghc 6.7 on the same computer. I install modules using
$ runghc Setup.hs configure
etc.
I would like to specify which version
of ghc should be getting the package installed via the f flag to runghc
$ :~/personal/PersonalRepos/pharchive/learning/haskell/UnixTools/arghandling>runghc
runghc: syntax: runghc [-f GHCPATH]
[GHC-ARGS] FILE ARG...
but this appears to be broken.
$ :~/personal/PersonalRepos/pharchive/learning/haskell/UnixTools/arghandling>runghc
arghandling-nice.hs
arghandling-nice.hs: args length
does not equal 3. args: : []
usage example: $ runghc arghandling-nice.hs
firstarg secondarg thirdarg
without the flag works but
$ :~/personal/PersonalRepos/pharchive/learning/haskell/UnixTools/arghandling>runghc
-f /usr/local/bin/ghc-6.6.1 arghandling-nice.hs
does nothing.
$ :~/personal/PersonalRepos/pharchive/learning/haskell/UnixTools/arghandling>ls
-l /usr/local/bin/ghc-6.6.1
-rwxr-xr-x 1 root root 151 2007-06-16
20:22 /usr/local/bin/ghc-6.6.1
In general I don't like using runghc
because it doesn't appear to be documented anywhere except that (incorrect?)
usage message. Is there a way to do a package install just using ghc -e?
(Sure I could compile, but it helps me sometimes if I can not, a la runghc.)
At any rate I couldn't figure out how to pass arguments to main via ghc
-e.
$ :~/personal/PersonalRepos/pharchive/learning/haskell/UnixTools/arghandling>cat
arghandling-nice.hs
import System
main = do args <- getArgs
let
usagemsg = "usage example: $ runghc arghandling-nice.hs firstarg secondarg
thirdarg"
case
args of
[first,second,third] -> process first second third
_ ->
error $ "args length does not equal 3. args: : " ++ ( show args
) ++ "\n" ++ usagemsg
process a b c = print $ unwords
[a,b,c]
Thanks for anybody who can help me out
with this.
Thomas.
---
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.