diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3800b98..c5aad19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,19 +17,22 @@ jobs: strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - cabal: ["3.8"] + cabal: ['latest'] ghc: - - "8.2.2" - - "8.4.4" - - "8.6.5" - - "8.8.4" - - "8.10.7" - - "9.0.2" - - "9.2.4" - - "9.4.2" + - '8.2.2' + - '8.4.4' + - '8.6.5' + - '8.8.4' + - '8.10.7' + - '9.0.2' + - '9.2.8' + - '9.4.7' + - '9.6.2' exclude: - os: macOS-latest - ghc: 9.2.4 + ghc: 9.4.7 + - os: macOS-latest + ghc: 9.2.8 - os: macOS-latest ghc: 9.0.2 - os: macOS-latest @@ -44,7 +47,9 @@ jobs: ghc: 8.2.2 - os: windows-latest - ghc: 9.2.4 + ghc: 9.4.7 + - os: windows-latest + ghc: 9.2.8 - os: windows-latest ghc: 9.0.2 - os: windows-latest @@ -59,41 +64,41 @@ jobs: ghc: 8.2.2 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - uses: haskell/actions/setup@v2 - id: setup-haskell-cabal - name: Setup Haskell - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} + - uses: haskell/actions/setup@v2 + id: setup-haskell-cabal + name: Setup Haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} - - name: Configure - run: | - cabal configure --enable-tests --enable-benchmarks --enable-documentation --test-show-details=direct --write-ghc-environment-files=always + - name: Configure + run: | + cabal configure --enable-tests --enable-benchmarks --enable-documentation --test-show-details=direct --write-ghc-environment-files=always - - name: Freeze - run: | - cabal freeze + - name: Freeze + run: | + cabal freeze - - uses: actions/cache@v3 - name: Cache ~/.cabal/store - with: - path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + - uses: actions/cache@v3 + name: Cache ~/.cabal/store + with: + path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} - - name: Install dependencies - run: | - cabal build all --only-dependencies + - name: Install dependencies + run: | + cabal build all --only-dependencies - - name: Build - run: | - cabal build all + - name: Build + run: | + cabal build all - - name: Test - run: | - cabal test all + - name: Test + run: | + cabal test all - - name: Documentation - run: | - cabal haddock + - name: Documentation + run: | + cabal haddock diff --git a/CHANGELOG.md b/CHANGELOG.md index f7286f3..10d3aff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,102 +3,107 @@ `co-log-core` uses [PVP Versioning][1]. The change log is available [on GitHub][2]. +## 0.x.y.z — Unreleased + +- [#29](https://github.com/co-log/co-log-core/issues/29): + Support GHC-9.6. + ## 0.3.2.0 — Nov 2, 2022 -* [#25](https://github.com/co-log/co-log-core/issues/25): +- [#25](https://github.com/co-log/co-log-core/issues/25): Support GHC-9.4. ## 0.3.1.0 — Feb 15, 2022 -* [#7](https://github.com/co-log/co-log-core/issues/7): +- [#7](https://github.com/co-log/co-log-core/issues/7): Support GHC-9.2. -* [#13](https://github.com/co-log/co-log-core/issues/13): +- [#13](https://github.com/co-log/co-log-core/issues/13): Add `WithSeverity` and `mapSeverity` to `Colog.Severity`. ## 🎃 0.3.0.0 — Oct 29, 2021 -* [#223](https://github.com/co-log/co-log/pull/223): +- [#223](https://github.com/co-log/co-log/pull/223): Support GHC-9.0.1. -* [#176](https://github.com/co-log/co-log/issues/176): +- [#176](https://github.com/co-log/co-log/issues/176): Add `logFlush` action to flush the given `Handle`. - __Breaking change:__ All `withLog*File` functions how flush handle + **Breaking change:** All `withLog*File` functions how flush handle after logging each message. Now you'll see logs in the file immediately. - __Migration guide:__ If you rely on the previous behaviour, then + **Migration guide:** If you rely on the previous behaviour, then copy-paste corresponding functions and remove flushing. -* Update maintainers information to the new +- Update maintainers information to the new [Co-Log](https://github.com/co-log) organization. ## 0.2.1.1 — Apr 18, 2020 -* [#186](https://github.com/kowainik/co-log/issues/186): +- [#186](https://github.com/kowainik/co-log/issues/186): Support GHC-8.10.1. ## 0.2.1.0 — Jan 19, 2020 -* [#139](https://github.com/kowainik/co-log/issues/139): +- [#139](https://github.com/kowainik/co-log/issues/139): Add (unrepresentable) `Functor` instance for `LogAction` with the custom type-error. (by [@vrom911](https://github.com/vrom911)) -* [#148](https://github.com/kowainik/co-log/issues/148): +- [#148](https://github.com/kowainik/co-log/issues/148): Support GHC-8.8.2. (by [@chshersh](https://github.com/chshersh)) -* [#122](https://github.com/kowainik/co-log/issues/122): +- [#122](https://github.com/kowainik/co-log/issues/122): Add the `separate` combinator. (by [@vrom911](https://github.com/vrom911)) -* [#125](https://github.com/kowainik/co-log/issues/125): +- [#125](https://github.com/kowainik/co-log/issues/125): Add monadic versions of contravariant functions. (by [@piq9117](https://github.com/piq9117)) -* [#138](https://github.com/kowainik/co-log/issues/138): +- [#138](https://github.com/kowainik/co-log/issues/138): Add `hoistLogAction` — higher-order transformation function. (by [@jiribenes](https://github.com/jiribenes)) -* [#123](https://github.com/kowainik/co-log/issues/123): +- [#123](https://github.com/kowainik/co-log/issues/123): Write default implementation to `getLogAction` via `logActionL`. (by [@SanchayanMaity](https://github.com/SanchayanMaity)) ## 0.2.0.0 — May 5, 2019 -* [#85](https://github.com/kowainik/co-log/issues/85): +- [#85](https://github.com/kowainik/co-log/issues/85): Move `overLogAction` to `HasLog` typeclass -* [#101](https://github.com/kowainik/co-log/issues/101): +- [#101](https://github.com/kowainik/co-log/issues/101): Add `logActionL` lens with default implementation to `HasLog` type class. -* [#99](https://github.com/kowainik/co-log/issues/99): +- [#99](https://github.com/kowainik/co-log/issues/99): Add comonadic combinators: `duplicate` and `multiplicate`. -* [#78](https://github.com/kowainik/co-log/issues/78): +- [#78](https://github.com/kowainik/co-log/issues/78): Improve documentation significantly. ## 0.1.1 — Nov 15, 2018 -* [#63](https://github.com/kowainik/co-log/issues/63): +- [#63](https://github.com/kowainik/co-log/issues/63): Add `logPrint`, `logPrintStderr`, `logPrintHandle` and `withLogPrintFile` to `Colog.Core.IO`. -* [#46](https://github.com/kowainik/co-log/issues/46): +- [#46](https://github.com/kowainik/co-log/issues/46): Moves `logStringStdout`, `logStringStderr`, `logStringHandle`, `withLogStringFile` from `Colog.Actions` to `Colog.Core.IO`. -* [#48](https://github.com/kowainik/co-log/issues/48): +- [#48](https://github.com/kowainik/co-log/issues/48): Adds `liftLogIO` function. -* [#49](https://github.com/kowainik/co-log/issues/49): +- [#49](https://github.com/kowainik/co-log/issues/49): Add `<&` and `&>`operators for `unLogAction`. -* [#47](https://github.com/kowainik/co-log/issues/47): +- [#47](https://github.com/kowainik/co-log/issues/47): Add `doctest` tests. -* [#13](https://github.com/kowainik/co-log/issues/13): +- [#13](https://github.com/kowainik/co-log/issues/13): Add `.cabal` file description and improve documentation. -* [#39](https://github.com/kowainik/co-log/issues/39): +- [#39](https://github.com/kowainik/co-log/issues/39): Support GHC-8.2.2 and GHC-8.6.2. ## 0.1.0 -* [#38](https://github.com/kowainik/co-log/issues/38): +- [#38](https://github.com/kowainik/co-log/issues/38): Rename `cbind` to `cmapM`. -* [#37](https://github.com/kowainik/co-log/issues/37): +- [#37](https://github.com/kowainik/co-log/issues/37): Add `base` bounds. ## 0.0.0 -* Initially created. +- Initially created. [1]: https://pvp.haskell.org [2]: https://github.com/kowainik/co-log/releases diff --git a/co-log-core.cabal b/co-log-core.cabal index d597392..329ca99 100644 --- a/co-log-core.cabal +++ b/co-log-core.cabal @@ -27,7 +27,7 @@ license: MPL-2.0 license-file: LICENSE author: Dmitrii Kovanikov maintainer: Kowainik -copyright: 2018-2020 Kowainik, 2021-2022 Co-Log +copyright: 2018-2020 Kowainik, 2021-2023 Co-Log category: Logging, Contravariant, Comonad build-type: Simple stability: stable @@ -39,15 +39,16 @@ tested-with: GHC == 8.2.2 GHC == 8.8.4 GHC == 8.10.7 GHC == 9.0.2 - GHC == 9.2.4 - GHC == 9.4.2 + GHC == 9.2.8 + GHC == 9.4.7 + GHC == 9.6.2 source-repository head type: git location: https://github.com/co-log/co-log-core.git common common-options - build-depends: base >= 4.10.1.0 && < 4.18 + build-depends: base >= 4.10.1.0 && < 4.19 ghc-options: -Wall -Wcompat @@ -69,6 +70,9 @@ common common-options if impl(ghc >= 9.2) ghc-options: -Wredundant-bang-patterns -Woperator-whitespace + if impl(ghc >= 9.4) + ghc-options: -Wredundant-strictness-flags + -Wforall-identifier default-language: Haskell2010 default-extensions: ConstraintKinds diff --git a/src/Colog/Core.hs b/src/Colog/Core.hs index 1c8437a..4677fe9 100644 --- a/src/Colog/Core.hs +++ b/src/Colog/Core.hs @@ -1,6 +1,6 @@ {- | Module : Colog.Core -Copyright : (c) 2018-2020 Kowainik, 2021-2022 Co-Log +Copyright : (c) 2018-2020 Kowainik, 2021-2023 Co-Log SPDX-License-Identifier : MPL-2.0 Maintainer : Co-Log Stability : Stable diff --git a/src/Colog/Core/Action.hs b/src/Colog/Core/Action.hs index 048893a..d8dd2a1 100644 --- a/src/Colog/Core/Action.hs +++ b/src/Colog/Core/Action.hs @@ -7,7 +7,7 @@ {- | Module : Colog.Core.Action -Copyright : (c) 2018-2020 Kowainik, 2021-2022 Co-Log +Copyright : (c) 2018-2020 Kowainik, 2021-2023 Co-Log SPDX-License-Identifier : MPL-2.0 Maintainer : Co-Log Stability : Stable @@ -66,15 +66,15 @@ module Colog.Core.Action , hoistLogAction ) where -import Control.Monad (when, (<=<), (>=>)) -import Data.Coerce (coerce) -import Data.Foldable (fold, for_, traverse_) -import Data.Kind (Constraint) -import Data.List.NonEmpty (NonEmpty (..)) -import Data.Monoid (Monoid (..)) -import Data.Semigroup (Semigroup (..), stimesMonoid) -import Data.Void (Void, absurd) -import GHC.TypeLits (ErrorMessage (..), TypeError) +import Control.Monad (when, (<=<), (>=>)) +import Data.Coerce (coerce) +import Data.Foldable (fold, for_, traverse_) +import Data.Kind (Constraint) +import Data.List.NonEmpty (NonEmpty (..)) +import Data.Monoid (Monoid (..)) +import Data.Semigroup (Semigroup (..), stimesMonoid) +import Data.Void (Void, absurd) +import GHC.TypeLits (ErrorMessage (..), TypeError) #if MIN_VERSION_base(4,12,0) import qualified Data.Functor.Contravariant as Contravariant @@ -167,12 +167,12 @@ type family UnrepresentableClass :: Constraint where UnrepresentableClass = TypeError ( 'Text "'LogAction' cannot have a 'Functor' instance by design." - ':$$: 'Text "However, you've attempted to use this instance." + ' :$$: 'Text "However, you've attempted to use this instance." #if MIN_VERSION_base(4,12,0) - ':$$: 'Text "" - ':$$: 'Text "Probably you meant 'Contravariant' class instance with the following methods:" - ':$$: 'Text " * contramap :: (a -> b) -> LogAction m b -> LogAction m a" - ':$$: 'Text " * (>$) :: b -> LogAction m b -> LogAction m a" + ' :$$: 'Text "" + ' :$$: 'Text "Probably you meant 'Contravariant' class instance with the following methods:" + ' :$$: 'Text " * contramap :: (a -> b) -> LogAction m b -> LogAction m a" + ' :$$: 'Text " * (>$) :: b -> LogAction m b -> LogAction m a" #endif ) diff --git a/src/Colog/Core/Class.hs b/src/Colog/Core/Class.hs index 2d74960..ddecf89 100644 --- a/src/Colog/Core/Class.hs +++ b/src/Colog/Core/Class.hs @@ -4,7 +4,7 @@ {- | Module : Colog.Core.Class -Copyright : (c) 2018-2020 Kowainik, 2021-2022 Co-Log +Copyright : (c) 2018-2020 Kowainik, 2021-2023 Co-Log SPDX-License-Identifier : MPL-2.0 Maintainer : Co-Log Stability : Stable @@ -21,7 +21,7 @@ module Colog.Core.Class , Lens' ) where -import Colog.Core.Action (LogAction) +import Colog.Core.Action (LogAction) import Data.Functor.Const (Const (..)) diff --git a/src/Colog/Core/IO.hs b/src/Colog/Core/IO.hs index 618a209..a3a9bc8 100644 --- a/src/Colog/Core/IO.hs +++ b/src/Colog/Core/IO.hs @@ -2,7 +2,7 @@ {- | Module : Colog.Core.IO -Copyright : (c) 2018-2020 Kowainik, 2021-2022 Co-Log +Copyright : (c) 2018-2020 Kowainik, 2021-2023 Co-Log SPDX-License-Identifier : MPL-2.0 Maintainer : Co-Log Stability : Stable @@ -33,10 +33,11 @@ module Colog.Core.IO , logFlush ) where -import Colog.Core.Action (LogAction (..)) +import Colog.Core.Action (LogAction (..)) import Control.Monad.IO.Class (MonadIO, liftIO) -import Data.Semigroup ((<>)) -import System.IO (Handle, IOMode (AppendMode), hFlush, hPrint, hPutStrLn, stderr, withFile) +import Data.Semigroup ((<>)) +import System.IO (Handle, IOMode (AppendMode), hFlush, hPrint, + hPutStrLn, stderr, withFile) {- $setup