(typed) list of argument from a program using optparse-appplicative
问题 Is there a way to extract a list of names and types from a command line program, made using optparse-applicative ? I am +/- looking for some function of type ParserInfo a -> [(String,TypeRep)] 回答1: No, there is no way. The relevant bits are: data ParserInfo a = ParserInfo { infoParser :: Parser a , -- ... } data Parser a = forall x . MultP (Parser (x -> a)) (Parser x) | forall x . BindP (Parser x) (x -> Parser a) | -- ... Since the x s of MultP and BindP are existentially quantified and do