summaryrefslogtreecommitdiff
path: root/lib/path
diff options
context:
space:
mode:
authorSilvan Mosberger <silvan.mosberger@tweag.io>2023-04-05 20:27:46 +0200
committerSilvan Mosberger <silvan.mosberger@tweag.io>2023-04-05 20:27:46 +0200
commit866f75e5b9579a4c4f6391b68c2a31633ab13e30 (patch)
tree699131ddb9a93aead9753e86ea13036a1fe52468 /lib/path
parentMerge pull request #224823 from Uthar/clasp-arm (diff)
downloadnixpkgs-866f75e5b9579a4c4f6391b68c2a31633ab13e30.tar.gz
lib.path.append: Add a law
With removePrefix introduced in a future commit this law can then be used to derive removePrefix p (append p s) == subpath.normalise s => (wrap with append) append p (removePrefix p (append p s)) == append p (subpath.normalise s) => (append is not influenced by subpath normalisation) append p (removePrefix p (append p s)) == append p s => (substitute q = append p s) append p (removePrefix p q) == q Not included in the docs because it's not that important, just shows that the first statement is more general than the second one (because this derivation doesn't work the other way)
Diffstat (limited to 'lib/path')
-rw-r--r--lib/path/default.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/path/default.nix b/lib/path/default.nix
index a4a08668ae62..442060c18643 100644
--- a/lib/path/default.nix
+++ b/lib/path/default.nix
@@ -108,6 +108,12 @@ in /* No rec! Add dependencies on this file at the top. */ {
More specifically, it checks that the first argument is a [path value type](https://nixos.org/manual/nix/stable/language/values.html#type-path"),
and that the second argument is a valid subpath string (see `lib.path.subpath.isValid`).
+ Laws:
+
+ - Not influenced by subpath normalisation
+
+ append p s == append p (subpath.normalise s)
+
Type:
append :: Path -> String -> Path