Skip to content

Commit

Permalink
Support for GHC 9.10.*
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Aug 30, 2024
1 parent 5c11026 commit ec8adfc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ jobs:
- '9.4'
- '9.6'
- '9.8'
- '9.10'
include:
- os: macos-latest
- os: macos-12
ghc: system
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -54,17 +55,14 @@ jobs:
- shell: bash
run: cabal update

- shell: bash
run: cabal configure --enable-tests --enable-benchmarks

- shell: bash
run: cabal build all

- shell: bash
run: echo | cabal repl sensei --build-depends hspec-meta

- shell: bash
run: cabal exec -- "${PWD}/$(find dist-newstyle/ -name spec -type f)" --times --print-slow
run: cabal exec -- $(cabal list-bin spec) --times --print-slow
env:
HSPEC_OPTIONS: --color

Expand Down
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ package sensei
ghc-options: -Werror

tests: True

source-repository-package
type: git
location: https://github.com/sol/hinotify/
tag: 2131698f86939542c7df2cf3e60b40cc7e42819c
5 changes: 4 additions & 1 deletion src/Trigger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ reloadedSuccessfully = any success . lines
success :: String -> Bool
success x = case stripPrefix "Ok, " x of
Just "one module loaded." -> True
Just "one module reloaded." -> True
Just "1 module loaded." -> True
Just "1 module reloaded." -> True
Just xs | [_number, "modules", "loaded."] <- words xs -> True
Just xs -> "modules loaded: " `isPrefixOf` xs
Just xs | [_number, "modules", "reloaded."] <- words xs -> True
Just xs -> "modules loaded: " `isPrefixOf` xs || "modules reloaded: " `isPrefixOf` xs
Nothing -> False

removeProgress :: String -> String
Expand Down
11 changes: 10 additions & 1 deletion test/Helper.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
module Helper (
module Imports
, silent
Expand Down Expand Up @@ -97,7 +98,7 @@ data Status = Ok | Failed
deriving (Eq, Show)

modulesLoaded :: Status -> [String] -> String
modulesLoaded status xs = show status ++ ", " ++ mods ++ " loaded."
modulesLoaded status xs = show status ++ ", " ++ mods ++ " " ++ loaded ++ "."
where
n = length xs
mods
Expand All @@ -109,3 +110,11 @@ modulesLoaded status xs = show status ++ ", " ++ mods ++ " loaded."
| n == 5 = "five modules"
| n == 6 = "six modules"
| otherwise = show n ++ " modules"

#if __GLASGOW_HASKELL__ < 910
loaded = "loaded"
#else
loaded
| n == 0 = "to be reloaded"
| otherwise = "reloaded"
#endif
5 changes: 5 additions & 0 deletions test/TriggerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,16 @@ spec = do
writeFile name (passingSpec ++ "foo = bar")
(trigger session >> trigger session) `shouldReturn` (Failure, [
"[1 of 1] Compiling Spec"
#if __GLASGOW_HASKELL__ < 910
, ""
#endif
#if __GLASGOW_HASKELL__ >= 906
, "Spec.hs:9:7: error: [GHC-88464] Variable not in scope: bar"
#else
, "Spec.hs:9:7: error: Variable not in scope: bar"
#endif
#if __GLASGOW_HASKELL__ >= 910
, ""
#endif
, modulesLoaded Failed []
, withColor Red "RELOADING FAILED"
Expand Down

0 comments on commit ec8adfc

Please sign in to comment.