File tree Expand file tree Collapse file tree 1 file changed +28
-15
lines changed
Expand file tree Collapse file tree 1 file changed +28
-15
lines changed Original file line number Diff line number Diff line change @@ -81,21 +81,34 @@ data Sample = Sample
8181 , enthusiasm :: Int }
8282
8383sample :: 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
101114The parser is built using an applicative style starting from a
You can’t perform that action at this time.
0 commit comments