System.Console.GetOpt mistakenly rejects options as ambiguous.
authorMalcolm.Wallace@cs.york.ac.uk <unknown>
Wed, 12 Mar 2008 11:10:47 +0000 (11:10 +0000)
committerMalcolm.Wallace@cs.york.ac.uk <unknown>
Wed, 12 Mar 2008 11:10:47 +0000 (11:10 +0000)
commitcfd67a2645854a4e717c4001daeabe140237744c
treeb0525784430f54575a69ea2fc6882c4c84ae8225
parentb4e1c2c5b2c00dd415b19ddbfb2bf950e6c4e61c
System.Console.GetOpt mistakenly rejects options as ambiguous.
From "Eelis van der Weegen" <haskell-libs@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.
System/Console/GetOpt.hs