From 58ff21548081e1c77b5599fba98b7813ff4f15ea Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Thu, 13 Oct 2022 15:48:56 -0500 Subject: [PATCH] upgrade to `hsnoise-0.0.3` (#746) Closes #745. --- .github/workflows/haskell-ci.yml | 27 ++++++++++----------------- cabal.haskell-ci | 2 +- cabal.project | 9 --------- src/Swarm/Language/LSP.hs | 5 ++--- stack.yaml | 3 +-- swarm.cabal | 2 +- 6 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 cabal.project diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index b7623eb60..e981f5b07 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -9,7 +9,7 @@ # # This GitHub workflow config has been generated by a script via # -# haskell-ci 'github' '--config=cabal.haskell-ci' 'cabal.project' '--copy-fields=all' +# haskell-ci 'github' '--config=cabal.haskell-ci' '--copy-fields=all' 'swarm.cabal' # # To regenerate the script (for example after adjusting tested-with) run # @@ -17,9 +17,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20220808 +# version: 0.15.20221009 # -# REGENDATA ("0.15.20220808",["github","--config=cabal.haskell-ci","cabal.project","--copy-fields=all"]) +# REGENDATA ("0.15.20221009",["github","--config=cabal.haskell-ci","--copy-fields=all","swarm.cabal"]) # name: Haskell-CI on: @@ -30,7 +30,6 @@ on: - '**.cabal' - '*.yaml' - 'data/**.yaml' - - 'cabal.project*' - '.github/workflows/haskell-ci.yml' branches: - "main" @@ -43,7 +42,6 @@ on: - 'stack.yaml' - '*.yaml' - 'data/**.yaml' - - 'cabal.project*' - '.github/workflows/haskell-ci.yml' branches: - "main" @@ -150,7 +148,7 @@ jobs: - name: cache (tools) uses: actions/cache@v2 with: - key: ${{ runner.os }}-${{ matrix.compiler }}-tools-436fbe9d + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-0ac7885f path: ~/.haskell-ci-tools - name: install cabal-plan run: | @@ -172,10 +170,10 @@ jobs: cabal-docspec --version - name: install hlint run: | - if [ $((HCNUMVER < 90000)) -ne 0 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $ARG_COMPILER --dry-run hlint --constraint='hlint >=3.3 && <3.4' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi - if [ $((HCNUMVER < 90000)) -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 < 90000)) -ne 0 ] ; then mkdir -p $CABAL_DIR/bin && ln -sf "$HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint" $CABAL_DIR/bin/hlint ; fi - if [ $((HCNUMVER < 90000)) -ne 0 ] ; then hlint --version ; fi + 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 - name: checkout uses: actions/checkout@v2 with: @@ -204,11 +202,6 @@ jobs: echo "package swarm" >> cabal.project echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local @@ -240,8 +233,8 @@ jobs: cabal-docspec $ARG_COMPILER - name: hlint run: | - if [ $((HCNUMVER < 90000)) -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 < 90000)) -ne 0 ] ; then (cd ${PKGDIR_swarm} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 -XImportQualifiedPost app) ; fi + 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 - name: cabal check run: | cd ${PKGDIR_swarm} || false diff --git a/cabal.haskell-ci b/cabal.haskell-ci index a2fc24bf1..367d240e7 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -19,7 +19,7 @@ benchmarks: True -- Run HLint hlint: True -hlint-job: 8.10.7 +hlint-job: 9.2.4 hlint-yaml: .hlint.yaml hlint-download-binary: True diff --git a/cabal.project b/cabal.project deleted file mode 100644 index 7226d9363..000000000 --- a/cabal.project +++ /dev/null @@ -1,9 +0,0 @@ --- If you edit this file, be sure to regenerate the CI configuration --- by running 'haskell-ci regenerate'. - -source-repository-package - type: git - location: https://github.com/colinhect/hsnoise - tag: 4ccff11dea7e8d94e6a5fcaf8f43857bd65bd72d - -packages: . diff --git a/src/Swarm/Language/LSP.hs b/src/Swarm/Language/LSP.hs index 1e81740ed..eaa456af2 100644 --- a/src/Swarm/Language/LSP.hs +++ b/src/Swarm/Language/LSP.hs @@ -14,6 +14,7 @@ module Swarm.Language.LSP where import Control.Lens (to, (^.)) import Control.Monad (void) import Control.Monad.IO.Class +import Data.Foldable (forM_) import Data.Maybe (fromMaybe) import Data.Text (Text) import Data.Text.IO qualified as Text @@ -71,9 +72,7 @@ validateSwarmCode doc version content = do Left e -> Just $ showTypeErrorPos content e Left e -> Just $ showErrorPos e -- debug $ "-> " <> from (show err) - case err of - Nothing -> pure () - Just e -> sendDiagnostic e + forM_ err sendDiagnostic where sendDiagnostic :: ((Int, Int), (Int, Int), Text) -> LspM () () sendDiagnostic ((startLine, startCol), (endLine, endCol), msg) = do diff --git a/stack.yaml b/stack.yaml index a87e74051..9687deeff 100644 --- a/stack.yaml +++ b/stack.yaml @@ -2,8 +2,7 @@ extra-deps: - word-wrap-0.5 - hashable-1.3.5.0 - base-orphans-0.8.6 -- git: https://github.com/colinhect/hsnoise - commit: 4ccff11dea7e8d94e6a5fcaf8f43857bd65bd72d +- hsnoise-0.0.3@sha256:260b39175b8a3e3b1719ad3987b7d72a3fd7a0fa99be8639b91cf4dc3f1c8796,1476 - brick-1.0@sha256:99242c47aa2fd08424445de9c4437405098dcda5ae74d558648eadd6b069062c,17793 - bimap-0.5.0@sha256:aba506d02a1c93fc2b50dcbe728d2a4d07cca89b7033945418061a0b08576ebd,1889 - simple-enumeration-0.2.1@sha256:8625b269c1650d3dd0e3887351c153049f4369853e0d525219e07480ea004b9f,1178 diff --git a/swarm.cabal b/swarm.cabal index 820876178..e6b690e2b 100644 --- a/swarm.cabal +++ b/swarm.cabal @@ -140,7 +140,7 @@ library fused-effects-lens >= 1.2.0.1 && < 1.3, githash >= 0.1.6 && < 0.2, hashable >= 1.3.4 && < 1.5, - hsnoise >= 0.0.2 && < 0.1, + hsnoise >= 0.0.3 && < 0.1, http-client >= 0.7 && < 0.8, http-client-tls >= 0.3 && < 0.4, http-types >= 0.12 && < 0.13,