From a4d0d230cd8324e799e1523773d667f4c7e75ccb Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Sun, 30 Oct 2022 21:51:43 -0500 Subject: [PATCH] allow latest versions of dependencies + GHC 9.4 (#752) Update dependencies + add GHC 9.4 to CI. Closes #748 . --- .github/workflows/haskell-ci.yml | 19 ++++++++++++------- cabal.haskell-ci | 2 +- src/Swarm/Game/WorldGen.hs | 6 +++++- stack.yaml | 1 + swarm.cabal | 26 +++++++++++--------------- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index e981f5b07..3ad9fbad7 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -57,6 +57,11 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.4.2 + compilerKind: ghc + compilerVersion: 9.4.2 + setup-method: ghcup + allow-failure: false - compiler: ghc-9.2.4 compilerKind: ghc compilerVersion: 9.2.4 @@ -148,7 +153,7 @@ jobs: - name: cache (tools) uses: actions/cache@v2 with: - key: ${{ runner.os }}-${{ matrix.compiler }}-tools-0ac7885f + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-0367592e path: ~/.haskell-ci-tools - name: install cabal-plan run: | @@ -170,10 +175,10 @@ jobs: cabal-docspec --version - name: install hlint run: | - if [ $((HCNUMVER >= 90200)) -ne 0 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $ARG_COMPILER --dry-run hlint --constraint='hlint >=3.5 && <3.6' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi - if [ $((HCNUMVER >= 90200)) -ne 0 ] ; then if [ ! -e $HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint ]; then echo "Downloading HLint version $HLINTVER"; mkdir -p $HOME/.haskell-ci-tools; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\n' --silent --location --output $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz "https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz"; tar -xzv -f $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz -C $HOME/.haskell-ci-tools; fi ; fi - if [ $((HCNUMVER >= 90200)) -ne 0 ] ; then mkdir -p $CABAL_DIR/bin && ln -sf "$HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint" $CABAL_DIR/bin/hlint ; fi - if [ $((HCNUMVER >= 90200)) -ne 0 ] ; then hlint --version ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $ARG_COMPILER --dry-run hlint --constraint='hlint >=3.5 && <3.6' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then if [ ! -e $HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint ]; then echo "Downloading HLint version $HLINTVER"; mkdir -p $HOME/.haskell-ci-tools; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\n' --silent --location --output $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz "https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz"; tar -xzv -f $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz -C $HOME/.haskell-ci-tools; fi ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then mkdir -p $CABAL_DIR/bin && ln -sf "$HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint" $CABAL_DIR/bin/hlint ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then hlint --version ; fi - name: checkout uses: actions/checkout@v2 with: @@ -233,8 +238,8 @@ jobs: cabal-docspec $ARG_COMPILER - name: hlint run: | - if [ $((HCNUMVER >= 90200)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XBangPatterns -XDeriveAnyClass -XDeriveDataTypeable -XDeriveFunctor -XDeriveGeneric -XDeriveTraversable -XExplicitForAll -XFlexibleContexts -XFlexibleInstances -XGADTSyntax -XMultiParamTypeClasses -XNumericUnderscores -XRankNTypes -XScopedTypeVariables -XStandaloneDeriving -XTupleSections -XTypeApplications -XTypeOperators -XImportQualifiedPost -XLambdaCase -XStrictData src) ; fi - if [ $((HCNUMVER >= 90200)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XImportQualifiedPost app) ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XBangPatterns -XDeriveAnyClass -XDeriveDataTypeable -XDeriveFunctor -XDeriveGeneric -XDeriveTraversable -XExplicitForAll -XFlexibleContexts -XFlexibleInstances -XGADTSyntax -XMultiParamTypeClasses -XNumericUnderscores -XRankNTypes -XScopedTypeVariables -XStandaloneDeriving -XTupleSections -XTypeApplications -XTypeOperators -XImportQualifiedPost -XLambdaCase -XStrictData src) ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XImportQualifiedPost app) ; fi - name: cabal check run: | cd ${PKGDIR_swarm} || false diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 367d240e7..11e5d4350 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -19,7 +19,7 @@ benchmarks: True -- Run HLint hlint: True -hlint-job: 9.2.4 +hlint-job: 9.4.2 hlint-yaml: .hlint.yaml hlint-download-binary: True diff --git a/src/Swarm/Game/WorldGen.hs b/src/Swarm/Game/WorldGen.hs index dbf39ba17..9485493b0 100644 --- a/src/Swarm/Game/WorldGen.hs +++ b/src/Swarm/Game/WorldGen.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} -- | -- Module : Swarm.Game.WorldGen @@ -14,12 +15,14 @@ import Control.Lens (view) import Data.Array.IArray import Data.Bifunctor (second) import Data.Bool +import Data.ByteString (ByteString) import Data.Enumeration import Data.Hash.Murmur import Data.Int (Int64) import Data.List (find) import Data.Maybe (fromMaybe, mapMaybe) import Data.Set qualified as S +import Data.Tagged import Data.Text (Text) import Data.Text qualified as T import Numeric.Noise.Perlin @@ -27,6 +30,7 @@ import Swarm.Game.Entity import Swarm.Game.Terrain import Swarm.Game.World import Witch +import Witch.Encoding qualified as Encoding -- | A simple test world used for a while during early development. testWorld1 :: Coords -> (TerrainType, Maybe Text) @@ -92,7 +96,7 @@ testWorld2 em baseSeed = second (readEntity em) (WF tw2) (bool Soft Hard (sample ix pn1 > 0)) (bool Natural Artificial (sample ix pn2 > 0)) where - h = murmur3 0 . into . show $ ix + h = murmur3 0 . unTagged . from @String @(Encoding.UTF_8 ByteString) . show $ ix genBiome Big Hard Natural | sample ix cl0 > 0.5 = (StoneT, Just "mountain") diff --git a/stack.yaml b/stack.yaml index 9687deeff..757ca5b16 100644 --- a/stack.yaml +++ b/stack.yaml @@ -12,5 +12,6 @@ extra-deps: - vty-5.36@sha256:dfbb78ea924ad0ef66cff4bc223918240234508c3de139b34780038dafb5fc53,20859 - criterion-1.6.0.0@sha256:76280dace017fe1fab4dae35d57992a48e70a3cfcdb2a4563923cd2502a7268c,5403 - criterion-measurement-0.2.0.0@sha256:8c6127b22a53aebc7d5a9dbf8fd870f128b93be3069fe7fed969e4c253cd9626,2121 +- witch-1.1.1.0@sha256:053d116eedea78219fdb465ad7903afc0e67c67ca5837508bba9435f4ac239bc,2178 resolver: lts-19.8 diff --git a/swarm.cabal b/swarm.cabal index f302451d0..cadf63ad0 100644 --- a/swarm.cabal +++ b/swarm.cabal @@ -18,7 +18,7 @@ maintainer: byorgey@gmail.com bug-reports: https://github.com/swarm-game/swarm/issues copyright: Brent Yorgey 2021 category: Game -tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.4 +tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.2 extra-source-files: CHANGELOG.md example/*.sw editors/emacs/*.el @@ -126,10 +126,10 @@ library other-modules: Paths_swarm autogen-modules: Paths_swarm - build-depends: base >= 4.14 && < 4.17, - aeson >= 2 && < 2.1, + build-depends: base >= 4.14 && < 4.18, + aeson >= 2 && < 2.2, array >= 0.5.4 && < 0.6, - brick >= 1.0 && < 1.1, + brick >= 1.0 && < 1.4, bytestring >= 0.10 && < 0.12, clock >= 0.8.2 && < 0.9, containers >= 0.6.2 && < 0.7, @@ -146,9 +146,9 @@ library http-client >= 0.7 && < 0.8, http-client-tls >= 0.3 && < 0.4, http-types >= 0.12 && < 0.13, - lens >= 4.19 && < 5.2, + lens >= 4.19 && < 5.3, linear >= 1.21.6 && < 1.22, - lsp >= 1.2 && < 1.5, + lsp >= 1.2 && < 1.7, megaparsec >= 9.0 && < 9.3, minimorph >= 0.3 && < 0.4, mtl >= 2.2.2 && < 2.3, @@ -163,23 +163,19 @@ library split >= 0.2.3 && < 0.3, stm >= 2.5.0 && < 2.6, syb >= 0.7 && < 0.8, - template-haskell >= 2.16 && < 2.19, + tagged >= 0.8 && < 0.9, + template-haskell >= 2.16 && < 2.20, text >= 1.2.4 && < 2.1, time >= 1.9 && < 1.14, unification-fd >= 0.11 && < 0.12, unordered-containers >= 0.2.14 && < 0.3, - vector >= 0.12 && < 0.13, - vty >= 5.33 && < 5.37, + vector >= 0.12 && < 0.14, + vty >= 5.33 && < 5.38, wai >= 3.2 && < 3.3, warp >= 3.2 && < 3.4, - witch >= 0.3.4 && < 1.1, + witch >= 1.1.1.0 && < 1.2, word-wrap >= 0.5 && < 0.6, yaml >= 0.11 && < 0.12, - - -- Temporary workaround for TomMD/entropy#75. - -- We should be able to remove this bound once - -- it is fixed. - entropy <= 0.4.1.7, hs-source-dirs: src default-language: Haskell2010 default-extensions: