From 839383204b32959ccd2b208cb20bdefec4b5bd9f Mon Sep 17 00:00:00 2001
From: Ziyang Liu <unsafeFixIO@gmail.com>
Date: Wed, 20 Dec 2023 18:37:25 -0800
Subject: [PATCH] 9.8 support (#144)

---
 .github/workflows/haskell-ci.yml | 2 +-
 apply-refact.cabal               | 6 ++++--
 src/Refact/Compat.hs             | 4 +++-
 src/Refact/Fixity.hs             | 1 +
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml
index 7083846..a294e56 100644
--- a/.github/workflows/haskell-ci.yml
+++ b/.github/workflows/haskell-ci.yml
@@ -12,7 +12,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        ghc: ["9.6.1", "9.4.5", "9.2.7"]
+        ghc: ["9.8.1", "9.6.3", "9.4.6", "9.2.8"]
     env:
       CONFIG: "--enable-tests --enable-benchmarks"
     steps:
diff --git a/apply-refact.cabal b/apply-refact.cabal
index 7355afb..87b6d4c 100644
--- a/apply-refact.cabal
+++ b/apply-refact.cabal
@@ -18,7 +18,7 @@ extra-source-files:  CHANGELOG
                    , tests/examples/*.hs
                    , tests/examples/*.hs.refact
                    , tests/examples/*.hs.expected
-tested-with:         GHC==9.6.1, GHC==9.4.5, GHC==9.2.7
+tested-with:         GHC==9.8.1, GHC==9.6.3, GHC==9.4.6, GHC==9.2.8
 
 
 source-repository head
@@ -35,7 +35,7 @@ library
   build-depends: base >=4.16 && < 5
                , refact >= 0.2
                , ghc-boot-th
-               , ghc-exactprint ^>= 1.5.0 || ^>= 1.6.0 || ^>= 1.7.0
+               , ghc-exactprint ^>= 1.5.0 || ^>= 1.6.0 || ^>= 1.7.0 || ^>= 1.8.0
                , containers >= 0.6.0.1 && < 0.7
                , extra >= 1.7.3
                , syb >= 0.7.1
@@ -45,6 +45,8 @@ library
                , uniplate >= 1.6.13
                , unix-compat >= 0.5.2
                , directory >= 1.3
+  if (impl(ghc >= 9.8) && impl(ghc < 9.9))
+    build-depends: ghc ^>= 9.8
   if (impl(ghc >= 9.6) && impl(ghc < 9.7))
     build-depends: ghc ^>= 9.6
   if (impl(ghc >= 9.4) && impl(ghc < 9.5))
diff --git a/src/Refact/Compat.hs b/src/Refact/Compat.hs
index ec420c9..f497969 100644
--- a/src/Refact/Compat.hs
+++ b/src/Refact/Compat.hs
@@ -120,7 +120,9 @@ import GHC.Hs hiding (Pat, Stmt, parseModuleName)
 import GHC.Hs hiding (Pat, Stmt)
 #endif
 import GHC.Parser.Header (getOptions)
-#if MIN_VERSION_ghc(9,4,0)
+#if MIN_VERSION_ghc(9,8,0)
+import GHC.Types.Error (defaultDiagnosticOpts, getMessages)
+#elif MIN_VERSION_ghc(9,4,0)
 import GHC.Types.Error (getMessages)
 #endif
 import GHC.Types.Fixity  ( Fixity(..) )
diff --git a/src/Refact/Fixity.hs b/src/Refact/Fixity.hs
index ca75803..f27cc8e 100644
--- a/src/Refact/Fixity.hs
+++ b/src/Refact/Fixity.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE ViewPatterns #-}
 
 module Refact.Fixity (applyFixities) where
