Skip to content

Commit

Permalink
Move to new exports from path-0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Oct 21, 2023
1 parent 644e4f6 commit dee421d
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 46 deletions.
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ dependencies:
- open-browser
- optparse-applicative >= 0.18.1.0
- pantry >= 0.9.2
- path
- path >= 0.9.5
- path-io
# In order for Cabal (the tool) to build Stack, it needs to be told of the
# upper bound on persistent. See
Expand Down
35 changes: 1 addition & 34 deletions src/Path/Extra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@ module Path.Extra
, forgivingResolveDir
, forgivingResolveFile
, forgivingResolveFile'
, splitDrive
, takeDrive
, dropDrive
, isDrive
) where

import Data.Time ( UTCTime )
import Path
( Abs, Dir, File, PathException (..), Rel, parseAbsDir
( Abs, Dir, File, Path, PathException (..), parseAbsDir
, parseAbsFile, toFilePath
)
import Path.Internal ( Path (Path) )
import Path.IO
( doesDirExist, doesFileExist, getCurrentDir
, getModificationTime
Expand Down Expand Up @@ -181,31 +176,3 @@ forgivingResolveFile' ::
-- ^ Path to resolve
-> m (Maybe (Path Abs File))
forgivingResolveFile' p = getCurrentDir >>= flip forgivingResolveFile p

-- The following functions may be added to a future version of the path package.
-- See https://github.com/commercialhaskell/path/pull/191

-- | Split an absolute path into a drive and, perhaps, a path. On POSIX, @/@ is
-- a drive.
splitDrive :: Path Abs t -> (Path Abs Dir, Maybe (Path Rel t))
splitDrive (Path fp) =
let (d, rest) = FP.splitDrive fp
mRest = if null rest then Nothing else Just (Path rest)
in (Path d, mRest)

-- | Get the drive from an absolute path. On POSIX, @/@ is a drive.
--
-- > takeDrive x = fst (splitDrive x)
takeDrive :: Path Abs t -> Path Abs Dir
takeDrive = fst . splitDrive

-- | Drop the drive from an absolute path. May result in 'Nothing' if the path
-- is just a drive.
--
-- > dropDrive x = snd (splitDrive x)
dropDrive :: Path Abs t -> Maybe (Path Rel t)
dropDrive = snd . splitDrive

-- | Is an absolute directory path a drive?
isDrive :: Path Abs Dir -> Bool
isDrive = isNothing . dropDrive
5 changes: 3 additions & 2 deletions src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ import Network.HTTP.StackClient
import Network.HTTP.Simple ( getResponseHeader )
import Path
( (</>), addExtension, filename, parent, parseAbsDir
, parseAbsFile, parseRelDir, parseRelFile, toFilePath
, parseAbsFile, parseRelDir, parseRelFile, takeDrive
, toFilePath
)
import Path.CheckInstall ( warnInstallSearchPathIssues )
import Path.Extended ( fileExtension )
import Path.Extra ( takeDrive, toFilePathNoTrailingSep )
import Path.Extra ( toFilePathNoTrailingSep )
import Path.IO
( canonicalizePath, doesFileExist, ensureDir, executable
, getPermissions, ignoringAbsence, listDir, removeDirRecur
Expand Down
2 changes: 1 addition & 1 deletion stack-ghc-9.6.3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# built with GHC 9.6.3.

# GHC 9.6.3
resolver: nightly-2023-10-14
resolver: nightly-2023-10-21

extra-deps:
# Cabal is pruned because process is a GHC boot package, and has to be specified
Expand Down
8 changes: 4 additions & 4 deletions stack-ghc-9.6.3.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ packages:
hackage: process-1.6.18.0@sha256:cd0a3e0376b5a8525983d3131a31e52f9ffefc278ce635eec45a9d3987b8be3e,3025
snapshots:
- completed:
sha256: 9958d138d45a2ff29479d3922047054b4e31f7fd3c3d10432192086b8ee121ad
size: 693188
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2023/10/14.yaml
original: nightly-2023-10-14
sha256: 215cd7b317bc056574f30bdaaf10326af4c95c9f8e412462a126e55bbb6d66c6
size: 695331
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2023/10/21.yaml
original: nightly-2023-10-21
8 changes: 4 additions & 4 deletions stack.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ library
, open-browser
, optparse-applicative >=0.18.1.0
, pantry >=0.9.2
, path
, path >=0.9.5
, path-io
, persistent >=2.14.0.0 && <2.15
, persistent-sqlite
Expand Down Expand Up @@ -499,7 +499,7 @@ executable stack
, open-browser
, optparse-applicative >=0.18.1.0
, pantry >=0.9.2
, path
, path >=0.9.5
, path-io
, persistent >=2.14.0.0 && <2.15
, persistent-sqlite
Expand Down Expand Up @@ -602,7 +602,7 @@ executable stack-integration-test
, optparse-applicative >=0.18.1.0
, optparse-generic
, pantry >=0.9.2
, path
, path >=0.9.5
, path-io
, persistent >=2.14.0.0 && <2.15
, persistent-sqlite
Expand Down Expand Up @@ -718,7 +718,7 @@ test-suite stack-unit-test
, open-browser
, optparse-applicative >=0.18.1.0
, pantry >=0.9.2
, path
, path >=0.9.5
, path-io
, persistent >=2.14.0.0 && <2.15
, persistent-sqlite
Expand Down
2 changes: 2 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ extra-deps:
- optparse-applicative-0.18.1.0@sha256:b4cf8d9018e5e67cb1f14edb5130b6d05ad8bc1b5f6bd4efaa6ec0b7f28f559d,5132
- optparse-generic-1.5.1@sha256:c65a7d3429feedf870f5a9f7f0d2aaf75609888b52449f85f22871b5f5a7e95f,2204
- pantry-0.9.2@sha256:e1c5444d1b4003435d860853abd21e91e5fc337f2b2e2c8c992a2bac04712dc0,7650
# lts-21.16 comes with path-0.9.2
- path-0.9.5@sha256:3bdc437c4b120b90c222adf8324cbbe4fc35f7272a872dc4d003ea9292c56d1e,3273
# GHC 9.4.7 comes with process-1.6.17.0, which can segfault on macOS.
- process-1.6.18.0@sha256:cd0a3e0376b5a8525983d3131a31e52f9ffefc278ce635eec45a9d3987b8be3e,3025
- static-bytes-0.1.0@sha256:35dbf30f617baa0151682c97687042516be07872a39984f9fe31f78125b962bf,1627
Expand Down
7 changes: 7 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ packages:
size: 2665
original:
hackage: pantry-0.9.2@sha256:e1c5444d1b4003435d860853abd21e91e5fc337f2b2e2c8c992a2bac04712dc0,7650
- completed:
hackage: path-0.9.5@sha256:3bdc437c4b120b90c222adf8324cbbe4fc35f7272a872dc4d003ea9292c56d1e,3273
pantry-tree:
sha256: 1eacdfa4e7c0aa278229a9548692fe1e95fb0a6b21ec0c9bd3a73cc0b50d4878
size: 1206
original:
hackage: path-0.9.5@sha256:3bdc437c4b120b90c222adf8324cbbe4fc35f7272a872dc4d003ea9292c56d1e,3273
- completed:
hackage: process-1.6.18.0@sha256:cd0a3e0376b5a8525983d3131a31e52f9ffefc278ce635eec45a9d3987b8be3e,3025
pantry-tree:
Expand Down

0 comments on commit dee421d

Please sign in to comment.