Code Monkey home page Code Monkey logo

parseargs's Introduction

parseargs: Command-line argument parsing for Haskell programs

Copyright (c) 2007 Bart Massey

This library provides System.Console.Parseargs, a module to assist in argument parsing for Haskell stand-alone command line programs.

The package provides a Haskell command-line argument "parser". You supply a specification of the arguments to your command-line program; parseargs reads the arguments and checks that they meet your spec. It then fills in a data structure that captures the relevant data, from which parsed arguments can be extracted as needed. See the Haddock documentation for the gory details.

I have used this code with ghc 6 and later on Linux. It is a fairly standard Hackage-ready package, to the extent I know how to construct such.

This library is not what I set out to build. It definitely could also use some work. However, I use it all the time for writing little programs. I thought others might find it useful, and I also have released other code that depends on it, so I put it out there.

Have fun with it, and let me know if there are problems.

Release History

  • The 0.1.2 release includes a typeclass for argument types for easier use.

  • The 0.1.3 release includes more uniform and usable error handling.

  • The various 0.1.3.x point releases include bug fixes and various extra-minor enhancements. See the Git log.

  • The 0.1.4 release includes the ability to mix optional and required positional arguments.

  • The 0.1.5 release includes the "soft dash" option, giving the ability to allow positional arguments to begin with a dash if possible.

  • The 0.1.5.1 release fixes some warnings and stuff.

  • The 0.1.5.2 release fixes some missing documentation.

  • The 0.2 release cleans up some namespace pollution by removing ArgRecord and the args accessor from the public namespace. This allows the use of the name args by the user to describe program arguments.

  • The 0.2.0.1 release cleans up a bunch of documentation nits and cleans up copyright notices and license information.

  • The 0.2.0.2 release fixes the botched release of 0.2.0.1. Sigh.

  • The 0.2.0.3 release fixes the missing Args constructor documentation of 0.2.0.2.

  • The 0.2.0.4 release suppresses a GHC 7.10 warning for Control.Monad.Safe.

  • Subsequent releases are maintenance for new GHC, Cabal and Stackage stuff.

License

This program is licensed under the "3-clause ('new') BSD License". Please see the file COPYING in this distribution for license terms.

parseargs's People

Contributors

bartmassey avatar qrilka avatar

Stargazers

Ilmari Vacklin avatar Josh Miller avatar Shinichi Kogai avatar GAURAV avatar  avatar Daniel Kahlenberg avatar Po-Ying Chen avatar Masashi Fujita avatar Vivek Rai avatar josejuan avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

qrilka

parseargs's Issues

Safe issues with GHC7.0 and 7.2

GHC7.0 doesn't know about Safe
SafeHaskell is broken GHC7.2

[1 of 2] Compiling System.Console.ParseArgs ( System/Console/ParseArgs.hs, dist/dist-sandbox-689addbb/build/parseargs-example/parseargs-example-tmp/System/Console/ParseArgs.o )

System/Console/ParseArgs.hs:68:1:
    containers-0.4.1.0:Data.Map can't be safely imported! The module itself isn't safe.

I made revisions for two latest releases on hackage, bumping base lower bound to restrict GHC versions

http://matrix.hackage.haskell.org/package/parseargs https://hackage.haskell.org/package/parseargs-0.2.0.4/revisions/

APCData method should not be exported

It would be nice not to export the APCData method getAPCdata. This is all a bletcherous backward-compatibility hack anyhow, so why expose more than necessary?

Will fix next time the API has to change anyhow.

Remove trailing whitespace in source code

There's a bunch of trailing whitespace in the parseargs source. I suppose a proper fix involves filtering the tree to pretend it was never introduced. Extra-low priority.

parseArgsIO is lazy

Even though it is in the IO monad, parseArgsIO does not finish until its result is needed. Unfortunately, this means that argument parsing errors may not happen in time. An obvious workaround is to evaluate some argument test early. Perhaps bang patterns should be added to parseargs for this: it is not clear. More consideration is needed.

Get rid of __args

The Args constructor __args should not be exposed, but has to be because of a Haddock bug (haskell/haddock#456). Once this bug is fixed, we can rename __args to args and hide it from the API.

Example

Could an example be added either to README or the repo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.