factory 0.2.0.0 → 0.2.0.1
raw patch · 2 files changed
+26/−26 lines, 2 filesdep −haskell98new-uploader
Dependencies removed: haskell98
Files
- factory.cabal +1/−2
- src/Main.hs +25/−24
factory.cabal view
@@ -1,6 +1,6 @@ --Package-properties Name: factory-Version: 0.2.0.0+Version: 0.2.0.1 Cabal-Version: >= 1.6 Copyright: (C) 2011 Dr. Alistair Ward License: GPL@@ -144,7 +144,6 @@ Build-depends: Cabal >= 1.6 && < 2,- haskell98, QuickCheck >= 2.2 GHC-options: -Wall -O2
src/Main.hs view
@@ -55,7 +55,8 @@ import qualified Factory.Test.Performance.Statistics as Test.Performance.Statistics import qualified Factory.Test.QuickCheck.QuickChecks as Test.QuickCheck.QuickChecks import qualified Paths_factory as Paths --Either local stub, or package-instance autogenerated by 'Setup.hs build'.-import qualified System+import qualified System.Environment+import qualified System.Exit import qualified System.Console.GetOpt as G import qualified System.IO import qualified System.IO.Error@@ -71,8 +72,8 @@ -- | Parses the command-line arguments, to determine 'Test.CommandOptions.CommandOptions'. main :: IO () main = do- progName <- System.getProgName- args <- System.getArgs+ progName <- System.Environment.getProgName+ args <- System.Environment.getArgs let usage :: String@@ -105,74 +106,74 @@ G.Option "?" ["help"] (G.NoArg $ const printUsage) "Display this help-text & then exit." ] where printVersion, printUsage, runQuickChecks :: IO Test.CommandOptions.CommandOptions- printVersion = System.IO.hPutStrLn System.IO.stderr (Distribution.Text.display packageIdentifier ++ "\n\nCopyright (C) 2011 Dr. Alistair Ward.\nThis program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under certain conditions.\n\nWritten by Dr. Alistair Ward.") >> System.exitWith System.ExitSuccess where+ printVersion = System.IO.hPutStrLn System.IO.stderr (Distribution.Text.display packageIdentifier ++ "\n\nCopyright (C) 2011 Dr. Alistair Ward.\nThis program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under certain conditions.\n\nWritten by Dr. Alistair Ward.") >> System.Exit.exitWith System.Exit.ExitSuccess where packageIdentifier :: Distribution.Package.PackageIdentifier packageIdentifier = Distribution.Package.PackageIdentifier { Distribution.Package.pkgName = Distribution.Package.PackageName "factory", Distribution.Package.pkgVersion = Distribution.Version.Version (Data.Version.versionBranch Paths.version) [] } - printUsage = System.IO.hPutStrLn System.IO.stderr usage >> System.exitWith System.ExitSuccess- runQuickChecks = Test.QuickCheck.QuickChecks.run >> System.exitWith System.ExitSuccess+ printUsage = System.IO.hPutStrLn System.IO.stderr usage >> System.Exit.exitWith System.Exit.ExitSuccess+ runQuickChecks = Test.QuickCheck.QuickChecks.run >> System.Exit.exitWith System.Exit.ExitSuccess factorialPerformanceGraphControl :: Test.CommandOptions.CommandOptions -> IO Test.CommandOptions.CommandOptions- factorialPerformanceGraphControl commandOptions = Test.Performance.Factorial.factorialPerformanceGraphControl (Test.CommandOptions.verbose commandOptions) >> System.exitWith (System.ExitFailure 1)+ factorialPerformanceGraphControl commandOptions = Test.Performance.Factorial.factorialPerformanceGraphControl (Test.CommandOptions.verbose commandOptions) >> System.Exit.exitWith (System.Exit.ExitFailure 1) carmichaelNumbersPerformance, factorialPerformance, factorialPerformanceGraph, hyperoperationPerformance, hyperoperationPerformanceGraphRank, hyperoperationPerformanceGraphExponent, isPrimePerformance, isPrimePerformanceGraph, piPerformance, piPerformanceGraph, primeFactorsPerformance, primesPerformance, squareRootPerformance, squareRootPerformanceGraph :: String -> CommandLineAction - carmichaelNumbersPerformance arg _ = Test.Performance.Primality.carmichaelNumbersPerformance algorithm i >>= print >> System.exitWith System.ExitSuccess where+ carmichaelNumbersPerformance arg _ = Test.Performance.Primality.carmichaelNumbersPerformance algorithm i >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where algorithm :: PrimalityAlgorithm (algorithm, i) = read arg - factorialPerformance arg _ = Test.Performance.Factorial.factorialPerformance algorithm i >>= print >> System.exitWith System.ExitSuccess where+ factorialPerformance arg _ = Test.Performance.Factorial.factorialPerformance algorithm i >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where algorithm :: Math.Implementations.Factorial.Algorithm i :: Integer (algorithm, i) = read arg - factorialPerformanceGraph arg commandOptions = Test.Performance.Factorial.factorialPerformanceGraph (Test.CommandOptions.verbose commandOptions) (read arg :: Math.Implementations.Factorial.Algorithm) >> System.exitWith (System.ExitFailure 1)+ factorialPerformanceGraph arg commandOptions = Test.Performance.Factorial.factorialPerformanceGraph (Test.CommandOptions.verbose commandOptions) (read arg :: Math.Implementations.Factorial.Algorithm) >> System.Exit.exitWith (System.Exit.ExitFailure 1) - hyperoperationPerformance arg _ = Test.Performance.Hyperoperation.hyperoperationPerformance rank base hyperExponent >>= print >> System.exitWith System.ExitSuccess where+ hyperoperationPerformance arg _ = Test.Performance.Hyperoperation.hyperoperationPerformance rank base hyperExponent >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where rank :: Integer base :: Math.Hyperoperation.Base hyperExponent :: Math.Hyperoperation.HyperExponent (rank, base, hyperExponent) = read arg - hyperoperationPerformanceGraphRank arg commandOptions = Test.Performance.Hyperoperation.hyperoperationPerformanceGraphRank (Test.CommandOptions.verbose commandOptions) base hyperExponent >> System.exitWith (System.ExitFailure 1) where+ hyperoperationPerformanceGraphRank arg commandOptions = Test.Performance.Hyperoperation.hyperoperationPerformanceGraphRank (Test.CommandOptions.verbose commandOptions) base hyperExponent >> System.Exit.exitWith (System.Exit.ExitFailure 1) where base :: Math.Hyperoperation.Base hyperExponent :: Math.Hyperoperation.HyperExponent (base, hyperExponent) = read arg - hyperoperationPerformanceGraphExponent arg commandOptions = Test.Performance.Hyperoperation.hyperoperationPerformanceGraphExponent (Test.CommandOptions.verbose commandOptions) rank base >> System.exitWith (System.ExitFailure 1) where+ hyperoperationPerformanceGraphExponent arg commandOptions = Test.Performance.Hyperoperation.hyperoperationPerformanceGraphExponent (Test.CommandOptions.verbose commandOptions) rank base >> System.Exit.exitWith (System.Exit.ExitFailure 1) where rank :: Integer base :: Math.Hyperoperation.Base (rank, base) = read arg - isPrimePerformance arg _ = Test.Performance.Primality.isPrimePerformance algorithm i >>= print >> System.exitWith System.ExitSuccess where+ isPrimePerformance arg _ = Test.Performance.Primality.isPrimePerformance algorithm i >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where algorithm :: PrimalityAlgorithm i :: Integer (algorithm, i) = read arg - isPrimePerformanceGraph arg _ = Test.Performance.Primality.isPrimePerformanceGraph (read arg :: Math.Implementations.Primality.Algorithm Math.Implementations.PrimeFactorisation.Algorithm) >> System.exitWith (System.ExitFailure 1)+ isPrimePerformanceGraph arg _ = Test.Performance.Primality.isPrimePerformanceGraph (read arg :: Math.Implementations.Primality.Algorithm Math.Implementations.PrimeFactorisation.Algorithm) >> System.Exit.exitWith (System.Exit.ExitFailure 1) - nCrPerformance arg _ = Test.Performance.Statistics.nCrPerformance algorithm n r >>= print >> System.exitWith System.ExitSuccess where+ nCrPerformance arg _ = Test.Performance.Statistics.nCrPerformance algorithm n r >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where algorithm :: Math.Implementations.Factorial.Algorithm n, r :: Integer (algorithm, n, r) = read arg - piPerformance arg _ = Test.Performance.Pi.piPerformance category decimalDigits >>= print >> System.exitWith System.ExitSuccess where+ piPerformance arg _ = Test.Performance.Pi.piPerformance category decimalDigits >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where category :: PiCategory (category, decimalDigits) = read arg - piPerformanceGraph arg commandOptions = Test.Performance.Pi.piPerformanceGraph category factor maxDecimalDigits (Test.CommandOptions.verbose commandOptions) >> System.exitWith (System.ExitFailure 1) where+ piPerformanceGraph arg commandOptions = Test.Performance.Pi.piPerformanceGraph category factor maxDecimalDigits (Test.CommandOptions.verbose commandOptions) >> System.Exit.exitWith (System.Exit.ExitFailure 1) where category :: PiCategory factor :: Double (category, factor, maxDecimalDigits) = read arg - primeFactorsPerformance arg _ = Test.Performance.PrimeFactorisation.primeFactorsPerformance algorithm i >>= print >> System.exitWith System.ExitSuccess where+ primeFactorsPerformance arg _ = Test.Performance.PrimeFactorisation.primeFactorsPerformance algorithm i >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where algorithm :: Math.Implementations.PrimeFactorisation.Algorithm (algorithm, i) = read arg - primeFactorsPerformanceGraph arg _ = Test.Performance.PrimeFactorisation.primeFactorsPerformanceGraph algorithm index >> System.exitWith (System.ExitFailure 1) where+ primeFactorsPerformanceGraph arg _ = Test.Performance.PrimeFactorisation.primeFactorsPerformanceGraph algorithm index >> System.Exit.exitWith (System.Exit.ExitFailure 1) where algorithm :: Math.Implementations.PrimeFactorisation.Algorithm (algorithm, index) = read arg @@ -192,22 +193,22 @@ -- Integer Int --Exploits rewrite-rules in "Math.Implementations.Primes.*". )- ) >>= print >> System.exitWith System.ExitSuccess where+ ) >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where algorithm :: Math.Implementations.Primes.Algorithm.Algorithm (algorithm, index) = read arg - squareRootPerformance arg _ = Test.Performance.SquareRoot.squareRootPerformance algorithm operand decimalDigits >>= print >> System.exitWith System.ExitSuccess where+ squareRootPerformance arg _ = Test.Performance.SquareRoot.squareRootPerformance algorithm operand decimalDigits >>= print >> System.Exit.exitWith System.Exit.ExitSuccess where algorithm :: Math.Implementations.SquareRoot.Algorithm operand :: Data.Ratio.Rational (algorithm, operand, decimalDigits) = read arg - squareRootPerformanceGraph arg _ = Test.Performance.SquareRoot.squareRootPerformanceGraph algorithm operand >> System.exitWith (System.ExitFailure 1) where+ squareRootPerformanceGraph arg _ = Test.Performance.SquareRoot.squareRootPerformanceGraph algorithm operand >> System.Exit.exitWith (System.Exit.ExitFailure 1) where algorithm :: Math.Implementations.SquareRoot.Algorithm operand :: Data.Ratio.Rational (algorithm, operand) = read arg -- G.getOpt :: G.ArgOrder CommandLineAction -> [G.OptDescr Action] -> [String] -> ([Action], [String], [String]) case G.getOpt G.RequireOrder optDescrList args of- (commandLineActions, _, []) -> Data.List.foldl' (>>=) (return {-to IO-monad-} Defaultable.defaultValue) commandLineActions >> System.exitWith System.ExitSuccess+ (commandLineActions, _, []) -> Data.List.foldl' (>>=) (return {-to IO-monad-} Defaultable.defaultValue) commandLineActions >> System.Exit.exitWith System.Exit.ExitSuccess (_, _, errors) -> System.IO.Error.ioError . System.IO.Error.userError $ concat errors ++ usage --Throw.