From 00a28bc435606dc98925fbae1ebe314881f35c90 Mon Sep 17 00:00:00 2001 From: Bruno Victal Date: Sat, 7 Oct 2023 16:59:09 +0100 Subject: services: configuration: Add some commonly used predicates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/configuration.scm (list-of-packages?, list-of-symbols?): New predicate. * gnu/services/audio.scm (list-of-symbol?): Remove. * gnu/services/telephony.scm (string-list?): Remove. (serialize-string-list): Rename to … (serialize-list-of-strings): … this. (account-fingerprint-list?, jami-account-list?): Use list-of. * doc/guix.texi: Update it. Signed-off-by: Maxim Cournoyer --- gnu/services/configuration.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gnu/services/configuration.scm') diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index aa5fb832d5..d2b1687496 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -80,7 +80,9 @@ interpose list-of + list-of-packages? list-of-strings? + list-of-symbols? alist? serialize-file-like text-config? @@ -500,6 +502,11 @@ DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values." (cons delimiter acc)))) '() ls)) + +;;; +;;; Commonly used predicates +;;; + (define (list-of pred?) "Return a procedure that takes a list and check if all the elements of the list result in @code{#t} when applying PRED? on them." @@ -508,10 +515,20 @@ the list result in @code{#t} when applying PRED? on them." (every pred? x) #f))) +(define list-of-packages? + (list-of package?)) (define list-of-strings? (list-of string?)) +(define list-of-symbols? + (list-of symbol?)) + + +;;; +;;; Special serializers +;;; + (define alist? (list-of pair?)) -- cgit v1.2.3