shell-utility-0.0: Utility functions for writing command-line programs

Safe HaskellSafe
LanguageHaskell98

Shell.Utility.ParseArgument

Description

Both System.Console.GetOpt and Optparse.Applicative do not have built-in support for number or enumeration arguments. But there is usually a lot to check, e.g. whether numbers are positive, not too big, etc. We provide argument parsers here in a way that can be used in all command-line parsing libraries.

Documentation

parseNumber :: (Exit m, Read a) => String -> (a -> Bool) -> String -> String -> m a Source #

enumMaybe :: (Bounded a, Enum a, Eq str) => (a -> str) -> str -> Maybe a Source #

enumeration :: (Bounded a, Enum a) => String -> (a -> String) -> String -> Either String a Source #