diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 18e3b80..6b463f8 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -14,17 +14,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - cabal: ["3.8"] - ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.4", "9.4.2"] + ghc: ["8.8", "8.10", "9.0", "9.2", "9.4", "9.6"] + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{matrix.ghc}} + cancel-in-progress: true env: CONFIG: "--enable-tests" steps: - uses: actions/checkout@v3 - - uses: haskell/actions/setup@v2.3 + - uses: haskell-actions/setup@v2.5.1 id: setup-haskell-cabal with: ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} + cabal-update: false - run: cabal v2-update - run: cabal v2-freeze $CONFIG - uses: actions/cache@v3 diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 36e7c38..963e5d7 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -16,9 +16,13 @@ jobs: fail-fast: false matrix: ghc: - - ghc902 - - ghc924 - - ghc942 + - ghc90 + - ghc92 + - ghc94 + - ghc96 + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.ghc }} + cancel-in-progress: true steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v19 diff --git a/flake.lock b/flake.lock index b40eca7..a810dd6 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1675942811, - "narHash": "sha256-/v4Z9mJmADTpXrdIlAjFa1e+gkpIIROR670UVDQFwIw=", + "lastModified": 1697059129, + "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "724bfc0892363087709bd3a5a1666296759154b1", + "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 607e432..7db8b29 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ }: let systems = ["aarch64-darwin" "x86_64-darwin" "x86_64-linux"]; - haskells = ["ghc902" "ghc924" "ghc942"]; + haskells = ["ghc90" "ghc92" "ghc94" "ghc96"]; eachSystem = nixpkgs.lib.genAttrs systems; @@ -20,16 +20,35 @@ latestHaskell = nixpkgs.lib.last haskells; pkgsBySystem = eachSystem (system: nixpkgs.legacyPackages.${system}); + + haskellPackages = eachSystem ( + system: let + pkgs = pkgsBySystem.${system}; + inherit (pkgs.haskell.lib) appendPatch; + in + eachHaskell ( + haskell: + pkgs.haskell.packages.${haskell}.override (prev: { + overrides = _: hprev: { + # Wants bytestring <0.12 + cmark-gfm = appendPatch hprev.cmark-gfm ./nix/cmark-gfm-cabal.patch; + }; + }) + ) + ); in { packages = eachSystem ( system: let - pkgs = pkgsBySystem.${system}; - - moats = builtins.listToAttrs (map (haskell: { - name = "moat-${haskell}"; - value = pkgs.haskell.packages.${haskell}.callPackage ./moat.nix {}; + moats = + nixpkgs.lib.mapAttrs' + (n: v: { + name = "moat-${n}"; + value = v; }) - haskells); + (eachHaskell ( + haskell: + haskellPackages.${system}.${haskell}.callPackage ./moat.nix {} + )); in moats // {default = moats."moat-${latestHaskell}";} ); @@ -37,40 +56,10 @@ devShells = eachSystem ( system: let pkgs = pkgsBySystem.${system}; - inherit - (pkgs.haskell.lib) - dontCheck - overrideCabal - ; - - enableSeparateBinOutput = drv: - if (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) - then overrideCabal drv (_: {enableSeparateBinOutput = false;}) - else drv; - - haskellOverlays = { - ghc902 = hself: hsuper: { - # Wants cabal == 3.6 - fourmolu = hsuper.fourmolu.overrideScope (lself: lsuper: { - Cabal = lself.Cabal_3_6_3_0; - }); - }; - ghc924 = hself: hsuper: { - # https://github.com/NixOS/nixpkgs/issues/140774 - ghcid = enableSeparateBinOutput hsuper.ghcid; - hls-fourmolu-plugin = dontCheck hsuper.hls-fourmolu-plugin; - }; - ghc942 = hself: hsuper: { - # https://github.com/NixOS/nixpkgs/issues/140774 - ghcid = dontCheck (enableSeparateBinOutput hsuper.ghcid); - }; - }; shells = eachHaskell ( haskell: let - hsPkgs = pkgs.haskell.packages.${haskell}.override (prev: { - overrides = haskellOverlays.${haskell}; - }); + hsPkgs = haskellPackages.${system}.${haskell}; in pkgs.mkShell { name = "moat-${haskell}-shell"; diff --git a/moat.cabal b/moat.cabal index 6202ed9..dfd9eab 100644 --- a/moat.cabal +++ b/moat.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.1. +-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack @@ -54,7 +54,7 @@ library , primitive >=0.6.4 && <0.9 , template-haskell >=2.11 && <2.21 , text >=1.2 && <2.1 - , th-abstraction >=0.3 && <0.6 + , th-abstraction >=0.3 && <0.7 , th-compat >=0.1.0 && <0.2 , time >=1.8 && <1.13 , unordered-containers ==0.2.* @@ -130,7 +130,7 @@ test-suite spec , primitive >=0.6.4 && <0.9 , template-haskell >=2.11 && <2.21 , text >=1.2 && <2.1 - , th-abstraction >=0.3 && <0.6 + , th-abstraction >=0.3 && <0.7 , th-compat >=0.1.0 && <0.2 , time >=1.8 && <1.13 , unordered-containers ==0.2.* diff --git a/nix/cmark-gfm-cabal.patch b/nix/cmark-gfm-cabal.patch new file mode 100644 index 0000000..ad6e628 --- /dev/null +++ b/nix/cmark-gfm-cabal.patch @@ -0,0 +1,13 @@ +diff --git a/cmark-gfm.cabal b/cmark-gfm.cabal +index 23277d8..4fc84b7 100644 +--- a/cmark-gfm.cabal ++++ b/cmark-gfm.cabal +@@ -69,7 +69,7 @@ library + exposed-modules: CMarkGFM + build-depends: base >=4.5 && < 5.0, + text >= 1.0 && < 2.1, +- bytestring >= 0.11.5 && < 0.12 ++ bytestring + if impl(ghc < 7.6) + build-depends: ghc-prim >= 0.2 + default-language: Haskell2010 diff --git a/package.yaml b/package.yaml index 1f18319..b5ec750 100644 --- a/package.yaml +++ b/package.yaml @@ -26,7 +26,7 @@ dependencies: - primitive >= 0.6.4 && < 0.9 - template-haskell >= 2.11 && < 2.21 - text >= 1.2 && < 2.1 - - th-abstraction >= 0.3 && < 0.6 + - th-abstraction >= 0.3 && < 0.7 - th-compat >= 0.1.0 && < 0.2 - time >= 1.8 && < 1.13 - unordered-containers >= 0.2 && < 0.3 diff --git a/src/Moat.hs b/src/Moat.hs index da5d17c..9864114 100644 --- a/src/Moat.hs +++ b/src/Moat.hs @@ -734,12 +734,12 @@ consToMoatType o@Options {..} parentName parentDoc instTys variant ts bs = \case else mkNewtypeInstance o parentDoc instTys con Newtype -> do if - | newtypeTag -> do - mkTypeTag o parentName instTys con - | typeAlias -> do - mkTypeAlias parentName parentDoc instTys con - | otherwise -> do - mkNewtype o parentName parentDoc instTys con + | newtypeTag -> do + mkTypeTag o parentName instTys con + | typeAlias -> do + mkTypeAlias parentName parentDoc instTys con + | otherwise -> do + mkNewtype o parentName parentDoc instTys con _ -> do mkProd o parentName parentDoc instTys ts con _ -> do