Skip to content

Commit 308d76d

Browse files
author
Serhii Khoma
authored
Merge pull request #22 from srghma/patch-1
Update README.md
2 parents 2c62289 + 8401e21 commit 308d76d

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

README.md

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,34 @@ data Sample = Sample
8181
, enthusiasm :: Int }
8282
8383
sample :: Parser Sample
84-
sample = Sample
85-
<$> strOption
86-
( long "hello"
87-
<> metavar "TARGET"
88-
<> help "Target for the greeting" )
89-
<*> switch
90-
( long "quiet"
91-
<> short 'q'
92-
<> help "Whether to be quiet" )
93-
<*> option int
94-
( long "enthusiasm"
95-
<> help "How enthusiastically to greet"
96-
<> showDefault
97-
<> value 1
98-
<> metavar "INT" )
84+
sample = ado
85+
hello <- strOption $ fold
86+
[ long "hello"
87+
, metavar "TARGET"
88+
, help "Target for the greeting"
89+
]
90+
91+
-- OR
92+
-- hello <- strOption
93+
-- ( long "hello"
94+
-- <> metavar "TARGET"
95+
-- <> help "Target for the greeting" )
96+
97+
quiet <- switch $ fold
98+
[ long "quiet"
99+
, short 'q'
100+
, help "Whether to be quiet"
101+
]
102+
103+
enthusiasm <- option int $ fold
104+
[ long "enthusiasm"
105+
, help "How enthusiastically to greet"
106+
, showDefault
107+
, value 1
108+
, metavar "INT"
109+
]
110+
111+
in Sample { hello, quiet, enthusiasm }
99112
```
100113

101114
The parser is built using an applicative style starting from a

0 commit comments

Comments
 (0)