File: Alternatives.hs

package info (click to toggle)
haskell-optparse-applicative 0.18.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 400 kB
  • sloc: haskell: 3,369; makefile: 5
file content (18 lines) | stat: -rw-r--r-- 292 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Examples.Alternatives where

import Options.Applicative

data Value = A | B
  deriving (Eq, Show)

values :: Parser [Value]
values = many $ a <|> b

a :: Parser Value
a = flag' A (short 'a')

b :: Parser Value
b = flag' B (short 'b')

opts :: ParserInfo [Value]
opts = info values idm