@@ -28188,7 +28188,7 @@ Telephony Services
connection to the Internet has been lost. When left unspecified,
the value from the account archive prevails.
-@item @code{bootstrap-hostnames} (type: maybe-string-list)
+@item @code{bootstrap-hostnames} (type: maybe-list-of-strings)
A list of hostnames or IPs pointing to OpenDHT nodes, that should be
used to initially join the OpenDHT network. When left unspecified, the
value from the account archive prevails.
@@ -34509,7 +34509,7 @@ Audio Services
The default @code{%mpd-group} is a system group with name ``mpd''.
-@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbol)
+@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbols)
A list of symbols naming Shepherd services that this service
will depend on.
@@ -34759,7 +34759,7 @@ Audio Services
@item @code{package} (default: @code{mympd}) (type: file-like)
The package object of the myMPD server.
-@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbol)
+@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbols)
This is a list of symbols naming Shepherd services that this service
will depend on.
@@ -138,9 +138,6 @@ (define (uglify-field-name field-name)
str)
#\-) "_")))
-(define list-of-symbol?
- (list-of symbol?))
-
;; Helpers for deprecated field types, to be removed later.
(define %lazy-group (make-symbol "%lazy-group"))
@@ -428,7 +425,7 @@ (define-configuration mpd-configuration
(sanitizer mpd-group-sanitizer))
(shepherd-requirement
- (list-of-symbol '())
+ (list-of-symbols '())
"This is a list of symbols naming Shepherd services that this service
will depend on."
empty-serializer)
@@ -763,7 +760,7 @@ (define-configuration/no-serialization mympd-configuration
empty-serializer)
(shepherd-requirement
- (list-of-symbol '())
+ (list-of-symbols '())
"This is a list of symbols naming Shepherd services that this service
will depend on."
empty-serializer)
@@ -80,7 +80,9 @@ (define-module (gnu services configuration)
interpose
list-of
+ list-of-packages?
list-of-strings?
+ list-of-symbols?
alist?
serialize-file-like
text-config?
@@ -500,6 +502,11 @@ (define* (interpose ls #:optional (delimiter "\n") (grammar 'infix))
(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 @@ (define (list-of pred?)
(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?))
@@ -117,15 +117,10 @@ (define (string-or-computed-file? val)
(or (string? val)
(computed-file? val)))
-(define (string-list? val)
- (and (list? val)
- (and-map string? val)))
+(define account-fingerprint-list?
+ (list-of account-fingerprint?))
-(define (account-fingerprint-list? val)
- (and (list? val)
- (and-map account-fingerprint? val)))
-
-(define-maybe string-list)
+(define-maybe list-of-strings)
(define-maybe/no-serialization account-fingerprint-list)
@@ -135,7 +130,7 @@ (define-maybe string)
;;; The following serializers are used to derive an account details alist from
;;; a <jami-account> record.
-(define (serialize-string-list _ val)
+(define (serialize-list-of-strings _ val)
(string-join val ";"))
(define (serialize-boolean _ val)
@@ -188,7 +183,7 @@ (define-configuration jami-account
connection to the the Internet has been lost. When left unspecified, the
value from the account archive prevails.")
(bootstrap-hostnames
- maybe-string-list
+ maybe-list-of-strings
"A list of hostnames or IPs pointing to OpenDHT nodes, that should be used
to initially join the OpenDHT network. When left unspecified, the value from
the account archive prevails.")
@@ -220,9 +215,8 @@ (define (jami-account->alist jami-account-object)
(list-transduce jami-account-transducer rcons jami-account-fields))
-(define (jami-account-list? val)
- (and (list? val)
- (and-map jami-account? val)))
+(define jami-account-list?
+ (list-of jami-account?))
(define-maybe/no-serialization jami-account-list)