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.


A modern command-line parser for Haskell.

[Skip to ReadMe]


Change logNone available
Dependenciesbase (==4.7.*), containers (==0.5.*), monad-loops (==0.4.*), mtl (==2.2.*) [details]
AuthorThomas Eding
Home page
UploadedSat May 16 07:26:03 UTC 2015 by ThomasEding




Maintainers' corner

For package maintainers and hackage trustees

Readme for lambda-options-

[back to package description]


A modern command-line parser for Haskell.

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 ()