diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2477ff75..4a7a8823 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: ghc: - ghc-9-2 - ghc-9-4 + - ghc-9-6 runs-on: ${{ matrix.runner.os }} steps: - name: Install Nix diff --git a/nix/common-haskell-overrides.nix b/nix/common-haskell-overrides.nix new file mode 100644 index 00000000..72c146cd --- /dev/null +++ b/nix/common-haskell-overrides.nix @@ -0,0 +1,28 @@ +{ sources, pkgs }: +self: super: + let + packageFromSources = name: self.callCabal2nix name sources."${name}" { }; + in { + # todo: resolve breaking changes in brick >= 0.72, also jailbreak + # to allow ghc 9.4.x + brick = + pkgs.haskell.lib.doJailbreak (self.callHackage "brick" "0.71.1" { }); + + # >= 5.39 has breaking changes for brick@0.71.1; pin to 5.38 (known-good) + vty = self.callHackage "vty" "5.38" { }; + + # latest master supports ghc 9.4.x + tasty-test-reporter = packageFromSources "tasty-test-reporter"; + + # latest master supports ghc 9.4.x + string-qq = packageFromSources "string-qq"; + + # jailbreak to allow text >= 2 + pretty-diff = pkgs.haskell.lib.doJailbreak super.pretty-diff; + + # servant-auth-server 0.4.8.0 is marked as broken in nixpkgs but it should be fine + servant-auth-server = pkgs.haskell.lib.markUnbroken super.servant-auth-server; + + # for now, pin hw-kafka-client to 4.0.3; nixpkgs@release-24.05 provides 5.3.0 + hw-kafka-client = self.callHackage "hw-kafka-client" "4.0.3" { }; + } \ No newline at end of file diff --git a/nix/mk-shell.nix b/nix/mk-shell.nix index 61dfe68c..429a8943 100644 --- a/nix/mk-shell.nix +++ b/nix/mk-shell.nix @@ -7,14 +7,6 @@ let workaround140774 = hpkg: with pkgs.haskell.lib; overrideCabal hpkg (drv: { enableSeparateBinOutput = false; }); - # It is still necessary to run `hpack --force` into packages home dirs - haskell-language-server = - pkgs.haskellPackages.haskell-language-server.override { - hls-ormolu-plugin = pkgs.haskellPackages.hls-ormolu-plugin.override { - ormolu = (workaround140774 pkgs.haskellPackages.ormolu); - }; - }; - in pkgs.mkShell { buildInputs = [ (haskellPackages.ghcWithPackages (haskellPackages: @@ -76,7 +68,7 @@ in pkgs.mkShell { pkgs.cabal-install pkgs.cachix pkgs.gnumake - haskell-language-server + pkgs.haskellPackages.haskell-language-server pkgs.haskellPackages.hpack pkgs.pcre pkgs.postgresql # for nri-postgres diff --git a/nix/sources.json b/nix/sources.json index 2654d946..588c66ab 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -12,15 +12,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "release-23.11", + "branch": "release-24.05", "description": "Nix Packages collection", "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a149706fa833be1b3906eaae60230e0fbfdd067d", - "sha256": "1b3nywv7idiyq3j2vz5gr3vbfh3q4v4gw2qf7vpd5sb652f36g8x", + "rev": "59be168c1fcab339bab5fd482d93c995f470cbad", + "sha256": "0am4h3ck2as4lq7b37zlxah8zqm57scjl06y5xkk9islh3jvklmf", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a149706fa833be1b3906eaae60230e0fbfdd067d.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/59be168c1fcab339bab5fd482d93c995f470cbad.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs-unstable": { diff --git a/nri-env-parser/CHANGELOG.md b/nri-env-parser/CHANGELOG.md index 9e5a060c..b695667f 100644 --- a/nri-env-parser/CHANGELOG.md +++ b/nri-env-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.2.0.1 + +- Drop support for `aeson-1.x` +- Support GHC 9.6.5 + # 0.2.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-env-parser/nri-env-parser.cabal b/nri-env-parser/nri-env-parser.cabal index 49bc1e48..316573ab 100644 --- a/nri-env-parser/nri-env-parser.cabal +++ b/nri-env-parser/nri-env-parser.cabal @@ -1,11 +1,11 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-env-parser -version: 0.2.0.0 +version: 0.2.0.1 synopsis: Read environment variables as settings to build 12-factor apps. description: Please see the README at . category: Web @@ -50,7 +50,7 @@ library TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin build-depends: - base >=4.16.4.0 && <4.18 + base >=4.16.4.0 && <4.19 , modern-uri >=0.3.1.0 && <0.4 , network-uri >=2.6.2.0 && <2.8 , nri-prelude >=0.1.0.0 && <0.7 @@ -83,7 +83,7 @@ test-suite tests ExtendedDefaultRules ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin -threaded -rtsopts "-with-rtsopts=-N -T" -fno-warn-type-defaults build-depends: - base >=4.16.4.0 && <4.18 + base >=4.16.4.0 && <4.19 , modern-uri >=0.3.1.0 && <0.4 , network-uri >=2.6.2.0 && <2.8 , nri-prelude >=0.1.0.0 && <0.7 diff --git a/nri-env-parser/package.yaml b/nri-env-parser/package.yaml index 9a2cac26..f47bd00c 100644 --- a/nri-env-parser/package.yaml +++ b/nri-env-parser/package.yaml @@ -3,7 +3,7 @@ synopsis: Read environment variables as settings to build 12-factor apps. description: Please see the README at . homepage: https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-env-parser#readme author: NoRedInk -version: 0.2.0.0 +version: 0.2.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries/env-parser @@ -15,7 +15,7 @@ extra-doc-files: - CHANGELOG.md library: dependencies: &dependencies - - base >= 4.16.4.0 && < 4.18 + - base >= 4.16.4.0 && < 4.19 - nri-prelude >= 0.1.0.0 && < 0.7 - modern-uri >= 0.3.1.0 && < 0.4 - network-uri >= 2.6.2.0 && < 2.8 diff --git a/nri-http/CHANGELOG.md b/nri-http/CHANGELOG.md index f1f4e498..a73359d8 100644 --- a/nri-http/CHANGELOG.md +++ b/nri-http/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.5.0.1 + +- Drop support for `aeson-1.x` +- Support GHC 9.6.5 + # 0.5.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-http/nri-http.cabal b/nri-http/nri-http.cabal index f159e6fc..02ecf9f6 100644 --- a/nri-http/nri-http.cabal +++ b/nri-http/nri-http.cabal @@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-http -version: 0.5.0.0 +version: 0.5.0.1 synopsis: Make Elm style HTTP requests description: Please see the README at . category: Web @@ -54,8 +54,8 @@ library NumericUnderscores ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin build-depends: - aeson >=1.4.6.0 && <2.2 - , base >=4.16.4.0 && <4.18 + aeson >=2.0 && <2.2 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , case-insensitive >=1.1 && <2.0 , conduit >=1.3.0 && <1.4 @@ -100,8 +100,8 @@ test-suite spec NumericUnderscores ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin -fno-warn-type-defaults build-depends: - aeson >=1.4.6.0 && <2.1 - , base >=4.12.0.0 && <4.17 + aeson >=2.0 && <2.2 + , base >=4.12.0.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , case-insensitive >=1.1 && <2.0 , conduit >=1.3.0 && <1.4 diff --git a/nri-http/package.yaml b/nri-http/package.yaml index bc28b838..3038b4d0 100644 --- a/nri-http/package.yaml +++ b/nri-http/package.yaml @@ -2,7 +2,7 @@ name: nri-http synopsis: Make Elm style HTTP requests description: Please see the README at . author: NoRedInk -version: 0.5.0.0 +version: 0.5.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries/nri-http @@ -14,8 +14,8 @@ extra-source-files: - "test/golden-results-*/*" library: dependencies: - - aeson >= 1.4.6.0 && < 2.2 - - base >= 4.16.4.0 && < 4.18 + - aeson >= 2.0 && < 2.2 + - base >= 4.16.4.0 && < 4.19 - bytestring >= 0.10.8.2 && < 0.12 - nri-prelude >= 0.1.0.0 && < 0.7 - nri-observability >= 0.1.0.0 && < 0.3 @@ -35,8 +35,8 @@ library: tests: spec: dependencies: - - aeson >= 1.4.6.0 && < 2.1 - - base >= 4.12.0.0 && < 4.17 + - aeson >= 2.0 && < 2.2 + - base >= 4.12.0.0 && < 4.19 - bytestring >= 0.10.8.2 && < 0.12 - nri-prelude >= 0.1.0.0 && < 0.7 - nri-observability >= 0.1.0.0 && < 0.2 diff --git a/nri-kafka/CHANGELOG.md b/nri-kafka/CHANGELOG.md index 1e03f4c6..c41c51ac 100644 --- a/nri-kafka/CHANGELOG.md +++ b/nri-kafka/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.2.0.1 + +- Drop support for `aeson-1.x` +- Support GHC 9.6.5 + # 0.2.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-kafka/nri-kafka.cabal b/nri-kafka/nri-kafka.cabal index 295cc198..47f90ca4 100644 --- a/nri-kafka/nri-kafka.cabal +++ b/nri-kafka/nri-kafka.cabal @@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-kafka -version: 0.2.0.0 +version: 0.2.0.1 synopsis: Functions for working with Kafka description: Please see the README at . category: Web @@ -67,9 +67,9 @@ library TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fno-warn-type-defaults -fplugin=NriPrelude.Plugin build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 , containers >=0.6.0.1 && <0.7 @@ -81,7 +81,7 @@ library , stm >=2.4 && <2.6 , text >=1.2.3.1 && <2.1 , time >=1.8.0.2 && <2 - , unix >=2.7.2.2 && <2.8.0.0 + , unix >=2.7.2.2 && <2.9 , uuid >=1.3.0 && <1.4 default-language: Haskell2010 @@ -111,9 +111,9 @@ executable pause-resume-bug-consumer TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fno-warn-type-defaults -fplugin=NriPrelude.Plugin -threaded -rtsopts "-with-rtsopts=-N -T" -O2 -main-is Consumer build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 , containers >=0.6.0.1 && <0.7 @@ -126,7 +126,7 @@ executable pause-resume-bug-consumer , stm >=2.4 && <2.6 , text >=1.2.3.1 && <2.1 , time >=1.8.0.2 && <2 - , unix >=2.7.2.2 && <2.8.0.0 + , unix >=2.7.2.2 && <2.9 , uuid >=1.3.0 && <1.4 default-language: Haskell2010 if flag(pause-resume-bug) @@ -160,9 +160,9 @@ executable pause-resume-bug-producer TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fno-warn-type-defaults -fplugin=NriPrelude.Plugin -main-is Producer build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 , containers >=0.6.0.1 && <0.7 @@ -175,7 +175,7 @@ executable pause-resume-bug-producer , stm >=2.4 && <2.6 , text >=1.2.3.1 && <2.1 , time >=1.8.0.2 && <2 - , unix >=2.7.2.2 && <2.8.0.0 + , unix >=2.7.2.2 && <2.9 , uuid >=1.3.0 && <1.4 default-language: Haskell2010 if flag(pause-resume-bug) @@ -224,9 +224,9 @@ test-suite tests TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fno-warn-type-defaults -fplugin=NriPrelude.Plugin -threaded -rtsopts "-with-rtsopts=-N -T" -fno-warn-type-defaults build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 , containers >=0.6.0.1 && <0.7 @@ -238,6 +238,6 @@ test-suite tests , stm >=2.4 && <2.6 , text >=1.2.3.1 && <2.1 , time >=1.8.0.2 && <2 - , unix >=2.7.2.2 && <2.8.0.0 + , unix >=2.7.2.2 && <2.9 , uuid >=1.3.0 && <1.4 default-language: Haskell2010 diff --git a/nri-kafka/package.yaml b/nri-kafka/package.yaml index 12f702e0..e4385e17 100644 --- a/nri-kafka/package.yaml +++ b/nri-kafka/package.yaml @@ -3,7 +3,7 @@ synopsis: Functions for working with Kafka description: Please see the README at . homepage: https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-kafka#readme author: NoRedInk -version: 0.2.0.0 +version: 0.2.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries/nri-kafka @@ -14,9 +14,9 @@ extra-source-files: - LICENSE - CHANGELOG.md dependencies: - - aeson >= 1.4.6.0 && < 2.2 + - aeson >= 2.0 && < 2.2 - async >=2.2.2 && <2.3 - - base >= 4.16.4.0 && < 4.18 + - base >= 4.16.4.0 && < 4.19 - bytestring >= 0.10.8.2 && < 0.12 - conduit >= 1.3.0 && < 1.4 - containers >= 0.6.0.1 && < 0.7 @@ -28,7 +28,7 @@ dependencies: - stm >= 2.4 && < 2.6 - text >= 1.2.3.1 && < 2.1 - time >= 1.8.0.2 && < 2 - - unix >= 2.7.2.2 && < 2.8.0.0 + - unix >= 2.7.2.2 && < 2.9 - uuid >=1.3.0 && < 1.4 library: exposed-modules: diff --git a/nri-log-explorer/CHANGELOG.md b/nri-log-explorer/CHANGELOG.md index 4140af96..1504becb 100644 --- a/nri-log-explorer/CHANGELOG.md +++ b/nri-log-explorer/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.2.0.1 + +- Drop support for `aeson-1.x` +- Support GHC 9.6.5 + # 0.2.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-log-explorer/nri-log-explorer.cabal b/nri-log-explorer/nri-log-explorer.cabal index 21f8df1e..128cd5c0 100644 --- a/nri-log-explorer/nri-log-explorer.cabal +++ b/nri-log-explorer/nri-log-explorer.cabal @@ -1,11 +1,11 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-log-explorer -version: 0.2.0.0 +version: 0.2.0.1 synopsis: Explore logs produced by nri-prelude tests. description: Please see the README at . category: Web @@ -29,7 +29,6 @@ source-repository head executable log-explorer main-is: Main.hs other-modules: - AesonHelpers Filterable Paths_nri_log_explorer hs-source-dirs: @@ -50,10 +49,10 @@ executable log-explorer TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -threaded -rtsopts "-with-rtsopts=-N -T -xq10m" -O2 -fplugin=NriPrelude.Plugin build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , aeson-pretty >=0.8.0 && <0.9 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , brick >=0.51 && <0.72 , bytestring >=0.10.8.2 && <0.12 , directory >=1.3.3.0 && <1.4 diff --git a/nri-log-explorer/package.yaml b/nri-log-explorer/package.yaml index efbc03f2..de41fd31 100644 --- a/nri-log-explorer/package.yaml +++ b/nri-log-explorer/package.yaml @@ -3,7 +3,7 @@ synopsis: Explore logs produced by nri-prelude tests. description: Please see the README at . homepage: https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-log-explorer#readme author: NoRedInk -version: 0.2.0.0 +version: 0.2.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries @@ -16,10 +16,10 @@ extra-doc-files: executables: log-explorer: dependencies: - - aeson >= 1.4.6.0 && < 2.2 + - aeson >= 2.0 && < 2.2 - aeson-pretty >= 0.8.0 && < 0.9 - async >= 2.2.2 && < 2.3 - - base >= 4.16.4.0 && < 4.18 + - base >= 4.16.4.0 && < 4.19 - brick >= 0.51 && < 0.72 - bytestring >= 0.10.8.2 && < 0.12 - directory >= 1.3.3.0 && < 1.4 diff --git a/nri-log-explorer/src/AesonHelpers.hs b/nri-log-explorer/src/AesonHelpers.hs deleted file mode 100644 index 56f72857..00000000 --- a/nri-log-explorer/src/AesonHelpers.hs +++ /dev/null @@ -1,43 +0,0 @@ -{-# LANGUAGE CPP #-} - --- | This module supports working with aeson objects in a way compatible with --- both the 1.x and 2.x versions of the aeson library. --- --- Aeson has a Value type for representing JSON values. The Value type has --- constructors for JSON strings, numbers, arrays, and objects. Aeson represents --- JSON objects using an Object type, which in versions 1.x of aeson is a type --- alias for a HashMap. Version 2.x of library make Object an opaque type. --- --- nri-observability needs to perform some operations on JSON objects. Depending --- on which version of aeson we got, we need to use different functions to --- perform these operations. This module contains implementations for both 1.x --- and 2.x versions of Aeson, and automatically picks the right version --- depending on which version of the library is detected. --- --- Once we're done supporting versions 1.x of aeson we can drop this module and --- inline the 2.x versions of functions wherever they are called. -module AesonHelpers (hashMapFromObject, textFromKey) where - -import qualified Data.Aeson.Types as Types -import qualified Data.HashMap.Strict as HashMap - -#if MIN_VERSION_aeson(2,0,0) - -import qualified Data.Aeson.Key as Key -import qualified Data.Aeson.KeyMap as KeyMap - -hashMapFromObject :: Types.Object -> HashMap.HashMap Key.Key Types.Value -hashMapFromObject object = KeyMap.toHashMap object - -textFromKey :: Key.Key -> Text -textFromKey key = Key.toText key - -#else - -hashMapFromObject :: Types.Object -> HashMap.HashMap Key.Key Types.Value -hashMapFromObject object = object - -textFromKey :: Text -> Text -textFromKey key = key - -#endif diff --git a/nri-log-explorer/src/Main.hs b/nri-log-explorer/src/Main.hs index f5ca44b0..a4104ff8 100644 --- a/nri-log-explorer/src/Main.hs +++ b/nri-log-explorer/src/Main.hs @@ -7,7 +7,6 @@ module Main ) where -import AesonHelpers (hashMapFromObject, textFromKey) import qualified Brick import qualified Brick.BChan import Brick.Types (ViewportType (..)) @@ -21,6 +20,8 @@ import qualified Control.Exception.Safe as Exception import Control.Monad.IO.Class (liftIO) import qualified Data.Aeson as Aeson import qualified Data.Aeson.Encode.Pretty +import Data.Aeson.Key (toText) +import Data.Aeson.KeyMap (toHashMap) import qualified Data.ByteString as ByteString import qualified Data.HashMap.Strict as HashMap import qualified Data.Text @@ -1065,11 +1066,11 @@ viewSpanDetails Span {original} = |> Data.Text.Lazy.toStrict ) Just (Aeson.Object object) -> - HashMap.toList (hashMapFromObject object) + HashMap.toList (toHashMap object) |> List.map ( \(name, val) -> viewDetail - (textFromKey name) + (toText name) ( case Aeson.toJSON val of Aeson.Null -> "Null" Aeson.String str -> str diff --git a/nri-observability/CHANGELOG.md b/nri-observability/CHANGELOG.md index 20421a39..0ed54ddb 100644 --- a/nri-observability/CHANGELOG.md +++ b/nri-observability/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.2.0.1 + +- Drop support for `aeson-1.x` +- Support GHC 9.6.5 + # 0.2.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-observability/nri-observability.cabal b/nri-observability/nri-observability.cabal index 9aaba90e..ebb6c94a 100644 --- a/nri-observability/nri-observability.cabal +++ b/nri-observability/nri-observability.cabal @@ -1,11 +1,11 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-observability -version: 0.2.0.0 +version: 0.2.0.1 synopsis: Report log spans collected by nri-prelude. description: Please see the README at . category: Web @@ -65,10 +65,10 @@ library TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , aeson-pretty >=0.8.0 && <0.9 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bugsnag-hs >=0.1.0.0 && <0.3 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 @@ -134,10 +134,10 @@ test-suite tests ExtendedDefaultRules ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin -threaded -rtsopts "-with-rtsopts=-N -T" -fno-warn-type-defaults build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , aeson-pretty >=0.8.0 && <0.9 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bugsnag-hs >=0.1.0.0 && <0.3 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 diff --git a/nri-observability/package.yaml b/nri-observability/package.yaml index 6b856a90..a2dc5e55 100644 --- a/nri-observability/package.yaml +++ b/nri-observability/package.yaml @@ -3,7 +3,7 @@ synopsis: Report log spans collected by nri-prelude. description: Please see the README at . homepage: https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-observability#readme author: NoRedInk -version: 0.2.0.0 +version: 0.2.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries/observability @@ -14,10 +14,10 @@ extra-doc-files: - LICENSE - CHANGELOG.md dependencies: - - aeson >= 1.4.6.0 && < 2.2 + - aeson >= 2.0 && < 2.2 - aeson-pretty >= 0.8.0 && < 0.9 - async >= 2.2.2 && < 2.3 - - base >= 4.16.4.0 && < 4.18 + - base >= 4.16.4.0 && < 4.19 - bugsnag-hs >= 0.1.0.0 && < 0.3 - bytestring >= 0.10.8.2 && < 0.12 - conduit >= 1.3.0 && < 1.4 diff --git a/nri-observability/src/Platform/AesonHelpers.hs b/nri-observability/src/Platform/AesonHelpers.hs index 37dfeabc..9658cb92 100644 --- a/nri-observability/src/Platform/AesonHelpers.hs +++ b/nri-observability/src/Platform/AesonHelpers.hs @@ -1,24 +1,4 @@ -{-# LANGUAGE CPP #-} - --- | This module supports working with aeson objects in a way compatible with --- both the 1.x and 2.x versions of the aeson library. --- --- Aeson has a Value type for representing JSON values. The Value type has --- constructors for JSON strings, numbers, arrays, and objects. Aeson represents --- JSON objects using an Object type, which in versions 1.x of aeson is a type --- alias for a HashMap. Version 2.x of library make Object an opaque type. --- --- nri-observability needs to perform some operations on JSON objects. Depending --- on which version of aeson we got, we need to use different functions to --- perform these operations. This module contains implementations for both 1.x --- and 2.x versions of Aeson, and automatically picks the right version --- depending on which version of the library is detected. --- --- Once we're done supporting versions 1.x of aeson we can drop this module and --- inline the 2.x versions of functions wherever they are called. -module Platform.AesonHelpers (foldObject, mergeObjects, keyFromText, singleton, emptyObject) where - -#if MIN_VERSION_aeson(2,0,0) +module Platform.AesonHelpers (foldObject, singleton) where import qualified Data.Aeson as Aeson import qualified Data.Aeson.Key as Key @@ -27,44 +7,5 @@ import qualified Data.Aeson.KeyMap as KeyMap foldObject :: (Text -> Aeson.Value -> acc -> acc) -> acc -> Aeson.Object -> acc foldObject fn = KeyMap.foldrWithKey (\key val acc -> fn (Key.toText key) val acc) -mergeObjects :: - (Aeson.Value -> Aeson.Value -> Aeson.Value) -> - Aeson.Object -> - Aeson.Object -> - Aeson.Object -mergeObjects = KeyMap.unionWith - -keyFromText :: Text -> Key.Key -keyFromText key = Key.fromText key - -singleton :: Text -> Aeson.Value -> Aeson.Object -singleton key = KeyMap.singleton (keyFromText key) - -emptyObject :: Aeson.Object -emptyObject = KeyMap.empty - -#else - -import qualified Data.Aeson as Aeson -import qualified Data.HashMap.Strict as HashMap - -foldObject :: (Text -> Aeson.Value -> acc -> acc) -> acc -> Aeson.Object -> acc -foldObject = HashMap.foldrWithKey - -mergeObjects :: - (Aeson.Value -> Aeson.Value -> Aeson.Value) -> - Aeson.Object -> - Aeson.Object -> - Aeson.Object -mergeObjects merge object1 object2 = HashMap.unionWith merge object1 object2 - -keyFromText :: Text -> Text -keyFromText key = key - singleton :: Text -> Aeson.Value -> Aeson.Object -singleton = HashMap.singleton - -emptyObject :: Aeson.Object -emptyObject = HashMap.empty - -#endif +singleton key = KeyMap.singleton (Key.fromText key) diff --git a/nri-observability/src/Reporter/Bugsnag/Internal.hs b/nri-observability/src/Reporter/Bugsnag/Internal.hs index 7e31f3a5..6701ec01 100644 --- a/nri-observability/src/Reporter/Bugsnag/Internal.hs +++ b/nri-observability/src/Reporter/Bugsnag/Internal.hs @@ -7,6 +7,8 @@ module Reporter.Bugsnag.Internal where import qualified Control.Exception.Safe as Exception import Data.Aeson ((.=)) import qualified Data.Aeson as Aeson +import qualified Data.Aeson.Key as Key +import qualified Data.Aeson.KeyMap as KeyMap import qualified Data.HashMap.Strict as HashMap import qualified Data.List import qualified Data.Proxy as Proxy @@ -374,14 +376,14 @@ renderLog event details = { Bugsnag.event_metaData = Aeson.toJSON details |> AesonHelpers.singleton "custom" - |> AesonHelpers.mergeObjects + |> KeyMap.unionWith mergeJson - (Bugsnag.event_metaData event |> Maybe.withDefault AesonHelpers.emptyObject) + (Bugsnag.event_metaData event |> Maybe.withDefault KeyMap.empty) |> Just } mergeJson :: Aeson.Value -> Aeson.Value -> Aeson.Value -mergeJson (Aeson.Object x) (Aeson.Object y) = Aeson.Object (AesonHelpers.mergeObjects mergeJson x y) +mergeJson (Aeson.Object x) (Aeson.Object y) = Aeson.Object (KeyMap.unionWith mergeJson x y) mergeJson _ last = last mergeMetaData :: @@ -390,7 +392,7 @@ mergeMetaData :: Maybe Aeson.Object mergeMetaData Nothing x = x mergeMetaData x Nothing = x -mergeMetaData (Just x) (Just y) = Just (AesonHelpers.mergeObjects mergeJson x y) +mergeMetaData (Just x) (Just y) = Just (KeyMap.unionWith mergeJson x y) renderIncomingHttpRequest :: Bugsnag.Event -> @@ -415,11 +417,11 @@ renderIncomingHttpRequest event (HttpRequest.Incoming request) = Bugsnag.event_metaData = mergeMetaData (Bugsnag.event_metaData event) - ( [ AesonHelpers.keyFromText "endpoint" .= HttpRequest.endpoint request, - AesonHelpers.keyFromText "http version" .= HttpRequest.httpVersion request, - AesonHelpers.keyFromText "response status" .= HttpRequest.status request, - AesonHelpers.keyFromText "path" .= HttpRequest.path request, - AesonHelpers.keyFromText "query string" .= HttpRequest.queryString request + ( [ Key.fromText "endpoint" .= HttpRequest.endpoint request, + Key.fromText "http version" .= HttpRequest.httpVersion request, + Key.fromText "response status" .= HttpRequest.status request, + Key.fromText "path" .= HttpRequest.path request, + Key.fromText "query string" .= HttpRequest.queryString request ] |> Aeson.object |> AesonHelpers.singleton "request" diff --git a/nri-postgresql/CHANGELOG.md b/nri-postgresql/CHANGELOG.md index 2941a36a..ab577b40 100644 --- a/nri-postgresql/CHANGELOG.md +++ b/nri-postgresql/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.2.0.1 + +- Drop support for `aeson-1.x` +- Allow `resourcet-1.3.x` +- Support GHC 9.6.5 + # 0.2.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-postgresql/nri-postgresql.cabal b/nri-postgresql/nri-postgresql.cabal index 545c4680..799245f2 100644 --- a/nri-postgresql/nri-postgresql.cabal +++ b/nri-postgresql/nri-postgresql.cabal @@ -1,11 +1,11 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-postgresql -version: 0.2.0.0 +version: 0.2.0.1 synopsis: Make queries against Postgresql. description: Please see the README at . category: Web @@ -18,7 +18,7 @@ license: BSD3 license-file: LICENSE build-type: Simple extra-source-files: - test/golden-results/observability-spec-postgres-reporting + test/golden-results/observability-spec-postgres-reporting-ghc-9 extra-doc-files: README.md LICENSE @@ -62,7 +62,7 @@ library ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin build-depends: attoparsec >=0.13.0.0 && <0.15 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , filepath >=1.4.2.1 && <1.5 , network >=3.1.0.0 && <3.2 @@ -71,9 +71,9 @@ library , nri-prelude >=0.1.0.0 && <0.7 , postgresql-typed ==0.6.* , resource-pool >=0.2.0.0 && <0.5 - , resourcet >=1.2.0 && <1.3 + , resourcet >=1.2.0 && <1.4 , safe-exceptions >=0.1.7.0 && <1.3 - , template-haskell >=2.15.0.0 && <2.20 + , template-haskell >=2.15.0.0 && <2.21 , text >=1.2.3.1 && <2.1 , time >=1.8.0.2 && <2 default-language: Haskell2010 @@ -120,7 +120,7 @@ test-suite tests ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin -threaded -rtsopts "-with-rtsopts=-N -T" -fno-warn-type-defaults build-depends: attoparsec >=0.13.0.0 && <0.15 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , filepath >=1.4.2.1 && <1.5 , network >=3.1.0.0 && <3.2 @@ -129,9 +129,9 @@ test-suite tests , nri-prelude >=0.1.0.0 && <0.7 , postgresql-typed ==0.6.* , resource-pool >=0.2.0.0 && <0.5 - , resourcet >=1.2.0 && <1.3 + , resourcet >=1.2.0 && <1.4 , safe-exceptions >=0.1.7.0 && <1.3 - , template-haskell >=2.15.0.0 && <2.20 + , template-haskell >=2.15.0.0 && <2.21 , text >=1.2.3.1 && <2.1 , th-test-utils , time >=1.8.0.2 && <2 diff --git a/nri-postgresql/package.yaml b/nri-postgresql/package.yaml index bcda916a..289a0ee3 100644 --- a/nri-postgresql/package.yaml +++ b/nri-postgresql/package.yaml @@ -3,7 +3,7 @@ synopsis: Make queries against Postgresql. description: Please see the README at . homepage: https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-postgresql#readme author: NoRedInk -version: 0.2.0.0 +version: 0.2.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries/postgresql @@ -17,7 +17,7 @@ extra-source-files: - "test/golden-results/*" dependencies: - attoparsec >= 0.13.0.0 && < 0.15 -- base >= 4.16.4.0 && < 4.18 +- base >= 4.16.4.0 && < 4.19 - bytestring >= 0.10.8.2 && < 0.12 - filepath >= 1.4.2.1 && < 1.5 - network >= 3.1.0.0 && < 3.2 @@ -26,9 +26,9 @@ dependencies: - nri-prelude >= 0.1.0.0 && < 0.7 - postgresql-typed >= 0.6 && < 0.7 - resource-pool >= 0.2.0.0 && < 0.5 -- resourcet >= 1.2.0 && < 1.3 +- resourcet >= 1.2.0 && < 1.4 - safe-exceptions >= 0.1.7.0 && < 1.3 -- template-haskell >= 2.15.0.0 && < 2.20 +- template-haskell >= 2.15.0.0 && < 2.21 - text >= 1.2.3.1 && < 2.1 - time >= 1.8.0.2 && < 2 default-extensions: diff --git a/nri-postgresql/src/Postgres/Enum.hs b/nri-postgresql/src/Postgres/Enum.hs index 3a517d8e..e6d599a8 100644 --- a/nri-postgresql/src/Postgres/Enum.hs +++ b/nri-postgresql/src/Postgres/Enum.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} -- | Provides a functionality for generating a bridge between a Haskell type and a Postgres enum type using Template Haskell. @@ -255,18 +254,13 @@ generatePGEnum hsTypeName databaseTypeName mapping = do -- Labeled -> "labeled" -- Blank -> "blank" -#if __GLASGOW_HASKELL__ >= 902 - let conP conName = TH.ConP conName [] [] -#else - let conP conName = TH.ConP conName [] -#endif let hsToPg = TH.CaseE (TH.VarE varX) ( mapping |> List.map ( \(conName, pgValue) -> - TH.Match (conP conName) (TH.NormalB <| TH.LitE <| TH.StringL <| Text.toList pgValue) [] + TH.Match (TH.ConP conName [] []) (TH.NormalB <| TH.LitE <| TH.StringL <| Text.toList pgValue) [] ) ) diff --git a/nri-postgresql/src/Postgres/QueryParser.hs b/nri-postgresql/src/Postgres/QueryParser.hs index f9f9c8af..f5cb0be6 100644 --- a/nri-postgresql/src/Postgres/QueryParser.hs +++ b/nri-postgresql/src/Postgres/QueryParser.hs @@ -14,7 +14,6 @@ import Control.Applicative import Control.Monad (void) import Data.Attoparsec.Text (Parser, anyChar, asciiCI, char, inClass, manyTill, skipSpace, space, takeWhile) import qualified Data.Attoparsec.Text as Attoparsec -import Data.Foldable (asum) import qualified List import qualified Maybe import qualified Text diff --git a/nri-prelude/CHANGELOG.md b/nri-prelude/CHANGELOG.md index f2c946f9..b44897d4 100644 --- a/nri-prelude/CHANGELOG.md +++ b/nri-prelude/CHANGELOG.md @@ -1,8 +1,10 @@ # Unreleased -- Drop support for GHC 8.10.7 +- Drop support for GHC 8.10.7, `aeson-1.x` +- Support GHC 9.6.5 - Allow specifying where devlogs for log-explorer go through `NRI_DEV_LOG` environment variable. - Added `putText` and `putTextLn` functions for thread-safe console printing. +- Allow `hedgehog-1.4.x` # 0.6.1.2 diff --git a/nri-prelude/nri-prelude.cabal b/nri-prelude/nri-prelude.cabal index b8ce088c..eeb05b3a 100644 --- a/nri-prelude/nri-prelude.cabal +++ b/nri-prelude/nri-prelude.cabal @@ -1,6 +1,6 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack @@ -53,7 +53,6 @@ library Text Tuple other-modules: - Internal.AesonHelpers Internal.IO Internal.Shortcut Internal.Terminal @@ -92,14 +91,14 @@ library , async >=2.2.2 && <2.3 , attoparsec >=0.13.0.0 && <0.15 , auto-update >=0.1.6 && <0.2 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , containers >=0.6.0.1 && <0.7 , directory >=1.3.3.0 && <1.4 , exceptions >=0.10.4 && <0.11 , filepath >=1.4.2.1 && <1.5 , ghc >=8.6.1 && <9.8 - , hedgehog >=1.0.2 && <1.3 + , hedgehog >=1.0.2 && <1.5 , junit-xml >=0.1.0.0 && <0.2.0.0 , lens >=4.16.1 && <5.3 , pretty-diff >=0.4.0.2 && <0.5 @@ -110,7 +109,7 @@ library , terminal-size >=0.3.2.1 && <0.4 , text >=1.2.3.1 && <2.1 , time >=1.8.0.2 && <2 - , unix >=2.7.2.2 && <2.8.0.0 + , unix >=2.7.2.2 && <2.9 , vector >=0.12.1.2 && <0.14 default-language: Haskell2010 @@ -137,7 +136,6 @@ test-suite tests Dict Expect Fuzz - Internal.AesonHelpers Internal.IO Internal.Shortcut Internal.Terminal @@ -191,14 +189,14 @@ test-suite tests , async >=2.2.2 && <2.3 , attoparsec >=0.13.0.0 && <0.15 , auto-update >=0.1.6 && <0.2 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , containers >=0.6.0.1 && <0.7 , directory >=1.3.3.0 && <1.4 , exceptions >=0.10.4 && <0.11 , filepath >=1.4.2.1 && <1.5 , ghc >=8.6.1 && <9.8 - , hedgehog >=1.0.2 && <1.3 + , hedgehog >=1.0.2 && <1.5 , junit-xml >=0.1.0.0 && <0.2.0.0 , lens >=4.16.1 && <5.3 , pretty-diff >=0.4.0.2 && <0.5 @@ -209,6 +207,6 @@ test-suite tests , terminal-size >=0.3.2.1 && <0.4 , text >=1.2.3.1 && <2.1 , time >=1.8.0.2 && <2 - , unix >=2.7.2.2 && <2.8.0.0 + , unix >=2.7.2.2 && <2.9 , vector >=0.12.1.2 && <0.14 default-language: Haskell2010 diff --git a/nri-prelude/package.yaml b/nri-prelude/package.yaml index 9d7300ab..e0ced374 100644 --- a/nri-prelude/package.yaml +++ b/nri-prelude/package.yaml @@ -17,19 +17,19 @@ extra-doc-files: - licenses/ELM_TEST_LICENSE library: dependencies: &dependencies - - aeson >= 1.4.6.0 && < 2.2 + - aeson >= 2.0 && < 2.2 - aeson-pretty >= 0.8.0 && < 0.9 - async >= 2.2.2 && < 2.3 - attoparsec >= 0.13.0.0 && < 0.15 - auto-update >= 0.1.6 && < 0.2 - - base >= 4.16.4.0 && < 4.18 + - base >= 4.16.4.0 && < 4.19 - bytestring >= 0.10.8.2 && < 0.12 - containers >= 0.6.0.1 && < 0.7 - directory >= 1.3.3.0 && < 1.4 - exceptions >= 0.10.4 && < 0.11 - filepath >= 1.4.2.1 && < 1.5 - ghc >= 8.6.1 && < 9.8 - - hedgehog >= 1.0.2 && < 1.3 + - hedgehog >= 1.0.2 && < 1.5 - junit-xml >= 0.1.0.0 && < 0.2.0.0 - lens >=4.16.1 && <5.3 - pretty-diff >= 0.4.0.2 && < 0.5 @@ -40,7 +40,7 @@ library: - terminal-size >= 0.3.2.1 && < 0.4 - text >= 1.2.3.1 && < 2.1 - time >= 1.8.0.2 && < 2 - - unix >= 2.7.2.2 && < 2.8.0.0 + - unix >= 2.7.2.2 && < 2.9 - vector >= 0.12.1.2 && < 0.14 exposed-modules: - Array diff --git a/nri-prelude/src/Internal/AesonHelpers.hs b/nri-prelude/src/Internal/AesonHelpers.hs deleted file mode 100644 index 20a8583e..00000000 --- a/nri-prelude/src/Internal/AesonHelpers.hs +++ /dev/null @@ -1,37 +0,0 @@ -{-# LANGUAGE CPP #-} - --- | This module supports working with aeson objects in a way compatible with --- both the 1.x and 2.x versions of the aeson library. --- --- Aeson has a Value type for representing JSON values. The Value type has --- constructors for JSON strings, numbers, arrays, and objects. Aeson represents --- JSON objects using an Object type, which in versions 1.x of aeson is a type --- alias for a HashMap. Version 2.x of library make Object an opaque type. --- --- nri-observability needs to perform some operations on JSON objects. Depending --- on which version of aeson we got, we need to use different functions to --- perform these operations. This module contains implementations for both 1.x --- and 2.x versions of Aeson, and automatically picks the right version --- depending on which version of the library is detected. --- --- Once we're done supporting versions 1.x of aeson we can drop this module and --- inline the 2.x versions of functions wherever they are called. -module Internal.AesonHelpers (keyFromText) where - -#if MIN_VERSION_aeson(2,0,0) - -import qualified Data.Aeson.Key as Key -import Text - -keyFromText :: Text -> Key.Key -keyFromText key = Key.fromText key - - -#else - -import Text - -keyFromText :: Text -> Text -keyFromText key = key - -#endif diff --git a/nri-prelude/src/Log.hs b/nri-prelude/src/Log.hs index b700c02c..3878b904 100644 --- a/nri-prelude/src/Log.hs +++ b/nri-prelude/src/Log.hs @@ -32,7 +32,7 @@ where import Data.Aeson ((.=)) import qualified Data.Aeson as Aeson import qualified GHC.Stack as Stack -import Internal.AesonHelpers (keyFromText) +import Data.Aeson.Key (fromText) import NriPrelude import qualified Platform import qualified Platform.Internal as Internal @@ -162,12 +162,12 @@ newtype LogContexts instance Aeson.ToJSON LogContexts where toJSON (LogContexts contexts) = contexts - |> map (\(Context key val) -> (keyFromText key) .= val) + |> map (\(Context key val) -> (fromText key) .= val) |> Aeson.object toEncoding (LogContexts contexts) = contexts - |> Prelude.foldMap (\(Context key val) -> (keyFromText key) .= val) + |> Prelude.foldMap (\(Context key val) -> (fromText key) .= val) |> Aeson.pairs instance Internal.TracingSpanDetails LogContexts diff --git a/nri-prelude/src/NriPrelude/Plugin.hs b/nri-prelude/src/NriPrelude/Plugin.hs index 63ae1d9b..05b5c158 100644 --- a/nri-prelude/src/NriPrelude/Plugin.hs +++ b/nri-prelude/src/NriPrelude/Plugin.hs @@ -18,32 +18,16 @@ where -- Useful documentation -- - Elm's default imports: https://package.elm-lang.org/packages/elm/core/latest/ -- - GHC user guide on compiler plugins: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/extending_ghc.html#compiler-plugins --- - Module providing API for creating plugins: https://www.stackage.org/haddock/lts-17.4/ghc-lib-8.10.4.20210206/GhcPlugins.html +-- - Module providing API for creating plugins: https://hackage.haskell.org/package/ghc-lib-9.6.5.20240423/docs/GHC-Plugins.html import Data.Function ((&)) import qualified Data.List -#if __GLASGOW_HASKELL__ >= 900 -import qualified GHC.Plugins as GhcPlugins -#if __GLASGOW_HASKELL__ >= 902 -import qualified GHC.Hs as GhcPlugins (HsParsedModule (..)) -#endif -#else -import qualified GhcPlugins -#endif +import qualified GHC.Hs +import qualified GHC.Parser.Annotation +import qualified GHC.Plugins -import NriPrelude.Plugin.GhcVersionDependent - ( hsmodImports, - hsmodName, - ideclImplicit, - ideclName, - ideclQualified, - isQualified, - mkQualified, - noLoc, - simpleImportDecl, - withParsedResult - ) +import NriPrelude.Plugin.GhcVersionDependent (setIDeclImplicit, withParsedResult) import qualified Set import Prelude @@ -54,36 +38,36 @@ import Prelude -- then add the follwing ghc option to your cabal or package yaml file: -- -- > -fplugin=NriPrelude.Plugin -plugin :: GhcPlugins.Plugin +plugin :: GHC.Plugins.Plugin plugin = - GhcPlugins.defaultPlugin - { GhcPlugins.parsedResultAction = addImplicitImports, + GHC.Plugins.defaultPlugin + { GHC.Plugins.parsedResultAction = addImplicitImports, -- Let GHC know this plugin doesn't perform arbitrary IO. Given the same -- input file it will make the same changes. Without this GHC will -- recompile modules using this plugin every time which is expensive. - GhcPlugins.pluginRecompile = GhcPlugins.purePlugin + GHC.Plugins.pluginRecompile = GHC.Plugins.purePlugin } addImplicitImports :: - [GhcPlugins.CommandLineOption] -> - GhcPlugins.ModSummary -> + [GHC.Plugins.CommandLineOption] -> + GHC.Plugins.ModSummary -> #if __GLASGOW_HASKELL__ >= 904 - GhcPlugins.ParsedResult -> - GhcPlugins.Hsc GhcPlugins.ParsedResult + GHC.Plugins.ParsedResult -> + GHC.Plugins.Hsc GHC.Plugins.ParsedResult #else - GhcPlugins.HsParsedModule -> - GhcPlugins.Hsc GhcPlugins.HsParsedModule + GHC.Hs.HsParsedModule -> + GHC.Plugins.Hsc GHC.Hs.HsParsedModule #endif addImplicitImports _ _ parsed = Prelude.pure $ withParsedResult parsed $ \parsed' -> parsed' - { GhcPlugins.hpm_module = - fmap addImportsWhenNotPath (GhcPlugins.hpm_module parsed') + { GHC.Hs.hpm_module = + fmap addImportsWhenNotPath (GHC.Hs.hpm_module parsed') } where addImportsWhenNotPath hsModule = - case fmap unLocate (hsmodName hsModule) of + case fmap unLocate (GHC.Hs.hsmodName hsModule) of Nothing -> addImports hsModule Just modName -> if Data.List.isPrefixOf "Paths_" modName @@ -92,10 +76,10 @@ addImplicitImports _ _ parsed = addImports hsModule = hsModule - { hsmodImports = + { GHC.Hs.hsmodImports = -- Add default Elm-like imports when the user hasn't imported them -- explicitly yet, in order to avoid duplicate import warnings. - hsmodImports hsModule + GHC.Hs.hsmodImports hsModule ++ ( Set.diff extraImports (existingImports hsModule) & Set.toList & fmap @@ -108,22 +92,32 @@ addImplicitImports _ _ parsed = } existingImports hsModule = - hsmodImports hsModule + GHC.Hs.hsmodImports hsModule & fmap - ( \(GhcPlugins.L _ imp) -> - case (isQualified imp, unLocate (ideclName imp)) of + ( \(GHC.Plugins.L _ imp) -> + case (isQualified imp, unLocate (GHC.Hs.ideclName imp)) of (True, name) -> Qualified name (False, name) -> Unqualified name ) & Set.fromList - unLocate (GhcPlugins.L _ x) = GhcPlugins.moduleNameString x + unLocate (GHC.Plugins.L _ x) = GHC.Plugins.moduleNameString x unqualified name = - noLoc (simpleImportDecl (GhcPlugins.mkModuleName name)) - & fmap (\qual -> qual {ideclImplicit = True}) + GHC.Parser.Annotation.noLocA (GHC.Hs.simpleImportDecl (GHC.Plugins.mkModuleName name)) + & fmap (setIDeclImplicit True) qualified name = - fmap (\qual -> qual {ideclQualified = mkQualified}) (unqualified name) + fmap (\qual -> qual {GHC.Hs.ideclQualified = GHC.Hs.QualifiedPre}) (unqualified name) + +-- There's more than one way to do a qualified import. See: +-- https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/import_qualified_post.html + +isQualified :: GHC.Hs.ImportDecl pass -> Bool +isQualified imp = + case GHC.Hs.ideclQualified imp of + GHC.Hs.QualifiedPre -> True + GHC.Hs.QualifiedPost -> True + GHC.Hs.NotQualified -> False data Import = Unqualified String diff --git a/nri-prelude/src/NriPrelude/Plugin/GhcVersionDependent.hs b/nri-prelude/src/NriPrelude/Plugin/GhcVersionDependent.hs index d0c335cb..d8957232 100644 --- a/nri-prelude/src/NriPrelude/Plugin/GhcVersionDependent.hs +++ b/nri-prelude/src/NriPrelude/Plugin/GhcVersionDependent.hs @@ -1,83 +1,46 @@ {-# LANGUAGE CPP #-} --- A couple of imports we need to write this module have been moved in GHC --- version 8.10. This module uses the CPP extension to import the right values --- dependent on the version of GHC. - -#if __GLASGOW_HASKELL__ >= 810 +-- Imports we need to write this module tend to move around in later +-- versions of GHC. This module uses the CPP extension to import the +-- right values dependent on the version of GHC. module NriPrelude.Plugin.GhcVersionDependent ( - module GHC.Hs, - isQualified, - mkQualified, - noLoc, + setIDeclImplicit, withParsedResult ) where -import GHC.Hs +import qualified GHC.Hs +import qualified GHC.Hs.ImpExp import Prelude #if __GLASGOW_HASKELL__ >= 904 import qualified GHC.Driver.Plugins #endif -#if __GLASGOW_HASKELL__ >= 902 -import qualified GHC.Parser.Annotation -#elif __GLASGOW_HASKELL__ >= 900 -import GHC.Types.SrcLoc (noLoc) -#else -import GhcPlugins (HsParsedModule) -import SrcLoc (noLoc) -#endif - -#if __GLASGOW_HASKELL__ >= 902 -noLoc :: a -> GHC.Parser.Annotation.LocatedAn an a -noLoc = noLocA -#endif - --- There's more than one way to do a qualified import. See: --- https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/import_qualified_post.html - -isQualified :: ImportDecl pass -> Bool -isQualified imp = - case ideclQualified imp of - QualifiedPre -> True - QualifiedPost -> True - NotQualified -> False - -mkQualified :: ImportDeclQualifiedStyle -mkQualified = QualifiedPre #if __GLASGOW_HASKELL__ >= 904 -withParsedResult :: GHC.Driver.Plugins.ParsedResult -> (HsParsedModule -> HsParsedModule) -> GHC.Driver.Plugins.ParsedResult +withParsedResult :: GHC.Driver.Plugins.ParsedResult -> (GHC.Hs.HsParsedModule -> GHC.Hs.HsParsedModule) -> GHC.Driver.Plugins.ParsedResult withParsedResult parsed f = parsed { GHC.Driver.Plugins.parsedResultModule = f (GHC.Driver.Plugins.parsedResultModule parsed) } #else -withParsedResult :: HsParsedModule -> (HsParsedModule -> HsParsedModule) -> HsParsedModule +withParsedResult :: GHC.Hs.HsParsedModule -> (GHC.Hs.HsParsedModule -> GHC.Hs.HsParsedModule) -> GHC.Hs.HsParsedModule withParsedResult parsed f = f parsed #endif +#if __GLASGOW_HASKELL__ >= 906 +setIDeclImplicit :: Bool -> GHC.Hs.ImpExp.ImportDecl GHC.Hs.GhcPs -> GHC.Hs.ImpExp.ImportDecl GHC.Hs.GhcPs +setIDeclImplicit isImplicit importDecl = + -- no idea what `XImportDeclPass` _is_, btw. just following types + -- ref: https://hackage.haskell.org/package/ghc-9.6.5/docs/Language-Haskell-Syntax-ImpExp.html#t:ImportDecl + -- https://hackage.haskell.org/package/ghc-9.6.5/docs/Language-Haskell-Syntax-Extension.html#t:XCImportDecl + -- https://hackage.haskell.org/package/ghc-9.6.5/docs/GHC-Hs-ImpExp.html#t:XImportDeclPass + let xImportDeclPass = GHC.Hs.ImpExp.ideclExt importDecl + in importDecl + { GHC.Hs.ImpExp.ideclExt = + xImportDeclPass {GHC.Hs.ImpExp.ideclImplicit = isImplicit} + } #else -module NriPrelude.Plugin.GhcVersionDependent ( - module HsSyn, - isQualified, - mkQualified, - noLoc, - withParsedResult -) where - -import GhcPlugins (HsParsedModule, noLoc) -import HsSyn -import Prelude - -isQualified :: ImportDecl pass -> Bool -isQualified = ideclQualified - -mkQualified :: Bool -mkQualified = True - -withParsedResult :: HsParsedModule -> (HsParsedModule -> HsParsedModule) -> HsParsedModule -withParsedResult parsed f = f parsed - +setIDeclImplicit :: Bool -> GHC.Hs.ImpExp.ImportDecl GHC.Hs.GhcPs -> GHC.Hs.ImpExp.ImportDecl GHC.Hs.GhcPs +setIDeclImplicit isImplicit importDecl = importDecl {GHC.Hs.ImpExp.ideclImplicit = isImplicit} #endif diff --git a/nri-redis/CHANGELOG.md b/nri-redis/CHANGELOG.md index 4dac31ac..edf369b8 100644 --- a/nri-redis/CHANGELOG.md +++ b/nri-redis/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.2.0.1 + +- Drop support for `aeson-1.x` +- Allow `resourcet-1.3.x`, `megaparsec-9.5.x` +- Support GHC 9.6.5 + # 0.2.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-redis/nri-redis.cabal b/nri-redis/nri-redis.cabal index a50fdfbb..b7743624 100644 --- a/nri-redis/nri-redis.cabal +++ b/nri-redis/nri-redis.cabal @@ -1,11 +1,11 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-redis -version: 0.2.0.0 +version: 0.2.0.1 synopsis: An intuitive hedis wrapper library. description: Please see the README at . category: Web @@ -63,22 +63,22 @@ library TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fno-warn-type-defaults -fplugin=NriPrelude.Plugin build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 , containers >=0.6.0.1 && <0.7 , cryptohash-sha1 >=0.11.101.0 && <0.12 , haskell-src-meta >=0.8.12 && <0.9 , hedis >=0.14.0 && <0.16 - , megaparsec >=9.2.2 && <9.4 + , megaparsec >=9.2.2 && <9.6 , modern-uri >=0.3.1.0 && <0.4 , nri-env-parser >=0.1.0.0 && <0.3 , nri-observability >=0.1.0 && <0.3 , nri-prelude >=0.1.0.0 && <0.7 , pcre-light >=0.4.1.0 && <0.4.2 - , resourcet >=1.2.0 && <1.3 + , resourcet >=1.2.0 && <1.4 , safe-exceptions >=0.1.7.0 && <1.3 , template-haskell >=2.16 && <3.0 , text >=1.2.3.1 && <2.1 @@ -128,22 +128,22 @@ test-suite tests TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fno-warn-type-defaults -fplugin=NriPrelude.Plugin -threaded -rtsopts "-with-rtsopts=-N -T" -fno-warn-type-defaults build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , async >=2.2.2 && <2.3 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , conduit >=1.3.0 && <1.4 , containers >=0.6.0.1 && <0.7 , cryptohash-sha1 >=0.11.101.0 && <0.12 , haskell-src-meta >=0.8.12 && <0.9 , hedis >=0.14.0 && <0.16 - , megaparsec >=9.2.2 && <9.4 + , megaparsec >=9.2.2 && <9.6 , modern-uri >=0.3.1.0 && <0.4 , nri-env-parser >=0.1.0.0 && <0.3 , nri-observability >=0.1.0 && <0.3 , nri-prelude >=0.1.0.0 && <0.7 , pcre-light >=0.4.1.0 && <0.4.2 - , resourcet >=1.2.0 && <1.3 + , resourcet >=1.2.0 && <1.4 , safe-exceptions >=0.1.7.0 && <1.3 , template-haskell >=2.16 && <3.0 , text >=1.2.3.1 && <2.1 diff --git a/nri-redis/package.yaml b/nri-redis/package.yaml index b2da9535..049c82d4 100644 --- a/nri-redis/package.yaml +++ b/nri-redis/package.yaml @@ -3,7 +3,7 @@ synopsis: An intuitive hedis wrapper library. description: Please see the README at . homepage: https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-redis#readme author: NoRedInk -version: 0.2.0.0 +version: 0.2.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries/nri-redis @@ -14,9 +14,9 @@ extra-doc-files: - LICENSE - CHANGELOG.md dependencies: - - aeson >= 1.4.6.0 && < 2.2 + - aeson >= 2.0 && < 2.2 - async >=2.2.2 && <2.3 - - base >= 4.16.4.0 && < 4.18 + - base >= 4.16.4.0 && < 4.19 - bytestring >= 0.10.8.2 && < 0.12 - conduit >= 1.3.0 && < 1.4 - containers >= 0.6.0.1 && < 0.7 @@ -24,13 +24,13 @@ dependencies: - haskell-src-meta >= 0.8.12 && < 0.9 # hedis 14 introduces redis-cluster support - hedis >= 0.14.0 && < 0.16 - - megaparsec >= 9.2.2 && < 9.4 + - megaparsec >= 9.2.2 && < 9.6 - modern-uri >= 0.3.1.0 && < 0.4 - nri-env-parser >= 0.1.0.0 && < 0.3 - nri-observability >= 0.1.0 && < 0.3 - nri-prelude >= 0.1.0.0 && < 0.7 - pcre-light >= 0.4.1.0 && < 0.4.2 - - resourcet >= 1.2.0 && < 1.3 + - resourcet >= 1.2.0 && < 1.4 - safe-exceptions >= 0.1.7.0 && < 1.3 - text >= 1.2.3.1 && < 2.1 - template-haskell >= 2.16 && < 3.0 diff --git a/nri-redis/test/Helpers.hs b/nri-redis/test/Helpers.hs index 9522e36c..9b939ebc 100644 --- a/nri-redis/test/Helpers.hs +++ b/nri-redis/test/Helpers.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} module Helpers where @@ -22,7 +21,8 @@ getHandlers = do handler <- Handler.handler "tests" settings {Settings.defaultExpiry = Settings.NoDefaultExpiry} Prelude.pure TestHandlers {autoExtendExpireHandler, handler} --- | Golden results are slightly different between GHC 9.2.x and 8.10.x due +-- | Historical context: +-- Golden results are slightly different between GHC 9.2.x and 8.10.x due -- to apparent differences in internal handling of stack frame source locations. -- In particular, the end of a function call now does not extend to the end of -- the line but instead to the end of the function name. E.g. for the following: @@ -34,9 +34,7 @@ getHandlers = do -- In GHC 8.10.x (and possibly GHC 9.0.x?) `srcLocEndLine` and `srcLocEndCol` -- would correspond to the `z` at the end of `baz`. Unfortunately, in GHC 9.2.x -- it corresponds to the second `o` at the end of `foo`. +-- +-- We keep this here in case similar is true in later versions of GHC. goldenResultsDir :: Text -#if __GLASGOW_HASKELL__ >= 902 goldenResultsDir = "test/golden-results-9.2" -#else -goldenResultsDir = "test/golden-results-8.10" -#endif diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-counter-query b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-counter-query deleted file mode 100644 index a44457e7..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-counter-query +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "query" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 105 - , srcLocStartCol = 9 - , srcLocEndLine = 105 - , srcLocEndCol = 68 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-counter-transaction b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-counter-transaction deleted file mode 100644 index 5b14ef76..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-counter-transaction +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "transaction" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 112 - , srcLocStartCol = 9 - , srcLocEndLine = 112 - , srcLocEndCol = 74 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-hash-query b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-hash-query deleted file mode 100644 index dbc01a55..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-hash-query +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "query" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 77 - , srcLocStartCol = 9 - , srcLocEndLine = 77 - , srcLocEndCol = 59 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-hash-transaction b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-hash-transaction deleted file mode 100644 index 18d639d6..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-hash-transaction +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "transaction" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 84 - , srcLocStartCol = 9 - , srcLocEndLine = 84 - , srcLocEndCol = 65 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-list-query b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-list-query deleted file mode 100644 index 8923bfe1..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-list-query +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "query" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 91 - , srcLocStartCol = 9 - , srcLocEndLine = 91 - , srcLocEndCol = 59 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-list-transaction b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-list-transaction deleted file mode 100644 index ad1e253d..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-list-transaction +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "transaction" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 98 - , srcLocStartCol = 9 - , srcLocEndLine = 98 - , srcLocEndCol = 65 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-query b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-query deleted file mode 100644 index 1fcd70c0..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-query +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "query" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 63 - , srcLocStartCol = 9 - , srcLocEndLine = 63 - , srcLocEndCol = 45 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-transaction b/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-transaction deleted file mode 100644 index 345a0841..00000000 --- a/nri-redis/test/golden-results-8.10/observability-spec-reporting-redis-transaction +++ /dev/null @@ -1,51 +0,0 @@ -TracingSpan - { name = "test-root" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "rootTracingSpanIO" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 31 - , srcLocStartCol = 7 - , srcLocEndLine = 35 - , srcLocEndCol = 40 - } - ) - , details = Nothing - , summary = Nothing - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = - [ TracingSpan - { name = "Redis Query" - , started = MonotonicTime { inMicroseconds = 0 } - , finished = MonotonicTime { inMicroseconds = 0 } - , frame = - Just - ( "transaction" - , SrcLoc - { srcLocPackage = "main" - , srcLocModule = "Spec.Redis" - , srcLocFile = "test/Spec/Redis.hs" - , srcLocStartLine = 70 - , srcLocStartCol = 9 - , srcLocEndLine = 70 - , srcLocEndCol = 51 - } - ) - , details = - Just - "{\"commands\":[\"PING\"],\"host\":\"localhost\",\"port\":6379}" - , summary = Just "PING" - , succeeded = Succeeded - , containsFailures = False - , allocated = 0 - , children = [] - } - ] - } \ No newline at end of file diff --git a/nri-test-encoding/CHANGELOG.md b/nri-test-encoding/CHANGELOG.md index f0aab624..b46ee050 100644 --- a/nri-test-encoding/CHANGELOG.md +++ b/nri-test-encoding/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.2.0.1 + +- Drop support for `aeson-1.x` +- Allow `servant-0.20.x` +- Support GHC 9.6.5 + # 0.2.0.0 - Drop support for GHC 8.10.7 diff --git a/nri-test-encoding/nri-test-encoding.cabal b/nri-test-encoding/nri-test-encoding.cabal index ec6782c7..2f6409a7 100644 --- a/nri-test-encoding/nri-test-encoding.cabal +++ b/nri-test-encoding/nri-test-encoding.cabal @@ -1,11 +1,11 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.35.2. +-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: nri-test-encoding -version: 0.2.0.0 +version: 0.2.0.1 synopsis: A library to simplify writing golden tests for encoding types. description: Please see the README at . category: Testing @@ -53,16 +53,16 @@ library TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , aeson-pretty >=0.8.0 && <0.9 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , filepath >=1.4.2.1 && <1.5 , nri-prelude >=0.1.0.0 && <0.7 , nri-redis >=0.1.0.0 && <0.3 - , servant >=0.16.2 && <0.20 + , servant >=0.16.2 && <0.21 , servant-auth-server >=0.4.5.1 && <0.5 - , servant-server >=0.16.2 && <0.20 + , servant-server >=0.16.2 && <0.21 , text >=1.2.3.1 && <2.1 default-language: Haskell2010 @@ -94,15 +94,15 @@ test-suite tests TypeOperators ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wpartial-fields -Wredundant-constraints -Wincomplete-uni-patterns -fplugin=NriPrelude.Plugin -threaded -rtsopts "-with-rtsopts=-N -T" -fno-warn-type-defaults build-depends: - aeson >=1.4.6.0 && <2.2 + aeson >=2.0 && <2.2 , aeson-pretty >=0.8.0 && <0.9 - , base >=4.16.4.0 && <4.18 + , base >=4.16.4.0 && <4.19 , bytestring >=0.10.8.2 && <0.12 , filepath >=1.4.2.1 && <1.5 , nri-prelude >=0.1.0.0 && <0.7 , nri-redis >=0.1.0.0 && <0.3 - , servant >=0.16.2 && <0.20 + , servant >=0.16.2 && <0.21 , servant-auth-server >=0.4.5.1 && <0.5 - , servant-server >=0.16.2 && <0.20 + , servant-server >=0.16.2 && <0.21 , text >=1.2.3.1 && <2.1 default-language: Haskell2010 diff --git a/nri-test-encoding/package.yaml b/nri-test-encoding/package.yaml index b24638f3..aaef4b34 100644 --- a/nri-test-encoding/package.yaml +++ b/nri-test-encoding/package.yaml @@ -3,7 +3,7 @@ synopsis: A library to simplify writing golden tests for encoding types. description: Please see the README at . homepage: https://github.com/NoRedInk/haskell-libraries/tree/trunk/nri-test-encoding#readme author: NoRedInk -version: 0.2.0.0 +version: 0.2.0.1 maintainer: haskell-open-source@noredink.com copyright: 2023 NoRedInk Corp. github: NoRedInk/haskell-libraries/nri-test-encoding @@ -14,14 +14,14 @@ extra-doc-files: - LICENSE - CHANGELOG.md dependencies: - - aeson >= 1.4.6.0 && < 2.2 + - aeson >= 2.0 && < 2.2 - aeson-pretty >=0.8.0 && < 0.9 - - base >= 4.16.4.0 && < 4.18 + - base >= 4.16.4.0 && < 4.19 - bytestring >= 0.10.8.2 && < 0.12 - filepath >= 1.4.2.1 && < 1.5 - - servant >= 0.16.2 && < 0.20 + - servant >= 0.16.2 && < 0.21 - servant-auth-server >= 0.4.5.1 && < 0.5 - - servant-server >= 0.16.2 && < 0.20 + - servant-server >= 0.16.2 && < 0.21 - text >= 1.2.3.1 && < 2.1 - nri-prelude >= 0.1.0.0 && < 0.7 - nri-redis >= 0.1.0.0 && < 0.3 diff --git a/nri-test-encoding/test/Main.hs b/nri-test-encoding/test/Main.hs index 6d812fb4..e2bf0ea6 100644 --- a/nri-test-encoding/test/Main.hs +++ b/nri-test-encoding/test/Main.hs @@ -5,7 +5,6 @@ import Data.Proxy import Examples import qualified Redis import Servant -import Servant.API.Generic ((:-)) import qualified Test import qualified Test.Encoding.Redis import qualified Test.Encoding.Routes diff --git a/shell-ghc-9-2.nix b/shell-ghc-9-2.nix index 4505bf10..06f5cc47 100644 --- a/shell-ghc-9-2.nix +++ b/shell-ghc-9-2.nix @@ -1,33 +1,8 @@ let sources = import ./nix/sources.nix { }; - pkgs = import sources.nixpkgs { }; + commonHaskellOverrides = import ./nix/common-haskell-overrides.nix { inherit sources pkgs; }; in import nix/mk-shell.nix { pkgs = pkgs; - haskellPackages = pkgs.haskell.packages.ghc926.extend (self: super: - let - packageFromSources = name: self.callCabal2nix name sources."${name}" { }; - in { - # todo: resolve breaking changes in brick >= 0.72 - brick = self.callHackage "brick" "0.71.1" { }; - - # tasty-test-reporter is marked as broken, get the same version we use for - # ghc 9.4 - tasty-test-reporter = packageFromSources "tasty-test-reporter"; - - hspec = - pkgs.haskell.lib.doJailbreak (self.callHackage "hspec" "2.8.5" { }); - hspec-discover = self.callHackage "hspec-discover" "2.8.5" { }; - hspec-meta = self.callHackage "hspec-meta" "2.7.8" { }; - - # servant-auth-server 0.4.8.0 is marked as broken in nixpkgs, so jailbreak - # (known good) 0.4.7.0 to make it work - servant-auth-server = pkgs.haskell.lib.doJailbreak - (self.callHackage "servant-auth-server" "0.4.7.0" { }); - servant-auth = pkgs.haskell.lib.doJailbreak super.servant-auth; - - # required by servant-auth-server@0.4.7.0 - jose = pkgs.haskell.lib.dontCheck (self.callHackage "jose" "0.9" { }); - jose-jwt = self.callHackage "jose-jwt" "0.9.5" { }; - }); + haskellPackages = pkgs.haskell.packages.ghc928.extend commonHaskellOverrides; } diff --git a/shell-ghc-9-4.nix b/shell-ghc-9-4.nix index b4b58ec9..f69d59c1 100644 --- a/shell-ghc-9-4.nix +++ b/shell-ghc-9-4.nix @@ -1,34 +1,8 @@ let sources = import ./nix/sources.nix { }; - pkgs = import sources.nixpkgs { }; + commonHaskellOverrides = import ./nix/common-haskell-overrides.nix { inherit sources pkgs; }; in import nix/mk-shell.nix { pkgs = pkgs; - haskellPackages = pkgs.haskell.packages.ghc947.extend (self: super: - let - packageFromSources = name: self.callCabal2nix name sources."${name}" { }; - in { - # todo: resolve breaking changes in brick >= 0.72, also jailbreak - # to allow ghc 9.4.x - brick = - pkgs.haskell.lib.doJailbreak (self.callHackage "brick" "0.71.1" { }); - - # latest master supports ghc 9.4.x - tasty-test-reporter = packageFromSources "tasty-test-reporter"; - - # latest master supports ghc 9.4.x - string-qq = packageFromSources "string-qq"; - - # jailbreak to allow text >= 2 - pretty-diff = pkgs.haskell.lib.doJailbreak super.pretty-diff; - - # servant-auth-server 0.4.8.0 is marked as broken in nixpkgs, so jailbreak - # (known good) 0.4.7.0 to make it work - servant-auth-server = pkgs.haskell.lib.doJailbreak - (self.callHackage "servant-auth-server" "0.4.7.0" { }); - - # required by servant-auth-server@0.4.7.0 - jose = pkgs.haskell.lib.dontCheck (self.callHackage "jose" "0.9" { }); - jose-jwt = self.callHackage "jose-jwt" "0.9.5" { }; - }); + haskellPackages = pkgs.haskell.packages.ghc948.extend commonHaskellOverrides; } diff --git a/shell-ghc-9-6.nix b/shell-ghc-9-6.nix new file mode 100644 index 00000000..5a38c754 --- /dev/null +++ b/shell-ghc-9-6.nix @@ -0,0 +1,8 @@ +let + sources = import ./nix/sources.nix { }; + pkgs = import sources.nixpkgs { }; + commonHaskellOverrides = import ./nix/common-haskell-overrides.nix { inherit sources pkgs; }; +in import nix/mk-shell.nix { + pkgs = pkgs; + haskellPackages = pkgs.haskell.packages.ghc965.extend commonHaskellOverrides; +} diff --git a/shell.nix b/shell.nix index 84149658..25006034 120000 --- a/shell.nix +++ b/shell.nix @@ -1 +1 @@ -shell-ghc-9-4.nix \ No newline at end of file +shell-ghc-9-6.nix \ No newline at end of file