aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-24 22:27:35 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-24 23:02:26 +0200
commit0a90af153199b03deced53da7ef7f50f0e561f80 (patch)
tree38c39490e95c2f2efc61ef9ab74de1bffd35e851 /doc
parent7ab44369b34a23e5d22ac51b7fbfe31c0de9fbfd (diff)
downloadpatches-0a90af153199b03deced53da7ef7f50f0e561f80.tar
patches-0a90af153199b03deced53da7ef7f50f0e561f80.tar.gz
monads: Add 'interned-file'.
* guix/monads.scm (interned-file): New procedure. * tests/monads.scm ("interned-file"): New test. * doc/guix.texi (The Store Monad): Document it.
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 2f44ce9506..c504a5d0ba 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2012,6 +2012,29 @@ will references @var{coreutils}, @var{grep}, and @var{sed}, thereby
preventing them from being garbage-collected during its lifetime.
@end deffn
+@deffn {Monadic Procedure} interned-file @var{file} [@var{name}] @
+ [#:recursive? #t]
+Return the name of @var{file} once interned in the store. Use
+@var{name} as its store name, or the basename of @var{file} if
+@var{name} is omitted.
+
+When @var{recursive?} is true, the contents of @var{file} are added
+recursively; if @var{file} designates a flat file and @var{recursive?}
+is true, its contents are added, and its permission bits are kept.
+
+The example below adds a file to the store, under two different names:
+
+@example
+(run-with-store (open-connection)
+ (mlet %store-monad ((a (interned-file "README"))
+ (b (interned-file "README" "LEGU-MIN")))
+ (return (list a b))))
+
+@result{} ("/gnu/store/rwm@dots{}-README" "/gnu/store/44i@dots{}-LEGU-MIN")
+@end example
+
+@end deffn
+
@deffn {Monadic Procedure} package-file @var{package} [@var{file}] @
[#:system (%current-system)] [#:output "out"] Return as a monadic
value in the absolute file name of @var{file} within the @var{output}