diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 631dcaf..ce48341 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - ghc: ['9.2', '9.0', '8.10', '8.8', '8.6'] + ghc: ['9.4.4', '9.2', '9.0', '8.10', '8.8', '8.6'] include: - os: windows-latest - os: macOS-latest @@ -31,7 +31,7 @@ jobs: - name: Get GHC libdir id: get-ghc-libdir run: | - echo "::set-output name=libdir::$(ghc --print-libdir)" + echo "name=libdir::$(ghc --print-libdir)" >> $GITHUB_OUTPUT shell: bash - run: cabal v2-freeze --enable-tests - uses: actions/cache@v2 diff --git a/CHANGES.md b/CHANGES.md index ec3f655..a3ca911 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## 0.6 +* Start supporting GHC 9.4. See #66. * Add `ComposeTraversable`. See #65. * Make the `Applicative` instance of `ComposeEither` more interesting by relying on the `Selective f` constraint. See #64. diff --git a/examples/Parser.hs b/examples/Parser.hs index c08f618..2984c20 100644 --- a/examples/Parser.hs +++ b/examples/Parser.hs @@ -40,17 +40,17 @@ item = Parser $ \case (c:cs) -> [(c,cs)] sat :: (Char -> Bool) -> Parser Char -sat p = do { c <- item; if p c then return c else zero } +sat p = do { c <- item; if p c then pure c else zero } char :: Char -> Parser Char char c = sat (==c) string :: String -> Parser String -string [] = return "" +string [] = pure "" string (c:cs) = do _ <- char c _ <- string cs - return (c:cs) + pure (c:cs) bin :: Parser Int bin = undefined diff --git a/examples/Query.hs b/examples/Query.hs index 4b95241..5f8ba52 100644 --- a/examples/Query.hs +++ b/examples/Query.hs @@ -51,11 +51,11 @@ getPure (Pure a) = Just a getPure (Apply f x) = do pf <- getPure f px <- getPure x - return (pf px) + pure (pf px) getPure (Select x y) = do px <- getPure x py <- getPure y - return (either py id px) + pure (either py id px) getEffects :: Query a -> ([Prompt], [FilePath]) getEffects (Terminal p) = ([p], [] ) diff --git a/selective.cabal b/selective.cabal index 7ef4544..4c77e2e 100644 --- a/selective.cabal +++ b/selective.cabal @@ -11,7 +11,7 @@ bug-reports: https://github.com/snowleopard/selective/issues category: Control build-type: Simple cabal-version: 1.18 -tested-with: GHC==9.2, GHC==9.0, GHC==8.10, GHC==8.8, GHC==8.6 +tested-with: GHC==9.4.4, GHC==9.2, GHC==9.0, GHC==8.10, GHC==8.8, GHC==8.6 description: Selective applicative functors: declare your effects statically, select which to execute dynamically. . diff --git a/src/Control/Selective.hs b/src/Control/Selective.hs index 80a91c6..1d6b9d3 100644 --- a/src/Control/Selective.hs +++ b/src/Control/Selective.hs @@ -274,7 +274,7 @@ matchS (Cases cs _) x f = foldr (\c -> eliminate c (f c)) (Left <$> x) cs matchM :: Monad m => Cases a -> m a -> (a -> m b) -> m (Either a b) matchM (Cases _ p) mx f = do x <- mx - if p x then Right <$> f x else return (Left x) + if p x then Right <$> f x else pure (Left x) -- TODO: Add a type-safe version based on @KnownNat@. -- | A restricted version of monadic bind. Fails with an error if the 'Bounded'