Skip to content

Instantly share code, notes, and snippets.

@sordina
Last active March 1, 2016 01:56
Show Gist options
  • Save sordina/be820a530eb225a05797 to your computer and use it in GitHub Desktop.
Save sordina/be820a530eb225a05797 to your computer and use it in GitHub Desktop.
options.generic pure example
{-# 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