all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bruno Victal <mirai@makinata.eu>
To: 63985@debbugs.gnu.org
Cc: Bruno Victal <mirai@makinata.eu>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#63985] [PATCH v4 5/5] services: configuration: Add some commonly used predicates.
Date: Sat,  7 Oct 2023 16:59:09 +0100	[thread overview]
Message-ID: <d9c8e6d79e66360673a6e482c1fb83efcde59c38.1696694011.git.mirai@makinata.eu> (raw)
In-Reply-To: <cover.1696694011.git.mirai@makinata.eu>

* 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.
---
 doc/guix.texi                  |  6 +++---
 gnu/services/audio.scm         |  7 ++-----
 gnu/services/configuration.scm | 17 +++++++++++++++++
 gnu/services/telephony.scm     | 20 +++++++-------------
 4 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e4a1523dfb..1deb784f56 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -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.
 
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index 260abdefed..ae991ced4d 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -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)
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 @@ (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))
 
+\f
+;;;
+;;; 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?))
+
+\f
+;;;
+;;; Special serializers
+;;;
+
 (define alist?
   (list-of pair?))
 
diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm
index 56b7772f58..c9b5d6cd99 100644
--- a/gnu/services/telephony.scm
+++ b/gnu/services/telephony.scm
@@ -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)
 
-- 
2.41.0





  parent reply	other threads:[~2023-10-07 16:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 21:18 [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration Bruno Victal
2023-06-09 21:20 ` [bug#63985] [PATCH RFC 1/5] services: configuration: Simplify normalize-extra-args Bruno Victal
2023-06-09 21:20 ` [bug#63985] [PATCH RFC 2/5] services: configuration: Use transducers within serialize-configuration Bruno Victal
2023-06-09 21:20 ` [bug#63985] [PATCH RFC 3/5] services: fstrim-service-type: Serialize with SRFI-171 transducers Bruno Victal
2023-06-09 21:20 ` [bug#63985] [PATCH RFC 4/5] services: configuration: Add serializer-kwargs field Bruno Victal
2023-06-09 21:21 ` [bug#63985] [PATCH RFC 5/5] services: configuration: New generic-ini module Bruno Victal
2023-06-10 20:10 ` [bug#63985] [PATCH RFC v2 1/5] services: configuration: Simplify normalize-extra-args Bruno Victal
2023-06-10 20:10 ` [bug#63985] [PATCH RFC v2 2/5] services: configuration: Use transducers within serialize-configuration Bruno Victal
2023-06-10 20:10 ` [bug#63985] [PATCH RFC v2 3/5] services: fstrim-service-type: Serialize with SRFI-171 transducers Bruno Victal
2023-06-10 20:10 ` [bug#63985] [PATCH RFC v2 4/5] services: configuration: Add serializer-options field Bruno Victal
2023-06-10 20:10 ` [bug#63985] [PATCH RFC v2 5/5] services: configuration: New generic-ini module Bruno Victal
2023-06-26 21:57 ` [bug#63985] [PATCH v3 00/11] Service subsystem improvements Bruno Victal
2023-06-26 21:59   ` [bug#63985] [PATCH v3 01/11] services: configuration: Simplify normalize-extra-args Bruno Victal
2023-10-02 17:00     ` [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration Maxim Cournoyer
2023-10-07 12:36       ` [bug#63985] [PATCH v3 01/11] services: configuration: Simplify normalize-extra-args. (was: bug#63985: [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration) Bruno Victal
2023-06-26 21:59   ` [bug#63985] [PATCH v3 02/11] services: configuration: Use transducers within serialize-configuration Bruno Victal
2023-10-02 17:25     ` [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration Maxim Cournoyer
2023-10-07 13:39       ` [bug#63985] [PATCH v3 02/11] services: configuration: Use transducers within serialize-configuration. (was : bug#63985: [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration) Bruno Victal
2023-10-07 14:37         ` Maxim Cournoyer
2023-06-26 21:59   ` [bug#63985] [PATCH v3 03/11] services: fstrim-service-type: Serialize with SRFI-171 transducers Bruno Victal
2023-06-26 21:59   ` [bug#63985] [PATCH v3 04/11] doc: Rewrite define-configuration Bruno Victal
2023-10-02 18:28     ` [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration Maxim Cournoyer
2023-10-07 14:21       ` Bruno Victal
2023-10-07 16:35         ` Maxim Cournoyer
2023-06-26 21:59   ` [bug#63985] [PATCH v3 05/11] services: configuration: Add serializer-options field Bruno Victal
2023-10-02 19:12     ` [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration Maxim Cournoyer
2023-10-06 18:29       ` Bruno Victal
2023-06-26 21:59   ` [bug#63985] [PATCH v3 06/11] services: configuration: New generic-ini module Bruno Victal
2023-10-02 19:15     ` [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration Maxim Cournoyer
2023-06-26 21:59   ` [bug#63985] [PATCH v3 07/11] services: configuration: Add some commonly used predicates Bruno Victal
2023-06-26 21:59   ` [bug#63985] [PATCH v3 08/11] services: NetworkManager: Use define-configuration and generic-ini Bruno Victal
2023-06-26 21:59   ` [bug#63985] [PATCH v3 09/11] services: NetworkManager: Prefer package over network-manager Bruno Victal
2023-10-02 16:52     ` [bug#63985] [PATCH RFC 0/5] Generic INI serializer & SRFI-171 for define-configuration Maxim Cournoyer
2023-06-26 21:59   ` [bug#63985] [PATCH v3 10/11] services: NetworkManager: add log-configuration field Bruno Victal
2023-10-05 16:57     ` Maxim Cournoyer
2023-06-26 21:59   ` [bug#63985] [PATCH v3 11/11] services: NetworkManager: Add extra-options field Bruno Victal
2023-10-05 16:59     ` Maxim Cournoyer
2023-06-27  4:20   ` [bug#63985] [PATCH v3 00/11] Service subsystem improvements Liliana Marie Prikler
2023-09-16 21:22   ` Bruno Victal
2023-09-16 21:55     ` Liliana Marie Prikler
2023-09-23 13:35       ` Bruno Victal
2023-09-23 15:22         ` Liliana Marie Prikler
2023-09-25 14:06       ` Ludovic Courtès
2023-10-07 15:57 ` [bug#63985] [PATCH v4 0/5] SRFI-171 based improvements for define-configuration Bruno Victal
2023-10-07 15:57   ` [bug#63985] [PATCH v4 2/5] services: configuration: Use transducers within serialize-configuration Bruno Victal
2023-10-07 15:59   ` [bug#63985] [PATCH v4 1/5] services: configuration: Simplify normalize-extra-args Bruno Victal
2023-10-07 15:59   ` [bug#63985] [PATCH v4 3/5] services: fstrim-service-type: Serialize with SRFI-171 transducers Bruno Victal
2023-10-07 15:59   ` [bug#63985] [PATCH v4 4/5] doc: Rewrite define-configuration Bruno Victal
2023-10-07 15:59   ` Bruno Victal [this message]
2023-10-07 16:57   ` bug#63985: SRFI-171 based improvements for define-configuration Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9c8e6d79e66360673a6e482c1fb83efcde59c38.1696694011.git.mirai@makinata.eu \
    --to=mirai@makinata.eu \
    --cc=63985@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.