https://wiki.haskell.org/api.php?action=feedcontributions&user=AriePeterson&feedformat=atomHaskellWiki - User contributions [en]2024-03-29T13:00:12ZUser contributionsMediaWiki 1.35.5https://wiki.haskell.org/index.php?title=Command_line_option_parsers&diff=56959Command line option parsers2013-10-06T18:33:48Z<p>AriePeterson: Update properties of package console-program</p>
<hr />
<div>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:<br />
<br />
{| class="wikitable"<br />
|-<br />
! Package !! Multi-mode !! Extensions !! Remark<br />
|-<br />
| {{HackagePackage|id=cmdargs}} || X || TemplateHaskell, SYB generics, ViewPatterns, ... || <hask>unsafePerformIO</hask><br />
|-<br />
| {{HackagePackage|id=cmdlib}} || X || SYB generics || based on [[GetOpt]]<br />
|-<br />
| {{HackagePackage|id=cmdtheline}} || X || FlexibleInstances (although unnecessary) || shows help as man-page<br />
|-<br />
| {{HackagePackage|id=console-program}} || X || (none) || configure options via files<br />
|-<br />
| {{HackagePackage|id=getflag}} || - || Haskell98 || like [[GetOpt]] but with Unix/Plan 9 option syntax<br />
|-<br />
| {{HackagePackage|id=hflags}} || - || TemplateHaskell || inspired by Google's gflags, provides parsed options in top-level variables, allow to set options via environment variables<br />
|-<br />
| {{HackagePackage|id=multiarg}} || - || CPP || long options with multiple arguments<br />
|-<br />
| {{HackagePackage|id=options}} || X || TemplateHaskell ||<br />
|-<br />
| {{HackagePackage|id=optparse-applicative}} || X || GADT || Applicative Functor<br />
|-<br />
| {{HackagePackage|id=parseargs}} || - || FlexibleInstances (although unnecessary) || supports a fixed set of argument types: <hask>Int, Integer, Float, Double, String, FileOpener</hask><br />
|-<br />
| {{HackagePackage|id=ReadArgs}} || - || OverlappingInstances, TypeOperators || No options, only arguments. The argument template is derived from the requested argument tuple.<br />
|-<br />
| {{HackagePackage|id=simpleargs}} || - || OverlappingInstances (although unnecessary) || the same as ReadArgs<br />
|-<br />
| {{HackagePackage|id=yaop}} || - || TemplateHaskell, GeneralizedNewtypeDeriving || wrapper around GetOpt<br />
|-<br />
| {{HackagePackage|id=argparser}} || - || None (though it depends on package containers, which uses extensions) || <br />
|}<br />
<br />
The column for required Haskell extensions gives an idea of how easy it is to port the package to compilers other than [[GHC]].<br />
<br />
<br />
[[Category:Packages]]</div>AriePeterson