Name : ghc-envparse
| |
Version : 0.4
| Vendor : openSUSE
|
Release : bp150.2.6
| Date : 2018-07-30 20:24:33
|
Group : Development/Libraries/Haskell
| Source RPM : ghc-envparse-0.4-bp150.2.6.src.rpm
|
Size : 0.26 MB
| |
Packager : https://bugs_opensuse_org
| |
Summary : Parse environment variables
|
Description :
Here\'s a simple example of a program that uses \'envparse\'\'s parser:
\' module Main (main) where
import Control.Monad (unless) import Env
data Hello = Hello { name :: String, quiet :: Bool }
hello :: IO Hello hello = Env.parse (header \"envparse example\") $ Hello < $> var (str < =< nonempty) \"NAME\" (help \"Target for the greeting\") < *> switch \"QUIET\" (help \"Whether to actually print the greeting\") main :: IO () main = do Hello {name, quiet} < - hello unless quiet $ putStrLn (\"Hello, \" ++ name ++ \"!\") \'
The \'NAME\' environment variable is mandatory and contains the name of the person to greet. \'QUIET\', on the other hand, is an optional boolean flag, false by default, that decides whether the greeting should be silent.
If the \'NAME\' variable is undefined in the environment then running the program will result in the following help text:
\' envparse example Available environment variables: NAME Target for the greeting QUIET Whether to actually print the greeting Parsing errors: NAME is unset \'.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/openSUSE:/Backports:/SLE-15/standard/x86_64 |