Skip to content

Instantly share code, notes, and snippets.

@tnull
Created August 14, 2019 12:06
Show Gist options
  • Save tnull/7b5bb77594d5d363e3f559fd14302f8b to your computer and use it in GitHub Desktop.
Save tnull/7b5bb77594d5d363e3f559fd14302f8b to your computer and use it in GitHub Desktop.
Optparse
import qualified Options.Applicative as OA
data AppArgs =
AppArgs
{ inFilePath :: !String
, outFilePath :: !String
, sampleFilter :: !Int
}
deriving (Show)
main :: IO ()
main = OA.execParser opts >>= runWithOptions
where
parser =
AppArgs <$> OA.argument OA.str (OA.metavar "inCSV") <*>
OA.argument OA.str (OA.metavar "outCSV") <*>
OA.option OA.auto (OA.metavar "sample_filter" <> OA.value 0)
opts = OA.info parser mempty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment