ghc command line arguments parsing

Harendra Kumar harendra.kumar at gmail.com
Wed Aug 17 14:37:35 UTC 2016


Hi,

ghc accepts a flag and its argument as a single quoted or escaped argument
as well. For example all of the following are equivalent:

ghc -package foo
ghc "-package foo"
ghc -package\ foo

Is this by design or accidental?

This has a nice side effect to make passing ghc arguments via rughc simple.
For example runghc "-package foo" or runghc -package\ foo will pass
"-package foo" to ghc. The alternative and documented way to achieve the
same effect is runghc -package --ghc-arg=foo which is not that convenient.

My question is - can we rely on this way of parsing? If it is not by
design, does it make sense to legalize and therefore document this?

-harendra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160817/27c51994/attachment.html>


More information about the ghc-devs mailing list