patch applied (packages/base): System.Console.GetOpt mistakenly rejects options as ambiguous.

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Mar 12 07:15:39 EDT 2008


Wed Mar 12 04:10:47 PDT 2008  Malcolm.Wallace at cs.york.ac.uk
  * System.Console.GetOpt mistakenly rejects options as ambiguous.
  From "Eelis van der Weegen" <haskell-libs at contacts.eelis.net>.
  Testcase:
  
  > import System.Console.GetOpt
  >
  > type Color = String
  >
  > optsDesc :: [OptDescr Color]
  > optsDesc = [Option "" ["color", "colour"]
  >                    (ReqArg id "color") "Foreground color"]
  >
  > main = do
  >   let args = ["--col=blue"]
  >   case getOpt RequireOrder optsDesc args of
  >     (_, _, err:_) -> putStrLn err
  >     _ -> return ()
  
  Output:
    option `--col' is ambiguous; could be one of:
        --color=color, --colour=color  Foreground color
        --color=color, --colour=color  Foreground color
  
  This error is silly, because the two alternatives listed are the same
  option.  The problem is caused by incorrect use of a generator in a list
  comprehension.

    M ./System/Console/GetOpt.hs -2 +3


More information about the Cvs-libraries mailing list