diff --git a/Language/Haskell/GhcMod/Check.hs b/Language/Haskell/GhcMod/Check.hs index 48dacc3..4c2af9a 100644 --- a/Language/Haskell/GhcMod/Check.hs +++ b/Language/Haskell/GhcMod/Check.hs @@ -32,7 +32,7 @@ checkSyntax files = withErrorHandler sessionName $ do check :: [FilePath] -- ^ The target files. -> GhcMod (Either String String) check fileNames = do - withLogger setAllWaringFlags $ do + withLogger (setAllWaringFlags . setNoMaxRelevantBindings) $ do setTargetFiles fileNames ---------------------------------------------------------------- diff --git a/Language/Haskell/GhcMod/GHCApi.hs b/Language/Haskell/GhcMod/GHCApi.hs index d48b2e7..e8a7f5e 100644 --- a/Language/Haskell/GhcMod/GHCApi.hs +++ b/Language/Haskell/GhcMod/GHCApi.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE ScopedTypeVariables, RecordWildCards #-} +{-# LANGUAGE ScopedTypeVariables, RecordWildCards, CPP #-} module Language.Haskell.GhcMod.GHCApi ( withGHC @@ -11,6 +11,7 @@ module Language.Haskell.GhcMod.GHCApi ( , withCmdFlags , setNoWaringFlags , setAllWaringFlags + , setNoMaxRelevantBindings ) where import Language.Haskell.GhcMod.CabalApi @@ -195,6 +196,15 @@ setNoWaringFlags df = df { warningFlags = Gap.emptyWarnFlags} setAllWaringFlags :: DynFlags -> DynFlags setAllWaringFlags df = df { warningFlags = allWarningFlags } +-- | Set 'DynFlags' equivalent to "-fno-max-relevant-bindings". +setNoMaxRelevantBindings :: DynFlags -> DynFlags +#if __GLASGOW_HASKELL__ >= 708 +setNoMaxRelevantBindings df = df { maxRelevantBinds = Nothing } +#else +setNoMaxRelevantBindings = id +#endif + + allWarningFlags :: Gap.WarnFlags allWarningFlags = unsafePerformIO $ do mlibdir <- getSystemLibDir