Rename parentAbs to parent
This commit is contained in:
parent
c0e93d2167
commit
ef8503f38f
@ -1,5 +1,5 @@
|
|||||||
name: path
|
name: path
|
||||||
version: 0.1.0
|
version: 0.2.0
|
||||||
synopsis: Path
|
synopsis: Path
|
||||||
description: Path
|
description: Path
|
||||||
license: BSD3
|
license: BSD3
|
||||||
|
12
src/Path.hs
12
src/Path.hs
@ -27,7 +27,7 @@ module Path
|
|||||||
,(</>)
|
,(</>)
|
||||||
,stripDir
|
,stripDir
|
||||||
,isParentOf
|
,isParentOf
|
||||||
,parentAbs
|
,parent
|
||||||
,filename
|
,filename
|
||||||
-- * Conversion
|
-- * Conversion
|
||||||
,toFilePath
|
,toFilePath
|
||||||
@ -234,17 +234,17 @@ isParentOf p l =
|
|||||||
--
|
--
|
||||||
-- The following properties hold:
|
-- The following properties hold:
|
||||||
--
|
--
|
||||||
-- @parentAbs (parent \<\/> child) == parent@
|
-- @parent (parent \<\/> child) == parent@
|
||||||
--
|
--
|
||||||
-- On the root, getting the parent is idempotent:
|
-- On the root, getting the parent is idempotent:
|
||||||
--
|
--
|
||||||
-- @parentAbs (parentAbs \"\/\") = \"\/\"@
|
-- @parent (parent \"\/\") = \"\/\"@
|
||||||
--
|
--
|
||||||
parentAbs :: Path Abs t -> Path Abs Dir
|
parent :: Path Abs t -> Path Abs Dir
|
||||||
parentAbs (Path fp) =
|
parent (Path fp) =
|
||||||
Path (normalizeDir (FilePath.takeDirectory (FilePath.dropTrailingPathSeparator fp)))
|
Path (normalizeDir (FilePath.takeDirectory (FilePath.dropTrailingPathSeparator fp)))
|
||||||
|
|
||||||
-- | Extract the relative filename from a given location.
|
-- | Extract the file part of a path.
|
||||||
--
|
--
|
||||||
-- The following properties hold:
|
-- The following properties hold:
|
||||||
--
|
--
|
||||||
|
10
test/Main.hs
10
test/Main.hs
@ -42,14 +42,14 @@ operationFilename =
|
|||||||
operationParentAbs :: Spec
|
operationParentAbs :: Spec
|
||||||
operationParentAbs =
|
operationParentAbs =
|
||||||
do it "parentAbs (parent </> child) == parent"
|
do it "parentAbs (parent </> child) == parent"
|
||||||
(parentAbs ($(mkAbsDir "/foo") </>
|
(parent ($(mkAbsDir "/foo") </>
|
||||||
$(mkRelDir "bar")) ==
|
$(mkRelDir "bar")) ==
|
||||||
$(mkAbsDir "/foo"))
|
$(mkAbsDir "/foo"))
|
||||||
it "parentAbs \"\" == \"\""
|
it "parent \"\" == \"\""
|
||||||
(parentAbs $(mkAbsDir "/") ==
|
(parent $(mkAbsDir "/") ==
|
||||||
$(mkAbsDir "/"))
|
$(mkAbsDir "/"))
|
||||||
it "parentAbs (parentAbs \"\") == \"\""
|
it "parent (parent \"\") == \"\""
|
||||||
(parentAbs (parentAbs $(mkAbsDir "/")) ==
|
(parent (parent $(mkAbsDir "/")) ==
|
||||||
$(mkAbsDir "/"))
|
$(mkAbsDir "/"))
|
||||||
|
|
||||||
-- | The 'isParentOf' operation.
|
-- | The 'isParentOf' operation.
|
||||||
|
Loading…
Reference in New Issue
Block a user