From b69a8f983c070564b41b6fdec160af6d8aff730b Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 13 May 2020 10:45:14 +0200 Subject: [PATCH] Adapt to new GHC modules organization --- .../Haskell/Brittany/Internal/ExactPrintUtils.hs | 6 ++++++ src/Language/Haskell/Brittany/Internal/Prelude.hs | 8 ++++++-- src/Language/Haskell/Brittany/Internal/Utils.hs | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Language/Haskell/Brittany/Internal/ExactPrintUtils.hs b/src/Language/Haskell/Brittany/Internal/ExactPrintUtils.hs index 0273d85..5dcf840 100644 --- a/src/Language/Haskell/Brittany/Internal/ExactPrintUtils.hs +++ b/src/Language/Haskell/Brittany/Internal/ExactPrintUtils.hs @@ -33,7 +33,13 @@ import qualified Lexer as GHC import qualified StringBuffer as GHC import qualified Outputable as GHC import qualified CmdLineParser as GHC + +#if MIN_VERSION_ghc(8,10,1) /* ghc-8.10.1 */ +import GHC.Hs +#else import HsSyn +#endif + import SrcLoc ( SrcSpan, Located ) diff --git a/src/Language/Haskell/Brittany/Internal/Prelude.hs b/src/Language/Haskell/Brittany/Internal/Prelude.hs index 453f076..a0757d8 100644 --- a/src/Language/Haskell/Brittany/Internal/Prelude.hs +++ b/src/Language/Haskell/Brittany/Internal/Prelude.hs @@ -13,9 +13,13 @@ where -- rather project-specific stuff: --------------------------------- -#if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */ +#if MIN_VERSION_ghc(8,10,1) /* ghc-8.10.1 */ +import GHC.Hs.Extension as E ( GhcPs ) +#else +# if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */ import HsExtension as E ( GhcPs ) -#endif +# endif /* ghc-8.4 */ +#endif /* ghc-8.10.1 */ import RdrName as E ( RdrName ) #if MIN_VERSION_ghc(8,8,0) diff --git a/src/Language/Haskell/Brittany/Internal/Utils.hs b/src/Language/Haskell/Brittany/Internal/Utils.hs index 435ad96..9edcb7e 100644 --- a/src/Language/Haskell/Brittany/Internal/Utils.hs +++ b/src/Language/Haskell/Brittany/Internal/Utils.hs @@ -59,9 +59,13 @@ import Language.Haskell.Brittany.Internal.Config.Types import Language.Haskell.Brittany.Internal.Types import qualified Data.Generics.Uniplate.Direct as Uniplate -#if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */ +#if MIN_VERSION_ghc(8,10,1) /* ghc-8.10.1 */ +import qualified GHC.Hs.Extension as HsExtension +#else +# if MIN_VERSION_ghc(8,4,0) /* ghc-8.4 */ import qualified HsExtension -#endif +# endif /* ghc-8.4 */ +#endif /* ghc-8.10.1 */ @@ -299,6 +303,10 @@ lines' s = case break (== '\n') s of (s1, [_]) -> [s1, ""] (s1, (_:r)) -> s1 : lines' r +#if MIN_VERSION_ghc(8,10,1) /* ghc-8.10.1 */ +absurdExt :: HsExtension.NoExtField -> a +absurdExt = error "cannot construct NoExtField" +#else #if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */ -- | A method to dismiss NoExt patterns for total matches absurdExt :: HsExtension.NoExt -> a @@ -306,4 +314,5 @@ absurdExt = error "cannot construct NoExt" #else absurdExt :: () absurdExt = () -#endif +#endif /* ghc-8.6 */ +#endif /* ghc-8.10.1 */