Skip to content

Commit

Permalink
Updates (fourmolu#450)
Browse files Browse the repository at this point in the history
* Support Diff-1

* Bump stack resolver

* Add Paths_fourmolu to autogen-modules

* Fix hackage index-state
  • Loading branch information
brandonchinn178 authored Jan 12, 2025
1 parent a507ccc commit 96dd172
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ cabal.project.local
cabal.sandbox.config
dist-*/
dist/
stack*.yaml.lock
result*
.direnv/
hie.yaml
Expand Down
6 changes: 4 additions & 2 deletions fourmolu.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 11 additions & 4 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions tests/Ormolu/Config/PrinterOptsSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 96dd172

Please sign in to comment.