I have the following Haskell code using optparse-applicative which hangs at runtime.
main :: IO ()
main = do
printf "Start...\n"
args <- execParser $ info args fullDesc
printf "Cmdline args: %s\n" (show args)
args :: Parser [Integer]
args = many (option auto
(short 'x'
<> value 1))
The problem is related to the use of many combinator because once I remove it the code runs fine.
Is this a bug or am I doing something wrong?
Thanks!
I think, the problem here is with the default value. Just remove value 1
from parser modifiers.
From docs on value
:
Note: Because this modifier means the parser will never fail, do not use it with combinators such as some or many, as these combinators continue until a failure occurs. Careless use will thus result in a hang.