Last active
March 1, 2016 01:56
-
-
Save sordina/be820a530eb225a05797 to your computer and use it in GitHub Desktop.
options.generic pure example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
module Main where | |
import Options.Generic | |
import Options.Applicative | |
data Bla = X | Y String | |
deriving (Eq, Ord, Read, Show, Generic, ParseRecord, ParseField, ParseFields) | |
x :: Parser Bla | |
x = parseFields Nothing | |
y :: ParserInfo Bla | |
y = info x mempty | |
z :: ParserResult Bla | |
z = execParserPure defaultPrefs y [] | |
main :: IO () | |
main = print z |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment