packages feed

parseargs 0.1.3.2 → 0.1.3.4

raw patch · 2 files changed

+24/−20 lines, 2 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ System.Console.ParseArgs: instance ArgType ()
- System.Console.ParseArgs: class ArgType b
+ System.Console.ParseArgs: class ArgType b where getRequiredArg args index = case getArg args index of { Just v -> v Nothing -> error ("internal error: required argument " ++ show index ++ "not supplied") }

Files

System/Console/ParseArgs.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleInstances, DeriveDataTypeable #-} -- Full-featured argument parsing library for Haskell programs -- Bart Massey <bart@cs.pdx.edu> @@ -186,12 +186,7 @@ -- when argument parsing fails.  The first argument is the usage -- message, the second the actual error message from the parser. data ParseArgsException = ParseArgsException String String-     deriving Eq--instance Typeable ParseArgsException where-    typeOf _ = mkTyConApp e [s, s] where-        e = mkTyCon "ParseArgsException"-        s = typeOf ""+     deriving (Eq, Typeable)  instance Exception ParseArgsException @@ -552,12 +547,13 @@                           ++ show index ++ "not supplied")  getArgPrimitive decons (Args { args = ArgRecord am }) k =-    case Map.lookup k am of-      Just v -> Just (decons v)-      Nothing -> Nothing+  Map.lookup k am >>= decons +instance ArgType () where+  getArg = getArgPrimitive (\ArgvalFlag -> return ())+ instance ArgType ([] Char) where-  getArg = getArgPrimitive (\(ArgvalString s) -> s)+  getArg = getArgPrimitive (\(ArgvalString s) -> return s)  -- |[Deprecated]  Return the `String` value, if any, of the given argument. getArgString :: (Show a, Ord a) =>@@ -567,7 +563,7 @@ getArgString = getArg  instance ArgType Integer where-  getArg = getArgPrimitive (\(ArgvalInteger i) -> i)+  getArg = getArgPrimitive (\(ArgvalInteger i) -> return i)  -- |[Deprecated] Return the `Integer` value, if any, of the given argument. getArgInteger :: (Show a, Ord a) =>@@ -577,7 +573,7 @@ getArgInteger = getArg  instance ArgType Int where-  getArg = getArgPrimitive (\(ArgvalInt i) -> i)+  getArg = getArgPrimitive (\(ArgvalInt i) -> return i)  -- |[Deprecated] Return the `Int` value, if any, of the given argument. getArgInt :: (Show a, Ord a) =>@@ -587,7 +583,7 @@ getArgInt = getArg  instance ArgType Double where-  getArg = getArgPrimitive (\(ArgvalDouble i) -> i)+  getArg = getArgPrimitive (\(ArgvalDouble i) -> return i)  -- |[Deprecated] Return the `Double` value, if any, of the given argument. getArgDouble :: (Show a, Ord a) =>@@ -597,7 +593,7 @@ getArgDouble = getArg  instance ArgType Float where-  getArg = getArgPrimitive (\(ArgvalFloat i) -> i)+  getArg = getArgPrimitive (\(ArgvalFloat i) -> return i)  -- |[Deprecated] Return the `Float` value, if any, of the given argument. getArgFloat :: (Show a, Ord a) =>@@ -613,9 +609,8 @@  instance ArgType ArgFileOpener where     getArg args index =-        case getArg args index of-          Nothing -> Nothing-          Just s -> Just (ArgFileOpener { argFileOpener = openFile s })+        getArg args index >>= +          (\s -> return $ ArgFileOpener { argFileOpener = openFile s })  -- |[Deprecated] Treat the `String` value, if any, of the given argument as -- a file handle and try to open it as requested.
parseargs.cabal view
@@ -1,8 +1,8 @@ Name: parseargs Build-Type: Simple Description: Parse command-line arguments-Version: 0.1.3.2-Cabal-Version: >= 1.2+Version: 0.1.3.4+Cabal-Version: >= 1.6 License: BSD3 License-File: COPYING Author: Bart Massey <bart@cs.pdx.edu>@@ -21,3 +21,12 @@   Build-Depends:   base < 5   Main-Is:         parseargs-example.hs   Other-Modules:   System.Console.ParseArgs++Source-repository head+  Type:     git+  Location: git://svcs.cs.pdx.edu/git/parseargs.git++Source-repository this+  Type:     git+  Location: git://svcs.cs.pdx.edu/git/parseargs.git+  Tag:      v0.1.3.4