
On Wed, Aug 03, 2011 at 11:44:10AM +0100, Simon Marlow wrote:
On 03/08/2011 11:09, Victor Nazarov wrote:
On Wed, Aug 3, 2011 at 11:30 AM, Simon Peyton-Jones
wrote: So perhaps that's the problem. parseDynamicFlags could perfectly well simply return any un-recognised flags. Indeed, I thought it did just that -- it certainly returns a list of un-consumed arguments. If it doesn't perhaps that's a bug.
parseDynamicFlags returns un-consumed arguments if they are something like filenames, but it throws error if un-consumed argument starts with dash.
So then parseDynamicFlags should be split into two layers, the lower layer returning unused flags, and the upper layer generating errors.
It's not that simple. In ghcjs -O -someflag something -Wall is "something" an argument to someflag, or a file to be compiled? I think the best approach is to make a variant parseDynamicFlagsAnd which takes an extra argument of type [Flag (CmdLineP DynFlags)] which it prepends to dynamic_flags. Otherwise there's Edward's suggestion, but it would be a bit depressing to have to use -- even for the simplest invocations, e.g. ghcjs -- -O foo.hs although I guess you could mirror the most common GHC flags as ghcjs flags. Thanks Ian