
#12517: Simplify runghc command line options -------------------------------------+------------------------------------- Reporter: harendra | Owner: harendra Type: bug | Status: new Priority: normal | Milestone: Component: None | Version: 8.0.1 Resolution: | Keywords: runghc Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by thomie): How about this: {{{ runghc [runghc flags] module|filename [GHC flags] [-- [program args]] }}} Clarification: * `runghc -package ..` would be an error, because `-package` is not a runghc flag, nor is it a valid module or filename. Note that GHC doesn't even support filenames starting with a dash (try `ghc -hello.hs`), so I don't understand why the following hack even exists: {{{ pastArgs :: String -> Bool -- You can use -- to mark the end of the flags, in case you need to use -- a file called -foo.hs for some reason. You almost certainly shouldn't, -- though. pastArgs "--" = True pastArgs ('-':_) = False pastArgs _ = True }}} * `"--"` is no longer overloaded. It just separates the GHC flags from the program arguments, and to pass program arguments you //have to// use `"--"`. This is an improvement, because currently you might think that `-v` in `runghc hello.hs -v` is a GHC flag, while it is actually a program arguments (and might silently get ignored). * `--ghc-arg` can be deprecated * Your example would become: `runghc hello.hs -package text-1.2.2.1` Are there any drawbacks to this approach (other than also breaking backward compatibility)? Fwiw: currenly, your example can also be solved without `--ghc-arg` using: `runghc -package=text-1.2.2.1 hello.hs`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12517#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler