Permalink
Browse files

guess-ghc-version: Add a executable to run with .cabal files to guess…

… its minimum ghc version
  • Loading branch information...
1 parent 9974fce commit 4d29207af55b86175e4eddc7e278e6e315cbaab7 @kolmodin kolmodin committed Jun 13, 2010
Showing with 28 additions and 0 deletions.
  1. +28 −0 Main-GuessGHC.hs
View
28 Main-GuessGHC.hs
@@ -0,0 +1,28 @@
+module Main where
+
+import System.Environment
+
+import Distribution.PackageDescription
+import Distribution.PackageDescription.Parse
+
+import Distribution.Text
+import Distribution.Verbosity
+
+import Portage.GHCCore
+
+main :: IO ()
+main = do
+ args <- getArgs
+ gpds <- mapM (readPackageDescription silent) args
+ mapM_ guess gpds
+
+guess :: GenericPackageDescription -> IO ()
+guess gpd = do
+ --gpd <- readPackageDescription verbose fp
+ let pkg = package . packageDescription $ gpd
+ let mghc = minimumGHCVersionToBuildPackage gpd
+ putStr (display pkg)
+ putStr "\t\t"
+ putStrLn $ case mghc of
+ Nothing -> "Unknown"
+ Just v -> display v

0 comments on commit 4d29207

Please sign in to comment.