From c0b4642cbc2ec89a97709cca4941655dab39b769 Mon Sep 17 00:00:00 2001 From: Brian Victor Date: Mon, 19 Mar 2012 18:20:05 +0000 Subject: [PATCH] update plugins to support GHC >= 7.2 (via conditional compilation) --- src/System/Plugins/Load.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/System/Plugins/Load.hs b/src/System/Plugins/Load.hs index 703b678..f3c0c60 100644 --- a/src/System/Plugins/Load.hs +++ b/src/System/Plugins/Load.hs @@ -84,7 +84,9 @@ import Control.Monad ( when, filterM, liftM ) import System.Directory ( doesFileExist, removeFile ) import Foreign.C.String ( CString, withCString, peekCString ) +#if !MIN_VERSION_ghc(7,2,0) import GHC ( defaultCallbacks ) +#endif import GHC.Ptr ( Ptr(..), nullPtr ) import GHC.Exts ( addrToHValue# ) import GHC.Prim ( unsafeCoerce# ) @@ -99,7 +101,11 @@ ifaceModuleName = moduleNameString . moduleName . mi_module readBinIface' :: FilePath -> IO ModIface readBinIface' hi_path = do -- kludgy as hell +#if MIN_VERSION_ghc(7,2,0) + e <- newHscEnv undefined +#else e <- newHscEnv defaultCallbacks undefined +#endif initTcRnIf 'r' e undefined undefined (readBinIface IgnoreHiWay QuietBinIFaceReading hi_path) -- TODO need a loadPackage p package.conf :: IO () primitive @@ -679,7 +685,11 @@ loadDepends obj incpaths = do -- and find some packages to load, as well. let ps = dep_pkgs ds +#if MIN_VERSION_ghc(7,2,0) + ps' <- filterM loaded . map packageIdString . nub $ map fst ps +#else ps' <- filterM loaded . map packageIdString . nub $ ps +#endif #if DEBUG when (not (null ps')) $