summaryrefslogtreecommitdiff
path: root/Example.hs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-03 08:12:35 +0300
committerdefanor <defanor@uberspace.net>2017-12-03 08:12:35 +0300
commitc9b0d21826c1479ae3c977713b21ccd704b2b95a (patch)
treed57924c62675d313ad20c8286fda382051df79d7 /Example.hs
parentecc1d48c01ef5633d6229dc9009a899141b2eec7 (diff)
Omit constructor names, unless those are in sums
Diffstat (limited to 'Example.hs')
-rw-r--r--Example.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/Example.hs b/Example.hs
index a9f50aa..0319bcd 100644
--- a/Example.hs
+++ b/Example.hs
@@ -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