From 96dd17220d68ecad04cc533e0b6d1d917b90d84e Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Sun, 12 Jan 2025 12:48:31 -0800 Subject: [PATCH] Updates (#450) * Support Diff-1 * Bump stack resolver * Add Paths_fourmolu to autogen-modules * Fix hackage index-state --- .github/workflows/web.yml | 3 +++ .gitignore | 1 - fourmolu.cabal | 6 ++++-- stack.yaml | 15 +++++++++++---- stack.yaml.lock | 26 ++++++++++++++++++++++++++ tests/Ormolu/Config/PrinterOptsSpec.hs | 6 +++--- 6 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 stack.yaml.lock diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index a91dd287..c481940a 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -98,6 +98,9 @@ jobs: key: ${{ runner.os }}-hakyll-cache-${{ env.CURR_MONTH }}-${{ hashFiles('web/site/cabal.project.freeze') }} restore-keys: | ${{ runner.os }}-hakyll-cache-${{ env.CURR_MONTH }}- + - + # refresh Hackage index-state after restoring cache + run: cabal update - name: Build site run: cabal run fourmolu-web --ghc-options='-Werror' -- build diff --git a/.gitignore b/.gitignore index def5a8f0..72f5a637 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ cabal.project.local cabal.sandbox.config dist-*/ dist/ -stack*.yaml.lock result* .direnv/ hie.yaml diff --git a/fourmolu.cabal b/fourmolu.cabal index 4ed600d4..8339d672 100644 --- a/fourmolu.cabal +++ b/fourmolu.cabal @@ -103,13 +103,15 @@ library other-modules: Ormolu.Config.Gen Ormolu.Config.Types + autogen-modules: + Paths_fourmolu hs-source-dirs: src other-modules: GHC.DynFlags default-language: GHC2021 build-depends: Cabal-syntax >=3.12 && <3.13, - Diff >=0.4 && <1, + Diff >=0.4 && <2, MemoTrie >=0.6 && <0.7, ansi-terminal >=0.10 && <1.2, array >=0.5 && <0.6, @@ -220,7 +222,7 @@ test-suite tests Ormolu.Utils.GlobSpec build-depends: bytestring, - Diff >=0.3 && <1, + Diff >=1 && <2, pretty >=1.0 && <2.0, process >=1.6 && <2.0, yaml, diff --git a/stack.yaml b/stack.yaml index d5d56fe1..7b9aa2c7 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,6 +1,13 @@ -resolver: nightly-2024-05-10 +resolver: nightly-2025-01-11 extra-deps: -- ghc-lib-parser-9.10.1.20240511 -- Cabal-syntax-3.12.0.0 -- choice-0.2.4.1 + - path-0.9.6 + - path-io-1.8.2 + +flags: + path: + os-string: true + +allow-newer: true +allow-newer-deps: + - path diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 00000000..4c1c5784 --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,26 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: +- completed: + hackage: path-0.9.6@sha256:63c2783d76c425514b2904e392f487921de823d883dcc629d7eaad36930198ce,5531 + pantry-tree: + sha256: c791fe08026c1856bfd8fe4ae6b93e86ffcfbd59b3b4644560a71b734dd4b20e + size: 3146 + original: + hackage: path-0.9.6 +- completed: + hackage: path-io-1.8.2@sha256:97725811b06f3fea7c1f2b0b39f21806c2f90470fc571acd75d3606b49b0f0d9,2009 + pantry-tree: + sha256: 14dc5dc9c1f71b2568390ff7f1ad7f8237101ee98a05fe82068e9479468416cb + size: 318 + original: + hackage: path-io-1.8.2 +snapshots: +- completed: + sha256: 776b860cca4e9106b51f401ddbc6d8d95ba417ec326d9c869013fef1086a9a17 + size: 621385 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2025/1/11.yaml + original: nightly-2025-01-11 diff --git a/tests/Ormolu/Config/PrinterOptsSpec.hs b/tests/Ormolu/Config/PrinterOptsSpec.hs index 6c4de1eb..cd384bfc 100644 --- a/tests/Ormolu/Config/PrinterOptsSpec.hs +++ b/tests/Ormolu/Config/PrinterOptsSpec.hs @@ -11,7 +11,7 @@ module Ormolu.Config.PrinterOptsSpec (spec) where import Control.Exception (catch) import Control.Monad (forM_, when) -import Data.Algorithm.DiffContext (getContextDiff, prettyContextDiff) +import Data.Algorithm.DiffContext qualified as Diff import Data.Char (isSpace) import Data.List.NonEmpty qualified as NonEmpty import Data.Maybe (isJust) @@ -446,8 +446,8 @@ getFileContents path = do getDiff :: (String, Text) -> (String, Text) -> Text getDiff (s1Name, s1) (s2Name, s2) = T.pack . Doc.render $ - prettyContextDiff (Doc.text s1Name) (Doc.text s2Name) (Doc.text . T.unpack) $ - getContextDiff 2 (T.lines s1) (T.lines s2) + Diff.prettyContextDiff (Doc.text s1Name) (Doc.text s2Name) (Doc.text . T.unpack . Diff.unnumber) $ + Diff.getContextDiff (Just 2) (T.lines s1) (T.lines s2) renderOrmoluException :: OrmoluException -> IO String renderOrmoluException e =