rescue old GHCs.
This commit is contained in:
parent
ae75872638
commit
9bc25046e3
@ -20,7 +20,6 @@ import Language.Haskell.GhcMod.GhcPkg
|
|||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import Control.Monad (forM, void)
|
import Control.Monad (forM, void)
|
||||||
import CoreMonad (liftIO)
|
import CoreMonad (liftIO)
|
||||||
import Data.IntSet (IntSet, empty)
|
|
||||||
import Data.Maybe (isJust, fromJust)
|
import Data.Maybe (isJust, fromJust)
|
||||||
import Exception (ghandle, SomeException(..))
|
import Exception (ghandle, SomeException(..))
|
||||||
import GHC (Ghc, GhcMonad, DynFlags(..), GhcLink(..), HscTarget(..), LoadHowMuch(..))
|
import GHC (Ghc, GhcMonad, DynFlags(..), GhcLink(..), HscTarget(..), LoadHowMuch(..))
|
||||||
@ -188,12 +187,12 @@ withDynFlags setFlag body = G.gbracket setup teardown (\_ -> body)
|
|||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
setNoWaringFlags :: DynFlags -> DynFlags
|
setNoWaringFlags :: DynFlags -> DynFlags
|
||||||
setNoWaringFlags df = df { warningFlags = empty}
|
setNoWaringFlags df = df { warningFlags = Gap.emptyWarnFlags}
|
||||||
|
|
||||||
setAllWaringFlags :: DynFlags -> DynFlags
|
setAllWaringFlags :: DynFlags -> DynFlags
|
||||||
setAllWaringFlags df = df { warningFlags = allWarningFlags }
|
setAllWaringFlags df = df { warningFlags = allWarningFlags }
|
||||||
|
|
||||||
allWarningFlags :: IntSet
|
allWarningFlags :: Gap.WarnFlags
|
||||||
allWarningFlags = unsafePerformIO $ do
|
allWarningFlags = unsafePerformIO $ do
|
||||||
mlibdir <- getSystemLibDir
|
mlibdir <- getSystemLibDir
|
||||||
G.runGhc mlibdir $ do
|
G.runGhc mlibdir $ do
|
||||||
|
@ -28,6 +28,8 @@ module Language.Haskell.GhcMod.Gap (
|
|||||||
, GapThing(..)
|
, GapThing(..)
|
||||||
, fromTyThing
|
, fromTyThing
|
||||||
, fileModSummary
|
, fileModSummary
|
||||||
|
, WarnFlags
|
||||||
|
, emptyWarnFlags
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Applicative hiding (empty)
|
import Control.Applicative hiding (empty)
|
||||||
@ -71,6 +73,10 @@ import Control.Arrow hiding ((<+>))
|
|||||||
import Data.Convertible
|
import Data.Convertible
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __GLASGOW_HASKELL__ >= 704
|
||||||
|
import qualified Data.IntSet as I (IntSet, empty)
|
||||||
|
#endif
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
--
|
--
|
||||||
@ -359,3 +365,16 @@ fromTyThing (ADataCon d) = GtA $ dataConRepType d
|
|||||||
#endif
|
#endif
|
||||||
fromTyThing (ATyCon t) = GtT t
|
fromTyThing (ATyCon t) = GtT t
|
||||||
fromTyThing _ = GtN
|
fromTyThing _ = GtN
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
#if __GLASGOW_HASKELL__ >= 704
|
||||||
|
type WarnFlags = I.IntSet
|
||||||
|
emptyWarnFlags :: WarnFlags
|
||||||
|
emptyWarnFlags = I.empty
|
||||||
|
#else
|
||||||
|
type WarnFlags = [WarningFlag]
|
||||||
|
emptyWarnFlags :: WarnFlags
|
||||||
|
emptyWarnFlags = []
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user