The lambda-options package

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]

A modern command-line parser for Haskell.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0, 0.2.0.0, 0.3.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
Change logNone available
Dependenciesbase (==4.7.*), containers (==0.5.*), monad-loops (==0.4.*), mtl (==2.2.*) [details]
LicenseOtherLicense
AuthorThomas Eding
Maintainerthomasedingcode@gmail.com
CategoryText
Home pagehttps://github.com/thomaseding/lambda-options
UploadedThu May 14 05:40:45 UTC 2015 by ThomasEding

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for lambda-options-0.1.0.0

lambda-options-haskell

A modern command-line parser for Haskell.

import System.Environment
import System.ExitCode
import Text.LambdaOptions

options :: LambdaOptions IO ()
options = do
  addOption "--help" $ do
    putStrLn "--user NAME [AGE]"
  addOption "--user" $ \name -> do
    putStrLn $ "Name:" ++ name
  addOption "--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 OptionsError -> exitFailure
    Nothing -> exitSuccess