koldfront

Parsing command line options in Haskell #haskell

๐Ÿ•‘๏ธŽ - 2012-07-15

What module does one use to parse standard GNU style command line options in Haskell?

In Perl I would use Getopt::Long.

The Haskell Wiki has a page called "High-level option handling with GetOpt"; looks promising.

Hm, tried mimicking the code on that page, but got lost at startOptions, where I thought I could put in my defaults, but that failed miserably.

Maybe I'll just look at the documentation of the System.Console.GetOpt module and do it the ugly, repetitious, error-prone way.

Ok, I can mimick the stuff in the documentation of System.Console.GetOpt, but I still don't get how I actually look at the values supplied (or defaults).

Maybe I should read this: Command line options in Haskell.

Using association lists, as shown on the Haskell wiki, is more in line with how I would do in Perl (and how I think of command line options), I think.

Add comment

To avoid spam many websites make you fill out a CAPTCHA, or log in via an account at a corporation such as Twitter, Facebook, Google or even Microsoft GitHub.

I have chosen to use a more old school method of spam prevention.

To post a comment here, you need to:

ยน Such as Thunderbird, Pan, slrn, tin or Gnus (part of Emacs).

Or, you can fill in this form:

+=