From b7197d9dc6e914ace4640d48d7d5a0095a1d5af3 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sat, 24 Dec 2011 19:01:37 -0600 Subject: [PATCH] Add support for GHC 7.4.1 The GHC API changed a bit to accomodate the REPL changes since 7.2 (now most top-level decls can be used in the API.) Tested and working using virthualenv with GHC 7.0.4 and 7.2.1-rc1 --- Info.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Info.hs b/Info.hs index bb51aad..dd9f550 100644 --- a/Info.hs +++ b/Info.hs @@ -107,9 +107,15 @@ inModuleContext opt fileName modstr action = withGHC valid setContextFromTarget :: Ghc Bool setContextFromTarget = do ms <- depanal [] False + +#if __GLASGOW_HASKELL__ >= 704 + top <- map (IIModule . ms_mod) <$> filterM isTop ms + setContext top +#else top <- map ms_mod <$> filterM isTop ms setContext top [] - return (top /= []) +#endif + return (not . null $ top) where isTop ms = lookupMod `gcatch` returnFalse where