diff options
author | defanor <defanor@uberspace.net> | 2017-12-03 08:12:35 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-12-03 08:12:35 +0300 |
commit | c9b0d21826c1479ae3c977713b21ccd704b2b95a (patch) | |
tree | d57924c62675d313ad20c8286fda382051df79d7 /Example.hs | |
parent | ecc1d48c01ef5633d6229dc9009a899141b2eec7 (diff) |
Omit constructor names, unless those are in sums
Diffstat (limited to 'Example.hs')
-rw-r--r-- | Example.hs | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -17,13 +17,19 @@ data Foo = Bar Int | Qux (Maybe Int) (Maybe Int) RecTest (Maybe Double) deriving (Generic, Show) -instance ToArgs Foo instance ArgParser Foo +instance ToArgs Foo + +data Wrap = Wrap { foo :: Maybe Foo, num :: Maybe Int } + deriving (Generic, Show) + +instance ArgParser Wrap +instance ToArgs Wrap main :: IO () main = do - let val = Qux Nothing (Just 1) (RecTest Nothing (Just 2.3) Nothing) Nothing + let val = Wrap (Just $ Qux Nothing (Just 1) (RecTest Nothing (Just 2.3) Nothing) Nothing) (Just 1) a = args val print val putStrLn a - print $ parse (argParser :: Parser Foo) "test" a + print $ parse (argParser :: Parser Wrap) "test" a |