strong-path 1.1.3.0 → 1.1.4.0
raw patch · 4 files changed
+18/−3 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ StrongPath.Instances: instance GHC.Classes.Ord (StrongPath.Internal.Path s b t)
Files
- README.md +1/−1
- src/StrongPath/Instances.hs +5/−1
- strong-path.cabal +1/−1
- test/StrongPath/InstanceTest.hs +11/−0
README.md view
@@ -1,6 +1,6 @@ # StrongPath -[](https://github.com/wasp-lang/strong-path/actions/workflows/ci.yaml?query=branch%3Amaster)+[](https://github.com/wasp-lang/strong-path/actions/workflows/ci.yaml?query=branch%3Amain) [](https://hackage.haskell.org/package/strong-path/docs/StrongPath.html) [](https://hackage.haskell.org/package/strong-path) [](http://stackage.org/lts/package/strong-path)
src/StrongPath/Instances.hs view
@@ -7,7 +7,7 @@ import StrongPath.Types -- Hashable instance for Path declared here, as an orphaned instance, instead of--- in StronPath.Internal to avoid cyclic dependency between StrongPath.FilePath+-- in StrongPath.Internal to avoid cyclic dependency between StrongPath.FilePath -- and StrongPath.Internal. (This cycle would arise due to the use of -- `toFilePath` from FilePath in the instance declaration and the dependency of -- the FilePath module on the types from the Internal module)@@ -18,3 +18,7 @@ -- they are different paths. instance Hashable (Path s b t) where hashWithSalt salt = hashWithSalt salt . toFilePath++-- Paths can be compared+instance Ord (Path s b t) where+ compare p1 p2 = compare (toFilePath p1) (toFilePath p2)
strong-path.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: strong-path-version: 1.1.3.0+version: 1.1.4.0 synopsis: Strongly typed paths in Haskell. 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. category: System, Filesystem, FilePath
test/StrongPath/InstanceTest.hs view
@@ -1,6 +1,7 @@ module StrongPath.InstanceTest where import Data.Hashable+import Data.List (sort) import StrongPath import Test.Hspec import Test.Tasty (TestTree)@@ -17,3 +18,13 @@ bPath <- parseRelDir "b" abPath <- parseRelDir "a/b" hash (aPath </> bPath) `shouldBe` hash abPath+ it "Paths can be compared" $ do+ aPath <- parseRelDir "a"+ bPath <- parseRelDir "b"+ aPath < bPath `shouldBe` True+ aPath > bPath `shouldBe` False+ it "Path can be sorted because they can be compared" $ do+ aPath <- parseRelDir "a"+ bPath <- parseRelDir "b"+ abPath <- parseRelDir "a/b"+ sort [bPath, abPath, aPath] `shouldBe` [aPath, abPath, bPath]