Skip to content

Commit 02182c6

Browse files
authored
Support GHC range from 9.0.2 to 9.12.2 (#54)
1 parent b190980 commit 02182c6

File tree

8 files changed

+129
-130
lines changed

8 files changed

+129
-130
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,15 @@ on:
55
pull_request: { branches: [main] }
66
create: { tags: [v*] }
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
defaults:
913
run:
1014
shell: bash
1115

1216
jobs:
13-
cancel:
14-
name: Cancel redundant actions already in progress
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Cancel actions in progress of same workflow and same branch
18-
uses: styfle/[email protected]
19-
with:
20-
access_token: ${{ github.token }}
21-
2217
# Check that Haskell code is formatted.
2318
code-formatter:
2419
runs-on: ubuntu-latest
@@ -31,6 +26,7 @@ jobs:
3126
runs-on: ${{ matrix.os }}
3227
needs: code-formatter
3328
strategy:
29+
fail-fast: false
3430
matrix:
3531
os:
3632
- ubuntu-latest
@@ -44,14 +40,14 @@ jobs:
4440
# If you change it, make sure to adjust lower bounds there to reflect the change.
4541
# Also, make sure to adjust tested-with field in package.yaml so that it contains
4642
# corresponding GHC version.
47-
stack-resolver: lts-18.21
43+
stack-resolver: lts-19.33
4844

4945
steps:
5046
- name: Checkout the repo
51-
uses: actions/checkout@v2
47+
uses: actions/checkout@v4
5248

5349
- name: Cache (Unix)
54-
uses: actions/cache@v2
50+
uses: actions/cache@v4
5551
if: runner.os == 'Linux' || runner.os == 'macOS'
5652
with:
5753
path: |
@@ -77,7 +73,7 @@ jobs:
7773
restore-keys: |
7874
haskell-${{ runner.os }}-${{ hashFiles('stack.yaml') }}-
7975
- name: Cache (Windows)
80-
uses: actions/cache@v2
76+
uses: actions/cache@v4
8177
if: runner.os == 'Windows'
8278
with:
8379
# C\:sr is where stack installs compiled dependencies.
@@ -95,32 +91,11 @@ jobs:
9591
if: runner.os == 'macOS'
9692
run: rm -rf ~/.stack/setup-exe-cache
9793

98-
# We are setting up haskell via ghcup instead of using haskell/actions/setup
99-
# because the mentioned gh action can be months late with the latest versions
100-
# of Stack.
101-
- name: Set up Haskell (Stack) via ghcup (Unix)
102-
if: runner.os == 'Linux' || runner.os == 'macOS'
103-
run: |
104-
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
105-
export BOOTSTRAP_HASKELL_INSTALL_STACK=1
106-
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
107-
108-
- name: Set up Haskell (Stack) via ghcup (Win)
109-
if: runner.os == 'Windows'
110-
run: |
111-
Set-ExecutionPolicy Bypass -Scope Process -Force
112-
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
113-
Invoke-Command -ScriptBlock ([ScriptBlock]::Create(".{$(Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing)} -InstallStack"))
114-
shell: powershell
115-
116-
# NOTE: I commented out this in favor of manual setup above, since with this action we
117-
# couldn't get the latest version of Stack.
118-
# - name: Set up Haskell (Stack)
119-
# uses: haskell/actions/setup@v1
120-
# with:
121-
# ghc-version: latest
122-
# enable-stack: true
123-
# stack-version: latest
94+
- uses: haskell-actions/setup@v2
95+
with:
96+
ghc-version: latest
97+
enable-stack: true
98+
stack-version: latest
12499

125100
- name: Set Stack resolver
126101
if: matrix.stack-resolver != 'from-stack-yaml'
@@ -134,10 +109,10 @@ jobs:
134109
stack path --stack-root
135110
stack ghc -- --version
136111
ghc --version
137-
138-
- name: Build dependencies
112+
113+
- name: Build dependencies
139114
run: stack --install-ghc test --only-dependencies
140-
115+
141116
- name: Build StrongPath & Run tests
142117
run: stack test
143118

package.yaml

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: strong-path
2-
version: 1.1.4.0
2+
version: 1.2.0.0
33
github: "wasp-lang/strong-path"
44
license: MIT
55
author: "Martin Sosic"
@@ -15,28 +15,51 @@ category: System, Filesystem, FilePath
1515

1616
description: Replacement for a FilePath that enables you to handle filepaths in your code in a type-safe manner. You can specify at type level if they are relative, absolute, file, directory, posix, windows, and even to which file or directory they point to or are relative to.
1717

18-
tested-with: GHC == 8.10.7, GHC == 9.0.1 # lts-18.21, nightly-2022-01-04
18+
tested-with: GHC == 9.0.2, GHC == 9.12.2 # lts-19.33, nightly-2025-10-29
1919

2020
dependencies:
2121
- base >= 4.7 && < 5
22+
- hashable >=1.3 && < 1.6
23+
- path >=0.9.2 && <0.10
24+
- filepath >=1.4 && <1.6
2225

2326
library:
2427
source-dirs: src
2528
ghc-options:
2629
- -Wall
2730
dependencies:
28-
# NOTE: Version bounds here and in tests are defined so that they cover the latest LTS snapshot
29-
# (lts-18.21) (lower bounds) and the nightly snapshot defined in stack.yaml (upper bounds).
30-
# Those two are also tested in the CI, and corresponding GHC versions are mentioned above
31-
# in the tested-with field.
32-
# In case you decide to cover a different LTS with the lower bounds,
33-
# make sure to also update the CI to use the correct LTS for testing and also update
34-
# tested-with field above.
35-
- path >=0.9.2 && <0.10
31+
# NOTE: Version bounds here and in tests are defined so that they cover the
32+
# latest LTS snapshot (lts-19.33) (lower bounds) and the nightly snapshot
33+
# defined in stack.yaml (upper bounds). We are ignoring the minor
34+
# versions on the lower bound for better flexibility.
35+
#
36+
# Those two LTS snapshots are also tested in the CI, and corresponding
37+
# GHC versions are mentioned above in the tested-with field.
38+
#
39+
# If you decide to cover a different LTS with the lower bounds, make sure
40+
# to also update the CI to use the correct LTS for testing and also
41+
# update tested-with field above.
42+
#
43+
# When doing a GHC update:
44+
# - Read this to learn more about the process:
45+
# https://github.com/wasp-lang/haskell-handbook/blob/master/dependencies-version-bounds.md
46+
# - Ensure you don't leave a gap in supported GHC versions. Each GHC/base
47+
# should have a version of StrongPath to go with it.
48+
# - Go through the breaking changes version of all libraries that need to
49+
# be bumped and double check they don't affect us.
50+
#
51+
# The current situation:
52+
# - Lower bounds match GHC 9.0.2 (Stack's LTS 19.33, major digits only)
53+
# - Upper bounds match GHC 9.12.2 (Stack's nightly-2025-10-29). The
54+
# exclusive upper limit is set to the next breaking change version.
55+
#
56+
# For example:
57+
# - `LTS 19.33` has the version of `filepath` set to `1.4.2.2`
58+
# - `nighly-2025-10-29` says has a version of `filepath` set to `1.5.4.0`
59+
# - Strong path requires `filepath >=1.4 && <1.6`
60+
#
3661
- exceptions >=0.10 && <0.11
37-
- filepath >=1.4 && <1.5
38-
- template-haskell >=2.16 && <2.18
39-
- hashable >=1.3 && < 1.4
62+
- template-haskell >=2.17 && <2.24
4063

4164
tests:
4265
strong-path-test:
@@ -48,11 +71,8 @@ tests:
4871
- -with-rtsopts=-N
4972
dependencies:
5073
- strong-path
51-
- path
52-
- filepath
53-
- hashable >=1.3 && < 1.4
54-
- tasty >=1.4 && <1.5
55-
- tasty-hspec >=1.1 && <1.3
56-
- tasty-quickcheck >=0.10 && <0.11
57-
- tasty-discover >=4.2 && <4.3
58-
- hspec >=2.7 && <2.10
74+
- tasty >=1.4 && <1.6
75+
- tasty-hspec >=1.2 && <1.3
76+
- tasty-quickcheck >=0.10 && <0.12
77+
- tasty-discover >=4.2 && <5.3
78+
- hspec >=2.8 && <2.12

src/StrongPath/Operations.hs

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -105,43 +105,55 @@ parent path = case path of
105105
(</>) :: Path s b (Dir d) -> Path s (Rel d) t -> Path s b t
106106
---- System
107107
lsp@(RelDir _ _) </> (RelFile rp rprefix) =
108-
let (RelDir lp' lprefix') = iterate parent lsp !! prefixNumParentDirs rprefix
109-
in RelFile (lp' P.</> rp) lprefix'
108+
case iterate parent lsp !! prefixNumParentDirs rprefix of
109+
(RelDir lp' lprefix') -> RelFile (lp' P.</> rp) lprefix'
110+
_ -> impossible
110111
lsp@(RelDir _ _) </> (RelDir rp rprefix) =
111-
let (RelDir lp' lprefix') = iterate parent lsp !! prefixNumParentDirs rprefix
112-
in RelDir (lp' P.</> rp) lprefix'
112+
case iterate parent lsp !! prefixNumParentDirs rprefix of
113+
(RelDir lp' lprefix') -> RelDir (lp' P.</> rp) lprefix'
114+
_ -> impossible
113115
lsp@(AbsDir _) </> (RelFile rp rprefix) =
114-
let (AbsDir lp') = iterate parent lsp !! prefixNumParentDirs rprefix
115-
in AbsFile (lp' P.</> rp)
116+
case iterate parent lsp !! prefixNumParentDirs rprefix of
117+
(AbsDir lp') -> AbsFile (lp' P.</> rp)
118+
_ -> impossible
116119
lsp@(AbsDir _) </> (RelDir rp rprefix) =
117-
let (AbsDir lp') = iterate parent lsp !! prefixNumParentDirs rprefix
118-
in AbsDir (lp' P.</> rp)
120+
case iterate parent lsp !! prefixNumParentDirs rprefix of
121+
(AbsDir lp') -> AbsDir (lp' P.</> rp)
122+
_ -> impossible
119123
---- Windows
120124
lsp@(RelDirW _ _) </> (RelFileW rp rprefix) =
121-
let (RelDirW lp' lprefix') = iterate parent lsp !! prefixNumParentDirs rprefix
122-
in RelFileW (lp' PW.</> rp) lprefix'
125+
case iterate parent lsp !! prefixNumParentDirs rprefix of
126+
(RelDirW lp' lprefix') -> RelFileW (lp' PW.</> rp) lprefix'
127+
_ -> impossible
123128
lsp@(RelDirW _ _) </> (RelDirW rp rprefix) =
124-
let (RelDirW lp' lprefix') = iterate parent lsp !! prefixNumParentDirs rprefix
125-
in RelDirW (lp' PW.</> rp) lprefix'
129+
case iterate parent lsp !! prefixNumParentDirs rprefix of
130+
(RelDirW lp' lprefix') -> RelDirW (lp' PW.</> rp) lprefix'
131+
_ -> impossible
126132
lsp@(AbsDirW _) </> (RelFileW rp rprefix) =
127-
let (AbsDirW lp') = iterate parent lsp !! prefixNumParentDirs rprefix
128-
in AbsFileW (lp' PW.</> rp)
133+
case iterate parent lsp !! prefixNumParentDirs rprefix of
134+
(AbsDirW lp') -> AbsFileW (lp' PW.</> rp)
135+
_ -> impossible
129136
lsp@(AbsDirW _) </> (RelDirW rp rprefix) =
130-
let (AbsDirW lp') = iterate parent lsp !! prefixNumParentDirs rprefix
131-
in AbsDirW (lp' PW.</> rp)
137+
case iterate parent lsp !! prefixNumParentDirs rprefix of
138+
(AbsDirW lp') -> AbsDirW (lp' PW.</> rp)
139+
_ -> impossible
132140
---- Posix
133141
lsp@(RelDirP _ _) </> (RelFileP rp rprefix) =
134-
let (RelDirP lp' lprefix') = iterate parent lsp !! prefixNumParentDirs rprefix
135-
in RelFileP (lp' PP.</> rp) lprefix'
142+
case iterate parent lsp !! prefixNumParentDirs rprefix of
143+
(RelDirP lp' lprefix') -> RelFileP (lp' PP.</> rp) lprefix'
144+
_ -> impossible
136145
lsp@(RelDirP _ _) </> (RelDirP rp rprefix) =
137-
let (RelDirP lp' lprefix') = iterate parent lsp !! prefixNumParentDirs rprefix
138-
in RelDirP (lp' PP.</> rp) lprefix'
146+
case iterate parent lsp !! prefixNumParentDirs rprefix of
147+
(RelDirP lp' lprefix') -> RelDirP (lp' PP.</> rp) lprefix'
148+
_ -> impossible
139149
lsp@(AbsDirP _) </> (RelFileP rp rprefix) =
140-
let (AbsDirP lp') = iterate parent lsp !! prefixNumParentDirs rprefix
141-
in AbsFileP (lp' PP.</> rp)
150+
case iterate parent lsp !! prefixNumParentDirs rprefix of
151+
(AbsDirP lp') -> AbsFileP (lp' PP.</> rp)
152+
_ -> impossible
142153
lsp@(AbsDirP _) </> (RelDirP rp rprefix) =
143-
let (AbsDirP lp') = iterate parent lsp !! prefixNumParentDirs rprefix
144-
in AbsDirP (lp' PP.</> rp)
154+
case iterate parent lsp !! prefixNumParentDirs rprefix of
155+
(AbsDirP lp') -> AbsDirP (lp' PP.</> rp)
156+
_ -> impossible
145157
_ </> _ = impossible
146158

147159
-- | Returns the most right member of the path once split by separators.
@@ -233,15 +245,15 @@ castFile _ = impossible
233245
-- Works well for \"normal\" relative paths like @\"a\\b\\c\"@ (Win) or @\"a\/b\/c\"@ (Posix).
234246
-- If path is weird but still considered relative, like just @\"C:\"@ on Win,
235247
-- results can be unexpected, most likely resulting with error thrown.
236-
relDirToPosix :: MonadThrow m => Path s (Rel d1) (Dir d2) -> m (Path Posix (Rel d1) (Dir d2))
248+
relDirToPosix :: (MonadThrow m) => Path s (Rel d1) (Dir d2) -> m (Path Posix (Rel d1) (Dir d2))
237249
relDirToPosix sp@(RelDir _ _) = parseRelDirP $ FPP.joinPath $ FP.splitDirectories $ toFilePath sp
238250
relDirToPosix sp@(RelDirW _ _) = parseRelDirP $ FPP.joinPath $ FPW.splitDirectories $ toFilePath sp
239251
relDirToPosix (RelDirP p pr) = return $ RelDirP p pr
240252
relDirToPosix _ = impossible
241253

242254
-- | Converts relative file path to posix, if it is not already posix.
243255
-- Check 'relDirToPosix' for more details, they behave the same.
244-
relFileToPosix :: MonadThrow m => Path s (Rel d1) (File f) -> m (Path Posix (Rel d1) (File f))
256+
relFileToPosix :: (MonadThrow m) => Path s (Rel d1) (File f) -> m (Path Posix (Rel d1) (File f))
245257
relFileToPosix sp@(RelFile _ _) = parseRelFileP $ FPP.joinPath $ FP.splitDirectories $ toFilePath sp
246258
relFileToPosix sp@(RelFileW _ _) = parseRelFileP $ FPP.joinPath $ FPW.splitDirectories $ toFilePath sp
247259
relFileToPosix (RelFileP p pr) = return $ RelFileP p pr

stack.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
# NOTE: If you modify this field, make sure to update the tested-with
2222
# field in package.yaml to contain the corresponding GHC versions.
23-
resolver: nightly-2022-01-04
23+
resolver: nightly-2025-10-29
2424

2525
# User packages to be built.
2626
# Various formats can be used as shown in the example below.
@@ -43,8 +43,6 @@ packages:
4343
# - git: https://github.com/commercialhaskell/stack.git
4444
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
4545
#
46-
extra-deps:
47-
- path-0.9.2
4846

4947
# Override default flag values for local packages and extra-deps
5048
# flags: {}

stack.yaml.lock

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
# This file was autogenerated by Stack.
22
# You should not edit this file by hand.
33
# For more information, please see the documentation at:
4-
# https://docs.haskellstack.org/en/stable/lock_files
4+
# https://docs.haskellstack.org/en/stable/topics/lock_files
55

6+
packages: []
67
snapshots:
7-
- original: nightly-2022-01-04
8-
completed:
9-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2022/1/4.yaml
10-
sha256: ea584edfba307b5a88b51fc1db7c0c1b7da5f714fd30d69699fc78e3e1ce5212
11-
size: 623654
12-
packages:
13-
- original:
14-
hackage: path-0.9.2
15-
completed:
16-
pantry-tree:
17-
sha256: 2acf94a62daeeb0aee9b77d044ece55b5e03445b574e6980a2e84a5a514f5517
18-
size: 1206
19-
hackage: path-0.9.2@sha256:2f2a7f01737cd350b30381b619e1a862601c83f10ede4d6935f76f66e63ae0c7,3273
8+
- completed:
9+
sha256: e527e879a59ab8d2408960c7da3e2fc5edf4fb433a0f2fe65f0c79736f2e10e8
10+
size: 705114
11+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2025/10/29.yaml
12+
original: nightly-2025-10-29

0 commit comments

Comments
 (0)