path 0.4.0 → 0.5.0
raw patch · 5 files changed
+27/−3 lines, 5 files
Files
- CHANGELOG +14/−0
- README.md +4/−0
- path.cabal +2/−1
- src/Path.hs +3/−2
- test/Main.hs +4/−0
+ CHANGELOG view
@@ -0,0 +1,14 @@+0.2.0:++ * Rename parentAbs to simply parent.+ * Add dirname.++0.3.0:+ * Removed Generic instance.++0.4.0:+ * Implemented stricter parsing, disabling use of "..".+ * Made stripDir generic over MonadThrow++0.5.0:+ * Fix stripDir p p /= Nothing bug.
+ README.md view
@@ -0,0 +1,4 @@+path+=====++Support for well-typed paths in Haskell.
path.cabal view
@@ -1,5 +1,5 @@ name: path-version: 0.4.0+version: 0.5.0 synopsis: Path description: Path license: BSD3@@ -10,6 +10,7 @@ category: Filesystem build-type: Simple cabal-version: >=1.8+extra-source-files: README.md, CHANGELOG library hs-source-dirs: src/
src/Path.hs view
@@ -244,9 +244,10 @@ stripDir :: MonadThrow m => Path b Dir -> Path b t -> m (Path Rel t) stripDir (Path p) (Path l) =- case fmap Path (stripPrefix p l) of+ case stripPrefix p l of Nothing -> throwM (Couldn'tStripPrefixDir p l)- Just ok -> return ok+ Just "" -> throwM (Couldn'tStripPrefixDir p l)+ Just ok -> return (Path ok) -- | Is p a parent of the given location? Implemented in terms of -- 'stripDir'. The bases must match.
test/Main.hs view
@@ -101,6 +101,10 @@ ($(mkRelDir "bar/") </> $(mkRelFile "bob/foo.txt")) == Just $(mkRelFile "bob/foo.txt"))+ it "stripDir parent parent = _|_"+ (stripDir $(mkAbsDir "/home/chris/foo")+ $(mkAbsDir "/home/chris/foo") ==+ Nothing) -- | The '</>' operation. operationAppend :: Spec