@@ -2,6 +2,7 @@
22-- SPDX-License-Identifier: Apache-2.0
33
44{-# LANGUAGE CPP #-}
5+#include "ghc-api-version.h"
56
67-- | Attempt at hiding the GHC version differences we can.
78module Development.IDE.GHC.Compat(
@@ -21,7 +22,11 @@ import StringBuffer
2122import DynFlags
2223import GHC.LanguageExtensions.Type
2324
24−#ifndef GHC_STABLE
25+#if MIN_GHC_API_VERSION(8,8,0)
26+import Data.List.Extra (enumerate)
27+#endif
28+
29+#if MIN_GHC_API_VERSION(8,8,0)
2530import HieAst
2631import HieBin
2732import HieTypes
@@ -53,7 +58,7 @@ data HieFile = HieFile {hie_module :: (), hie_exports :: [AvailInfo]}
5358data HieFileResult = HieFileResult { hie_file_result :: HieFile }
5459#endif
5560
56−#if __GLASGOW_HASKELL__ < 806
61+#if !MIN_GHC_API_VERSION(8,6,0)
5762includePathsGlobal, includePathsQuote :: [String] -> [String]
5863includePathsGlobal = id
5964includePathsQuote = const []
@@ -61,7 +66,7 @@ includePathsQuote = const []
6166
6267
6368addIncludePathsQuote :: FilePath -> DynFlags -> DynFlags
64−#if __GLASGOW_HASKELL__ >= 806
69+#if MIN_GHC_API_VERSION(8,6,0)
6570addIncludePathsQuote path x = x{includePaths = f $ includePaths x}
6671 where f i = i{includePathsQuote = path : includePathsQuote i}
6772#else
@@ -69,9 +74,9 @@ addIncludePathsQuote path x = x{includePaths = path : includePaths x}
6974#endif
7075
7176ghcEnumerateExtensions :: [Extension]
72−#if __GLASGOW_HASKELL__ >= 808
77+#if MIN_GHC_API_VERSION(8,8,0)
7378ghcEnumerateExtensions = enumerate
74−#elif __GLASGOW_HASKELL__ >= 806
79+#elif MIN_GHC_API_VERSION(8,6,0)
7580ghcEnumerateExtensions = [Cpp .. StarIsType]
7681#else
7782ghcEnumerateExtensions = [Cpp .. EmptyDataDeriving]