lambda-options: Declarative command-line parser with type-driven pattern matching.

[ bsd3, library, text ] [ Propose Tags ] [ Report a vulnerability ]

Declarative command-line parser with type-driven pattern matching.


[Skip to Readme]

Modules

[Last Documentation]

  • Text
    • Text.LambdaOptions
      • Text.LambdaOptions.Core
      • Example
        • Text.LambdaOptions.Example.Example_1_Simple
        • Text.LambdaOptions.Example.Example_2_Constructors
        • Text.LambdaOptions.Example.Example_3_Record
        • Text.LambdaOptions.Example.Example_4_Booly
        • Text.LambdaOptions.Example.Example_5_Repl
        • Text.LambdaOptions.Example.Example_6_SubOptions
      • Text.LambdaOptions.Formatter
      • Text.LambdaOptions.Keyword
      • Text.LambdaOptions.Parseable
        • Text.LambdaOptions.Parseable.Booly
        • Text.LambdaOptions.Parseable.List

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 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, 0.9.1.0, 1.0.0.0, 1.0.1.0, 1.0.2.0, 1.1.0.0, 1.1.0.1
Dependencies base (>=4.13.0.0 && <4.14), containers (>=0.6.0.1 && <0.7), funspection (>=1.0.0.1 && <1.1), mtl (>=2.2.2 && <2.3), read-bounded (>=0.1.1.3 && <0.2) [details]
License BSD-3-Clause
Author Thomas Eding
Maintainer Thomas Eding
Uploaded by ThomasEding at 2020-09-11T19:24:14Z
Category Text
Home page https://github.com/thomaseding/lambda-options
Bug tracker https://github.com/thomaseding/lambda-options/issues
Downloads 11492 total (62 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2020-09-11 [all 2 reports]

Readme for lambda-options-1.1.0.1

[back to package description]

lambda-options-haskell

Declarative command line parser using type-driven pattern matching.

  • Easy to use. The API is expressive.
  • Easy to learn. The API is tiny and simple.

Homepage: https://github.com/thomaseding/lambda-options

Hackage: https://hackage.haskell.org/package/lambda-options


Basic example:

import qualified System.Environment as Env import qualified Text.LambdaOptions as L options :: L.Options (IO ()) options = do L.addOption (L.kw ["--help", "-h"] `L.text` "Display this help text.") $ do putStrLn "Usage:" putStrLn $ L.getHelpDescription options L.addOption (L.kw "--add" `L.argText` "X Y" `L.text` "Adds two Doubles and prints their sum.") $ \x y -> do print $ x + (y :: Double) main :: IO () main = do args <- Env.getArgs case L.runOptions options args of Left e -> do putStrLn $ L.prettyOptionsError e putStrLn $ L.getHelpDescription options Right results -> do sequence_ results 
>>> :main --add 3 0.14 3.14 >>> :main -h Usage: --add X Y Adds two Doubles and prints their sum. -h, --help Display this help text. >>> :main --add 0 1 --add 2 four Bad input for `--add' at index 3: `four' --add X Y Adds two Doubles and prints their sum. -h, --help Display this help text.