lambda-options: A modern command-line parser for Haskell.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

A modern command-line parser for Haskell.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.4.0.0, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.5.0.0, 0.5.1.0, 0.6.0.0, 0.7.0.0, 0.8.0.0, 0.9.0.0, 0.9.0.1, 0.9.1.0, 1.0.0.0, 1.0.1.0, 1.0.2.0, 1.1.0.0, 1.1.0.1
Change log None available
Dependencies base (>=4.7 && <4.8), containers (>=0.5 && <0.6), monad-loops (>=0.4 && <0.5), mtl (>=2.2 && <2.3) [details]
License LicenseRef-OtherLicense
Author Thomas Eding
Maintainer thomasedingcode@gmail.com
Category Text
Home page https://github.com/thomaseding/lambda-options
Uploaded by ThomasEding at 2015-05-16T20:09:16Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for lambda-options-0.4.0.0

[back to package description]

lambda-options-haskell

A modern command-line parser for Haskell.


Basic example:

import System.Environment
import Text.LambdaOptions

options :: Options IO ()
options = do
    addOption (kw "--help") $ do
        putStrLn "--user NAME [AGE]"
    addOption (kw "--user") $ \name -> do
        putStrLn $ "Name:" ++ name
    addOption (kw "--user") $ \name age -> do
        putStrLn $ "Name:" ++ name ++ " Age:" ++ show (age :: Int)

main :: IO ()
main = do
    args <- getArgs
    mError <- runOptions options args
    case mError of
        Just (ParseFailed msg _ _) -> putStrLn msg
        Nothing -> return ()