From c9b0d21826c1479ae3c977713b21ccd704b2b95a Mon Sep 17 00:00:00 2001 From: defanor Date: Sun, 3 Dec 2017 08:12:35 +0300 Subject: Omit constructor names, unless those are in sums --- Example.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Example.hs') 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 -- cgit v1.2.3