我有
type Month = Int
parseMonths :: OP.Parser (Month, Month)
parseMonths =
liftA2 (,)
(OP.option
(OP.eitherReader $
parseNumber "month" (\n -> 1<=n && n<=12) "month")
(OP.metavar "MONTH" <>
OP.long "from-month" <>
OP.value 1))
(OP.option
(OP.eitherReader $
parseNumber "month" (\n -> 1<=n && n<=12) "month")
(OP.metavar "MONTH" <>
OP.long "to-month" <>
OP.value 12))
我想添加一张支票,第一个月不在第二个月之后。显然我不能在OP.ReadM
. 我可以办理登机手续OP.Parser
吗?或者我是否必须在解析后执行检查parserFailure
:
Optparse-applicative: Continuous parsing (ReadM)
?