From 289005505fe5e1f8587b7681bcd52921a6978920 Mon Sep 17 00:00:00 2001 From: Alberto Fanton Date: Sat, 21 Dec 2024 15:35:08 +0100 Subject: [PATCH] Add support for GHC912 --- .github/workflows/build.yml | 2 ++ doctest.cabal | 4 ++-- package.yaml | 2 +- src/Extract.hs | 2 ++ test/Language/Haskell/GhciWrapperSpec.hs | 4 ++++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36c4607..d3a98f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,7 @@ on: push: branches: - main + - ghc912 pull_request: branches: - main @@ -68,6 +69,7 @@ jobs: - 9.8.1 - 9.8.2 - 9.10.1 + - 9.12.1 include: - os: macos-latest ghc: 9.6.2 diff --git a/doctest.cabal b/doctest.cabal index 655f318..e842c5a 100644 --- a/doctest.cabal +++ b/doctest.cabal @@ -161,7 +161,7 @@ library , directory , exceptions , filepath - , ghc >=8.0 && <9.12 + , ghc >=8.0 && <9.14 , ghc-paths >=0.1.0.9 , process , syb >=0.3 @@ -286,7 +286,7 @@ test-suite spec , directory , exceptions , filepath - , ghc >=8.0 && <9.12 + , ghc >=8.0 && <9.14 , ghc-paths >=0.1.0.9 , hspec >=2.3.0 , hspec-core >=2.3.0 diff --git a/package.yaml b/package.yaml index 72e3f7c..ac23edf 100644 --- a/package.yaml +++ b/package.yaml @@ -54,7 +54,7 @@ library: - Test.DocTest.Internal.Cabal dependencies: &dependencies - ghc: ">= 8.0 && < 9.12" + ghc: ">= 8.0 && < 9.14" syb: ">= 0.3" code-page: ">= 0.1" deepseq: diff --git a/src/Extract.hs b/src/Extract.hs index 592f451..f8237de 100644 --- a/src/Extract.hs +++ b/src/Extract.hs @@ -55,7 +55,9 @@ import GHC.Unit.Module.Graph -- | A wrapper around `SomeException`, to allow for a custom `Show` instance. newtype ExtractError = ExtractError SomeException +#if __GLASGOW_HASKELL__ < 912 deriving Typeable +#endif instance Show ExtractError where show (ExtractError e) = diff --git a/test/Language/Haskell/GhciWrapperSpec.hs b/test/Language/Haskell/GhciWrapperSpec.hs index 0c30a69..178fd85 100644 --- a/test/Language/Haskell/GhciWrapperSpec.hs +++ b/test/Language/Haskell/GhciWrapperSpec.hs @@ -78,7 +78,11 @@ spec = do it "shows exceptions" $ withInterpreter $ \ghci -> do ghci "import Control.Exception" `shouldReturn` "" +#if __GLASGOW_HASKELL__ >= 912 + ghci "throwIO DivideByZero" `shouldReturn` "*** Exception: divide by zero\n\nHasCallStack backtrace:\n throwIO, called at :25:1 in interactive:Ghci22\n\n" +#else ghci "throwIO DivideByZero" `shouldReturn` "*** Exception: divide by zero\n" +#endif it "shows exceptions (ExitCode)" $ withInterpreter $ \ghci -> do ghci "import System.Exit" `shouldReturn` ""