Command line option parsers: Difference between revisions
AriePeterson (talk | contribs) m (Update properties of package console-program) |
(move argparser to front for lexicographic ordering) |
||
Line 4: | Line 4: | ||
|- | |- | ||
! Package !! Multi-mode !! Extensions !! Remark | ! Package !! Multi-mode !! Extensions !! Remark | ||
|- | |||
| {{HackagePackage|id=argparser}} || - || None (though it depends on package containers, which uses extensions) || | |||
|- | |- | ||
| {{HackagePackage|id=cmdargs}} || X || TemplateHaskell, SYB generics, ViewPatterns, ... || <hask>unsafePerformIO</hask> | | {{HackagePackage|id=cmdargs}} || X || TemplateHaskell, SYB generics, ViewPatterns, ... || <hask>unsafePerformIO</hask> | ||
Line 30: | Line 32: | ||
|- | |- | ||
| {{HackagePackage|id=yaop}} || - || TemplateHaskell, GeneralizedNewtypeDeriving || wrapper around GetOpt | | {{HackagePackage|id=yaop}} || - || TemplateHaskell, GeneralizedNewtypeDeriving || wrapper around GetOpt | ||
|} | |} | ||
Revision as of 08:16, 26 October 2013
There are several packages that want to simplify the task of writing command line parsers. Unfortunately, they are distributed across several Hackage categories. Here is an attempt to list them:
Package | Multi-mode | Extensions | Remark |
---|---|---|---|
argparser | - | None (though it depends on package containers, which uses extensions) | |
cmdargs | X | TemplateHaskell, SYB generics, ViewPatterns, ... | unsafePerformIO
|
cmdlib | X | SYB generics | based on GetOpt |
cmdtheline | X | FlexibleInstances (although unnecessary) | shows help as man-page |
console-program | X | (none) | configure options via files |
getflag | - | Haskell98 | like GetOpt but with Unix/Plan 9 option syntax |
hflags | - | TemplateHaskell | inspired by Google's gflags, provides parsed options in top-level variables, allow to set options via environment variables |
multiarg | - | CPP | long options with multiple arguments |
options | X | TemplateHaskell | |
optparse-applicative | X | GADT | Applicative Functor |
parseargs | - | FlexibleInstances (although unnecessary) | supports a fixed set of argument types: Int, Integer, Float, Double, String, FileOpener
|
ReadArgs | - | OverlappingInstances, TypeOperators | No options, only arguments. The argument template is derived from the requested argument tuple. |
simpleargs | - | OverlappingInstances (although unnecessary) | the same as ReadArgs |
yaop | - | TemplateHaskell, GeneralizedNewtypeDeriving | wrapper around GetOpt |
The column for required Haskell extensions gives an idea of how easy it is to port the package to compilers other than GHC.