[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:57:45 UTC 2010
The following commit has been merged in the master branch:
commit 572ee60fda1c59ae9256f891165d9cfe2585488f
Author: John Goerzen <jgoerzen at complete.org>
Date: Mon Apr 18 04:49:26 2005 +0100
Added GetOpt.hs
diff --git a/MissingH.cabal b/MissingH.cabal
index a6115b1..a60e03c 100644
--- a/MissingH.cabal
+++ b/MissingH.cabal
@@ -72,7 +72,8 @@ Exposed-Modules: MissingH.IO, MissingH.IO.Binary, MissingH.List,
MissingH.Wash.Utility.Unique,
MissingH.AnyDBM,
MissingH.AnyDBM.FiniteMapDBM,
- MissingH.AnyDBM.StringDBM
+ MissingH.AnyDBM.StringDBM,
+ MissingH.GetOpt
Extensions: ExistentialQuantification, AllowOverlappingInstances,
AllowUndecidableInstances, CPP
-- CPP extension is really only needed in FiniteMap.hs
diff --git a/MissingH/Threads.hs b/MissingH/GetOpt.hs
similarity index 55%
copy from MissingH/Threads.hs
copy to MissingH/GetOpt.hs
index a863960..54e31ed 100644
--- a/MissingH/Threads.hs
+++ b/MissingH/GetOpt.hs
@@ -1,5 +1,5 @@
-{- arch-tag: Thread utilities main file
-Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+{-
+Copyright (C) 2005 John Goerzen <jgoerzen at complete.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,30 +17,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-}
{- |
- Module : MissingH.Threads
- Copyright : Copyright (C) 2004 John Goerzen
+ Module : MissingH.getOpt
+ Copyright : Copyright (C) 2005 John Goerzen
License : GNU GPL, version 2 or above
- Maintainer : John Goerzen,
+ Maintainer : John Goerzen,
Maintainer : jgoerzen at complete.org
Stability : provisional
Portability: portable
-This module provides various helpful utilities for dealing with threads.
-
Written by John Goerzen, jgoerzen\@complete.org
--}
-module MissingH.Threads(-- * I\/O utilities
- runInThread
+Utilities for command-line parsing, including wrappers around
+the standard System.Console.GetOpt module.
+-}
+module MissingH.GetOpt (
)
where
-
-import Control.Concurrent
-
-{- | Takes a IO action and a function. The IO action will be called in a
-separate thread. When it is completed, the specified function is called with
-its result. This is a simple way of doing callbacks. -}
-
-runInThread :: IO a -> (a -> IO b) -> IO ThreadId
-runInThread action callback = forkIO $ action >>= callback >> return ()
+import System.Console.GetOpt
+import System.Environment
+
+parseCmdLine :: ArgOrder a -> [OptDescr a] -> String -> IO ([a], [String])
+parseCmdLine order options header =
+ do argv <- getArgs
+ case getOpt order options argv of
+ (o, n, []) -> return (o, n)
+ (_, _, errors) -> ioError (userError (concat errors ++
+ usageInfo header options))
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list