diff options
author | defanor <defanor@uberspace.net> | 2017-12-03 10:00:27 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-12-03 10:00:27 +0300 |
commit | 9fd02f49809bfdfef205fae5885636eef0a69b21 (patch) | |
tree | 3e967a4956177f916f8c89a08f867b40bb5a7f2f /Example.hs | |
parent | d7239b31954abe0ea67358fe4932f4db8bde5153 (diff) |
Parse lists of strings, not just strings
Because arguments are lists of strings.
Diffstat (limited to 'Example.hs')
-rw-r--r-- | Example.hs | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -16,7 +16,7 @@ instance ToArgs RecTest data Foo = Bar Int | Baz Int - | Qux (Maybe Int) (Maybe Int) RecTest (Maybe Double) + | Qux (Maybe Int) (Maybe String) RecTest (Maybe Double) deriving (Generic, Show) instance ArgParser Foo @@ -30,8 +30,9 @@ instance ToArgs Wrap main :: IO () main = do - let val = Wrap (Just $ Qux Nothing (Just 1) (RecTest Nothing (Just 2.3) Nothing) Nothing) (Just 1) - a = args defMod val + let val = Wrap (Just $ Qux Nothing (Just "foo bar") + (RecTest Nothing (Just 2.3) Nothing) Nothing) (Just 1) + a = toArgs defMod val print val - putStrLn a + print a print $ parse (argParser defMod :: Parser Wrap) "test" a |