optparse-applicative Backtracking

ⅰ亾dé卋堺 提交于 2019-12-01 20:26:44

Please note: this answer was written by the optparse-applicative author, Paolo Capriotti.

You can't do this with optparse-applicative directly. The main feature of optparse-applicative is that options can be parsed in any order. If you want to work mainly with arguments (which are positional), you are better off having two levels of parsers: use many argument in optparse-applicative, then pass the resulting array to a normal parser (say using Parsec). If you only have positional arguments, then optparse-applicative won't buy you very much, and you could just parse the arguments manually with Parsec.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!