Ludovic Courtès <ludo@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 22:18:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 17:18:39 2025 Received: from localhost ([127.0.0.1]:33388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpab1-0003j7-4H for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:18:39 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:54592) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tpaax-0003iq-WC for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:18:36 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 171942FC; Tue, 4 Mar 2025 23:18:28 +0100 (CET) Authentication-Results: hera.aquilenet.fr; none X-Virus-Scanned: Debian amavis at hera.aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavis, port 10024) with ESMTP id Pb8A_MnGKi_n; Tue, 4 Mar 2025 23:18:27 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 41E262F6; Tue, 4 Mar 2025 23:18:26 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH] gexp: =?utf-8?Q?=E2=80=98with-parameters?= =?utf-8?Q?=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <868qpky1uc.fsf@HIDDEN> (David Elsing's message of "Tue, 04 Mar 2025 20:31:39 +0000") References: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> <86jz9dslcg.fsf@HIDDEN> <87ldtrybf7.fsf@HIDDEN> <86eczgsko0.fsf@HIDDEN> <87zfi2c7q0.fsf@HIDDEN> <868qpky1uc.fsf@HIDDEN> Date: Tue, 04 Mar 2025 23:18:25 +0100 Message-ID: <87ikoo8moe.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: hera X-Rspamd-Queue-Id: 171942FC X-Spamd-Result: default: False [4.90 / 15.00]; SPAM_FLAG(5.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_SPAM(3.00)[0.999]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; SUBJECT_HAS_QUESTION(0.00)[] X-Spamd-Bar: ++++ X-Rspamd-Action: no action X-Spam-Level: **** X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Hey David, David Elsing <david.elsing@HIDDEN> skribis: > Ah yes, but I don't think a generic solution is needed at this point, as > only the state monad is used in Guix. :) > I also tried to find a general way to apply `with-fluids*' for monads in > `mparameterize' and then noticed it might not make much sense. Yeah, I agree. >> The core of the problem here is that (guix monads), to a large extent, >> addresses problems already addressed by other Scheme constructs such as >> parameters/fluids, but in an incompatible way. So really, >> =E2=80=98mparameterize=E2=80=99 and the many commits that fixed interact= ions between >> =E2=80=98%current-system=E2=80=99 & co. and the monad are really band ai= d. > > I don't find the combination of the state monad and parameters so bad, > and the idea of using the store monad to accumulate what to build is > quite nice. That=E2=80=99s right, glad you like it. :-) Overall I think the initial motivation for having monads (the =E2=80=9Cstor= e=E2=80=9D monad in particular) still makes sense. It=E2=80=99s the integration that turned out to be clumsier than expected. > To me the combination with prompts is a bit confusing though, it might > be clearer to have continuations as part of the store monad. I=E2=80=99m not sure. In a way, file-like objects achieve something simila= r to the store monad, but in a more =E2=80=9CSchemey=E2=80=9D way. Likewise, Sc= heme has delimited continuations, which is dynamic in nature; in other languages one would use a monad for that but in Scheme it would be questionable as it wouldn=E2=80=99t play well with other features (first of all by =E2=80=9Ccontaminating=E2=80=9D non-monadic procedures). > Oh, maybe you didn't see my previous patch where I specialized > `mcall-with-parameters' and `mparameterize' to the state monad, I only > sent it to Debbugs. I updated the patch and used your workaround for > avoiding using `with-fluids*' by setting and later restoring the > parameters. I actually did see it but I was in a state of confusion. :-) Thanks for your patience and for your work! Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 22:16:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 17:16:16 2025 Received: from localhost ([127.0.0.1]:33381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpaYh-0003es-HV for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:16:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44714) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tpaYP-0003d9-CO for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:15:59 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tpaYJ-0002Gv-V8; Tue, 04 Mar 2025 17:15:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=PAjbOj+rX+fDAHImZzv+cKBc+Wjp4+JmxJq3faQW9/Y=; b=YlkRpZ49enQu+VWsysHg iHuBeplC97R7ra39J6ZB9mh/SO41hLI0ug+8yGF3NnaEM6uFsmXy8srfA9NVfsgLk5Y2R7NmfQIbW kin9kQUXZQTnAOkdevNojWGUH99mrrqSipF6gFJcA0IWt1yie3dnX9crpAeR7p1dv1cFFDKjB7AX6 kOHrLUeq/eaul/8TXrhyL+/TLNP6RTvkON2C65FZp/xG9JkWW3tUqjysVb/D3U3d10XLbi6GGO7Kd 35v1d/xdBlGgMq/iFLr2G2n5vGBEcNNWziX+MZLKLq7iETasdRUFDYrNRdH6KEWzUsZ4vy/+cGZib mSQoBIN7XU7yGw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH v2] gexp: =?utf-8?Q?=E2=80=98with-paramete?= =?utf-8?Q?rs=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <20250304203337.2628-1-david.elsing@HIDDEN> (David Elsing's message of "Tue, 4 Mar 2025 20:33:08 +0000") References: <868qpky1uc.fsf@HIDDEN> <20250304203337.2628-1-david.elsing@HIDDEN> Date: Tue, 04 Mar 2025 23:08:11 +0100 Message-ID: <87zfi08n5g.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, David Elsing <david.elsing@HIDDEN> skribis: > Fixes <https://issues.guix.gnu.org/75879>. > > * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules. > Add state-parameterize and store-parameterize indentation rules. > * etc/manifests/system-tests.scm (test-for-current-guix): Replace > mparameterize with store-parameterize. > * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise. > * gnu/tests.scm (compile-system-test): Likewise. > * guix/gexp.scm (compile-parameterized): Use state-call-with-parameters. > * guix/monads.scm (mparameterize): Remove macro. > (state-call-with-parameters): New procedure. > (state-parameterize): New macro. > * guix/store.scm (store-parameterize): New macro. > * tests/gexp.scm ("with-parameters for %graft?"): New test. > * tests/monads.scm ("mparameterize"): Remove test. > ("state-parameterize"): New test. > > Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN> Applied with the change below, in accordance with the deprecation policy. Thank you! Ludo=E2=80=99. PS: Let me know if I got the copyright line wrong. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/guix/monads.scm b/guix/monads.scm index 0df82bb4653..e1b056dc95f 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2017, 2022 Ludovic Court=C3=A8s <lu= do@HIDDEN> +;;; Copyright =C2=A9 2013-2015, 2017, 2022, 2025 Ludovic Court=C3=A8s <lud= o@HIDDEN> +;;; Copyright =C2=A9 2025 David Elsing <david.elsing@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +20,7 @@ (define-module (guix monads) #:use-module ((system syntax) #:select (syntax-local-binding)) + #:autoload (guix deprecation) (warn-about-deprecation) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -58,7 +60,8 @@ (define-module (guix monads) state-push state-pop run-with-state - state-parameterize)) + state-parameterize + mparameterize)) =20 ;;; Commentary: ;;; @@ -618,4 +621,15 @@ (define-syntax state-parameterize (lambda () (mbegin %state-monad body ...)))))))) =20 +(define-syntax mparameterize ;can be removed after 2026-0= 3-05 + (lambda (s) + "This is the old form for 'state-parameterize', which pretended to work +with any monad but was in fact specialized for '%state-monad'." + (syntax-case s () + ((_ monad bindings body ...) + (begin + (warn-about-deprecation 'mparameterize (current-source-location) + #:replacement 'state-parameterize) + #'(state-parameterize bindings body ...)))))) + ;;; monads.scm end here --=-=-=--
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 22:16:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 17:16:15 2025 Received: from localhost ([127.0.0.1]:33379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpaYh-0003eo-3r for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:16:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44710) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tpaYP-0003d7-4O for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:15:59 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tpaYJ-0002Gy-0P; Tue, 04 Mar 2025 17:15:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=PAjbOj+rX+fDAHImZzv+cKBc+Wjp4+JmxJq3faQW9/Y=; b=qP/hVDzJZvxcJw0OoyDH P7spxf55rou+Qhi/fn6VmSampkWZWUoPozp6uZ4AABcT/6RladHWnLYpei/9kpKRpJbCBESg6yaZB yZsPU87WqHYlgGV83h/unC6OsYAMWEMec8WHmDZSuQ+TjBKqj+txlkxmHZKEAQOzW9eLp+V9MdEJ+ e9vcM/6aOdGox+0vK+amDMzw742v5KVkJyuFItDCFTl4yTa0SgOr1zM+M4b9x160ddwgCkAIjIYuP Wyt6tpoMp+tNvhoZBU0eXArU2TuSDom07LFPP4CRvzzYz0OLbITtCa+qC9Vb4cUhvT5Mrv4j9Zqps 2z6Tme4YtiQ9/g==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH v2] gexp: =?utf-8?Q?=E2=80=98with-paramete?= =?utf-8?Q?rs=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <20250304203337.2628-1-david.elsing@HIDDEN> (David Elsing's message of "Tue, 4 Mar 2025 20:33:08 +0000") References: <868qpky1uc.fsf@HIDDEN> <20250304203337.2628-1-david.elsing@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 04 Mar 2025 23:09:59 +0100 Message-ID: <87wmd48n2g.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, David Elsing <david.elsing@HIDDEN> skribis: > Fixes <https://issues.guix.gnu.org/75879>. > > * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules. > Add state-parameterize and store-parameterize indentation rules. > * etc/manifests/system-tests.scm (test-for-current-guix): Replace > mparameterize with store-parameterize. > * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise. > * gnu/tests.scm (compile-system-test): Likewise. > * guix/gexp.scm (compile-parameterized): Use state-call-with-parameters. > * guix/monads.scm (mparameterize): Remove macro. > (state-call-with-parameters): New procedure. > (state-parameterize): New macro. > * guix/store.scm (store-parameterize): New macro. > * tests/gexp.scm ("with-parameters for %graft?"): New test. > * tests/monads.scm ("mparameterize"): Remove test. > ("state-parameterize"): New test. > > Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN> Applied with the change below, in accordance with the deprecation policy. Thank you! Ludo=E2=80=99. PS: Let me know if I got the copyright line wrong. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/guix/monads.scm b/guix/monads.scm index 0df82bb4653..e1b056dc95f 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2017, 2022 Ludovic Court=C3=A8s <lu= do@HIDDEN> +;;; Copyright =C2=A9 2013-2015, 2017, 2022, 2025 Ludovic Court=C3=A8s <lud= o@HIDDEN> +;;; Copyright =C2=A9 2025 David Elsing <david.elsing@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +20,7 @@ (define-module (guix monads) #:use-module ((system syntax) #:select (syntax-local-binding)) + #:autoload (guix deprecation) (warn-about-deprecation) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -58,7 +60,8 @@ (define-module (guix monads) state-push state-pop run-with-state - state-parameterize)) + state-parameterize + mparameterize)) =20 ;;; Commentary: ;;; @@ -618,4 +621,15 @@ (define-syntax state-parameterize (lambda () (mbegin %state-monad body ...)))))))) =20 +(define-syntax mparameterize ;can be removed after 2026-0= 3-05 + (lambda (s) + "This is the old form for 'state-parameterize', which pretended to work +with any monad but was in fact specialized for '%state-monad'." + (syntax-case s () + ((_ monad bindings body ...) + (begin + (warn-about-deprecation 'mparameterize (current-source-location) + #:replacement 'state-parameterize) + #'(state-parameterize bindings body ...)))))) + ;;; monads.scm end here --=-=-=--
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 22:16:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 17:16:14 2025 Received: from localhost ([127.0.0.1]:33377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpaYg-0003ec-FP for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:16:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44692) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tpaYO-0003d5-RF for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:15:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tpaYI-0002Gx-Tj; Tue, 04 Mar 2025 17:15:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=PAjbOj+rX+fDAHImZzv+cKBc+Wjp4+JmxJq3faQW9/Y=; b=hX8bNhCDg3EFBl+ezRER WIEY2lEBExLw9bRBQueOyEcDyu/Kot91dq/7Tc8C+K3jv3qPhPVC57uTcZLuspht8vcUq1j2ykAP7 CJVY4hvStOzauV6AAvbbcq9Pqye2JRaDKT/sx5onX38LCQA+gtslA2faEPM7UltCsYbqVs7+0v4HR 5XT9jbbrQWLO5pYe3b6SrEFrNWD8CSaPRrfkF5TsxZU36o9V/1mwSFWlj1FaEwLaCIkp0KJZmuVAO 44CpPi3ZLk8woLYmMz+DngUSRTLcna4wgsLZMwrHTil1d/1tlCA38vufcnYd95TOZAHjWrmfLU0TL iW5eEfNMJV9HcA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH v2] gexp: =?utf-8?Q?=E2=80=98with-paramete?= =?utf-8?Q?rs=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <20250304203337.2628-1-david.elsing@HIDDEN> (David Elsing's message of "Tue, 4 Mar 2025 20:33:08 +0000") References: <868qpky1uc.fsf@HIDDEN> <20250304203337.2628-1-david.elsing@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 04 Mar 2025 23:10:28 +0100 Message-ID: <87v7so8n1n.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, David Elsing <david.elsing@HIDDEN> skribis: > Fixes <https://issues.guix.gnu.org/75879>. > > * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules. > Add state-parameterize and store-parameterize indentation rules. > * etc/manifests/system-tests.scm (test-for-current-guix): Replace > mparameterize with store-parameterize. > * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise. > * gnu/tests.scm (compile-system-test): Likewise. > * guix/gexp.scm (compile-parameterized): Use state-call-with-parameters. > * guix/monads.scm (mparameterize): Remove macro. > (state-call-with-parameters): New procedure. > (state-parameterize): New macro. > * guix/store.scm (store-parameterize): New macro. > * tests/gexp.scm ("with-parameters for %graft?"): New test. > * tests/monads.scm ("mparameterize"): Remove test. > ("state-parameterize"): New test. > > Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN> Applied with the change below, in accordance with the deprecation policy. Thank you! Ludo=E2=80=99. PS: Let me know if I got the copyright line wrong. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/guix/monads.scm b/guix/monads.scm index 0df82bb4653..e1b056dc95f 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2017, 2022 Ludovic Court=C3=A8s <lu= do@HIDDEN> +;;; Copyright =C2=A9 2013-2015, 2017, 2022, 2025 Ludovic Court=C3=A8s <lud= o@HIDDEN> +;;; Copyright =C2=A9 2025 David Elsing <david.elsing@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +20,7 @@ (define-module (guix monads) #:use-module ((system syntax) #:select (syntax-local-binding)) + #:autoload (guix deprecation) (warn-about-deprecation) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -58,7 +60,8 @@ (define-module (guix monads) state-push state-pop run-with-state - state-parameterize)) + state-parameterize + mparameterize)) =20 ;;; Commentary: ;;; @@ -618,4 +621,15 @@ (define-syntax state-parameterize (lambda () (mbegin %state-monad body ...)))))))) =20 +(define-syntax mparameterize ;can be removed after 2026-0= 3-05 + (lambda (s) + "This is the old form for 'state-parameterize', which pretended to work +with any monad but was in fact specialized for '%state-monad'." + (syntax-case s () + ((_ monad bindings body ...) + (begin + (warn-about-deprecation 'mparameterize (current-source-location) + #:replacement 'state-parameterize) + #'(state-parameterize bindings body ...)))))) + ;;; monads.scm end here --=-=-=--
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 22:16:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 17:16:14 2025 Received: from localhost ([127.0.0.1]:33375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpaYc-0003eT-Pa for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:16:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44708) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tpaYO-0003d6-TY for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:15:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tpaYJ-0002Gw-9b; Tue, 04 Mar 2025 17:15:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=PAjbOj+rX+fDAHImZzv+cKBc+Wjp4+JmxJq3faQW9/Y=; b=LZITomYRUVlkJtW4X7cC mP1uYJRguuDnUSVXlTcii2vmwfcPG7q7/xgqnhoY8mHhnHMAjlLQc/6q69PSiB01utOLMEoeD9XsM KfW0237Z9FKStsqeUuKpkSfFdaRaii5qzt0SI8EUZCUqud1ki7dipJLXagzv5J5WcI7wXbIp0DkLA xMcs9mrs32vJRnlMdUNe9HEwNMVNulnyFRpR5VIkoewbeRJMibdSbFzHsYyN8bb3/cFh5pCq2LfbX Afd5+vKZleDqFm70fsrr/FicI0cqSXh1VfLzlSctW3kjO33BApoI/pBrUkG8XSz8V6bO8D2FvGAAG gLmyVJrD2n1V7Q==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH v2] gexp: =?utf-8?Q?=E2=80=98with-paramete?= =?utf-8?Q?rs=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <20250304203337.2628-1-david.elsing@HIDDEN> (David Elsing's message of "Tue, 4 Mar 2025 20:33:08 +0000") References: <868qpky1uc.fsf@HIDDEN> <20250304203337.2628-1-david.elsing@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 04 Mar 2025 23:09:09 +0100 Message-ID: <87y0xk8n3u.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, David Elsing <david.elsing@HIDDEN> skribis: > Fixes <https://issues.guix.gnu.org/75879>. > > * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules. > Add state-parameterize and store-parameterize indentation rules. > * etc/manifests/system-tests.scm (test-for-current-guix): Replace > mparameterize with store-parameterize. > * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise. > * gnu/tests.scm (compile-system-test): Likewise. > * guix/gexp.scm (compile-parameterized): Use state-call-with-parameters. > * guix/monads.scm (mparameterize): Remove macro. > (state-call-with-parameters): New procedure. > (state-parameterize): New macro. > * guix/store.scm (store-parameterize): New macro. > * tests/gexp.scm ("with-parameters for %graft?"): New test. > * tests/monads.scm ("mparameterize"): Remove test. > ("state-parameterize"): New test. > > Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN> Applied with the change below, in accordance with the deprecation policy. Thank you! Ludo=E2=80=99. PS: Let me know if I got the copyright line wrong. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/guix/monads.scm b/guix/monads.scm index 0df82bb4653..e1b056dc95f 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2017, 2022 Ludovic Court=C3=A8s <lu= do@HIDDEN> +;;; Copyright =C2=A9 2013-2015, 2017, 2022, 2025 Ludovic Court=C3=A8s <lud= o@HIDDEN> +;;; Copyright =C2=A9 2025 David Elsing <david.elsing@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +20,7 @@ (define-module (guix monads) #:use-module ((system syntax) #:select (syntax-local-binding)) + #:autoload (guix deprecation) (warn-about-deprecation) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -58,7 +60,8 @@ (define-module (guix monads) state-push state-pop run-with-state - state-parameterize)) + state-parameterize + mparameterize)) =20 ;;; Commentary: ;;; @@ -618,4 +621,15 @@ (define-syntax state-parameterize (lambda () (mbegin %state-monad body ...)))))))) =20 +(define-syntax mparameterize ;can be removed after 2026-0= 3-05 + (lambda (s) + "This is the old form for 'state-parameterize', which pretended to work +with any monad but was in fact specialized for '%state-monad'." + (syntax-case s () + ((_ monad bindings body ...) + (begin + (warn-about-deprecation 'mparameterize (current-source-location) + #:replacement 'state-parameterize) + #'(state-parameterize bindings body ...)))))) + ;;; monads.scm end here --=-=-=--
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 22:15:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 17:15:40 2025 Received: from localhost ([127.0.0.1]:33361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpaY5-0003cT-7f for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:15:40 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:59570) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tpaWN-0003Sc-9c for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 17:13:53 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 94018614; Tue, 4 Mar 2025 23:13:41 +0100 (CET) Authentication-Results: hera.aquilenet.fr; none X-Virus-Scanned: Debian amavis at hera.aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavis, port 10024) with ESMTP id XqZbh8zh4W8T; Tue, 4 Mar 2025 23:13:41 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 839CE186; Tue, 4 Mar 2025 23:13:39 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH v2] gexp: =?utf-8?Q?=E2=80=98with-paramete?= =?utf-8?Q?rs=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <20250304203337.2628-1-david.elsing@HIDDEN> (David Elsing's message of "Tue, 4 Mar 2025 20:33:08 +0000") References: <868qpky1uc.fsf@HIDDEN> <20250304203337.2628-1-david.elsing@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 04 Mar 2025 23:13:38 +0100 Message-ID: <87sens8mwd.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Rspamd-Server: hera X-Rspamd-Queue-Id: 94018614 X-Spamd-Result: default: False [5.90 / 15.00]; SPAM_FLAG(5.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_SPAM(3.00)[1.000]; CTYPE_MIXED_BOGUS(1.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; SUBJECT_HAS_QUESTION(0.00)[] X-Spamd-Bar: +++++ X-Rspamd-Action: greylist X-Spam-Level: ***** X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, David Elsing <david.elsing@HIDDEN> skribis: > Fixes <https://issues.guix.gnu.org/75879>. > > * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules. > Add state-parameterize and store-parameterize indentation rules. > * etc/manifests/system-tests.scm (test-for-current-guix): Replace > mparameterize with store-parameterize. > * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise. > * gnu/tests.scm (compile-system-test): Likewise. > * guix/gexp.scm (compile-parameterized): Use state-call-with-parameters. > * guix/monads.scm (mparameterize): Remove macro. > (state-call-with-parameters): New procedure. > (state-parameterize): New macro. > * guix/store.scm (store-parameterize): New macro. > * tests/gexp.scm ("with-parameters for %graft?"): New test. > * tests/monads.scm ("mparameterize"): Remove test. > ("state-parameterize"): New test. > > Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN> Applied with the change below, in accordance with the deprecation policy. Thank you! Ludo=E2=80=99. PS: Let me know if I got the copyright line wrong. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/guix/monads.scm b/guix/monads.scm index 0df82bb4653..e1b056dc95f 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2017, 2022 Ludovic Court=C3=A8s <lu= do@HIDDEN> +;;; Copyright =C2=A9 2013-2015, 2017, 2022, 2025 Ludovic Court=C3=A8s <lud= o@HIDDEN> +;;; Copyright =C2=A9 2025 David Elsing <david.elsing@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +20,7 @@ (define-module (guix monads) #:use-module ((system syntax) #:select (syntax-local-binding)) + #:autoload (guix deprecation) (warn-about-deprecation) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -58,7 +60,8 @@ (define-module (guix monads) state-push state-pop run-with-state - state-parameterize)) + state-parameterize + mparameterize)) =20 ;;; Commentary: ;;; @@ -618,4 +621,15 @@ (define-syntax state-parameterize (lambda () (mbegin %state-monad body ...)))))))) =20 +(define-syntax mparameterize ;can be removed after 2026-0= 3-05 + (lambda (s) + "This is the old form for 'state-parameterize', which pretended to work +with any monad but was in fact specialized for '%state-monad'." + (syntax-case s () + ((_ monad bindings body ...) + (begin + (warn-about-deprecation 'mparameterize (current-source-location) + #:replacement 'state-parameterize) + #'(state-parameterize bindings body ...)))))) + ;;; monads.scm end here --=-=-=--
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 20:36:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 15:36:17 2025 Received: from localhost ([127.0.0.1]:33145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpYzw-000735-Rx for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 15:36:17 -0500 Received: from mout02.posteo.de ([185.67.36.66]:54705) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <david.elsing@HIDDEN>) id 1tpYzt-00072p-OQ for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 15:36:15 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 16FAC240101 for <76485 <at> debbugs.gnu.org>; Tue, 4 Mar 2025 21:36:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1741120567; bh=3PpVQ4LaOqg/XAPKeOFaWqIQiUG9f8bvWiohdLs4qJM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=C+LpWarnf1X3TWSeLptq2thJ0FhlD7XWXCnWIHAMdbUPneYskmo1q1oFafYxkjYtu 8rc42b7YGVNt0did/eQ8Fm+uQmUXnFTjc2Glvd4j1p4s9Xy8luk0dGxMnDiato+mbB uYAOUIvgGQGozgjqbHclsKVpZYzZMnDRp8lkrcMupkIBCXG2YBlzEiFn2bSrsG2EcZ 07tDMhlmlHlavSaSqtTFbUzRMmNRnvBUZ1Azz+bkSmwySYm66Re9CDr9/k4IWInjw2 S4t12ddL6DO/3j67w1sAREsTkbJp+9Nl7ohQ7LFGAvC+6ZrTQi32QnxF1bci2QAxiy iYXwL9H2xukxg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Z6nWn2NM9z6trs; Tue, 4 Mar 2025 21:36:05 +0100 (CET) From: David Elsing <david.elsing@HIDDEN> To: 76485 <at> debbugs.gnu.org Subject: [PATCH v2] =?UTF-8?q?gexp:=20=E2=80=98with-parameters=E2=80=99=20?= =?UTF-8?q?properly=20handles=20=E2=80=98%graft=3F=E2=80=99.?= Date: Tue, 4 Mar 2025 20:33:08 +0000 Message-ID: <20250304203337.2628-1-david.elsing@HIDDEN> In-Reply-To: <868qpky1uc.fsf@HIDDEN> References: <868qpky1uc.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: David Elsing <david.elsing@HIDDEN>, ludo@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Fixes <https://issues.guix.gnu.org/75879>. * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules. Add state-parameterize and store-parameterize indentation rules. * etc/manifests/system-tests.scm (test-for-current-guix): Replace mparameterize with store-parameterize. * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise. * gnu/tests.scm (compile-system-test): Likewise. * guix/gexp.scm (compile-parameterized): Use state-call-with-parameters. * guix/monads.scm (mparameterize): Remove macro. (state-call-with-parameters): New procedure. (state-parameterize): New macro. * guix/store.scm (store-parameterize): New macro. * tests/gexp.scm ("with-parameters for %graft?"): New test. * tests/monads.scm ("mparameterize"): Remove test. ("state-parameterize"): New test. Co-authored-by: Ludovic Courtès <ludo@HIDDEN> --- .dir-locals.el | 3 +- etc/manifests/system-tests.scm | 2 +- etc/manifests/time-travel.scm | 8 +++--- gnu/tests.scm | 8 +++--- guix/gexp.scm | 42 ++++++++++++++------------- guix/monads.scm | 52 +++++++++++++++++++++++----------- guix/store.scm | 2 ++ tests/gexp.scm | 20 +++++++++++++ tests/monads.scm | 20 ++++++------- 9 files changed, 99 insertions(+), 58 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index d629b51c8a..76c9e12992 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -138,7 +138,8 @@ (eval . (put 'munless 'scheme-indent-function 1)) (eval . (put 'mlet* 'scheme-indent-function 2)) (eval . (put 'mlet 'scheme-indent-function 2)) - (eval . (put 'mparameterize 'scheme-indent-function 2)) + (eval . (put 'state-parameterize 'scheme-indent-function 2)) + (eval . (put 'store-parameterize 'scheme-indent-function 2)) (eval . (put 'run-with-store 'scheme-indent-function 1)) (eval . (put 'run-with-state 'scheme-indent-function 1)) (eval . (put 'wrap-program 'scheme-indent-function 1)) diff --git a/etc/manifests/system-tests.scm b/etc/manifests/system-tests.scm index 4e16c53dcf..430f507520 100644 --- a/etc/manifests/system-tests.scm +++ b/etc/manifests/system-tests.scm @@ -53,7 +53,7 @@ (define (tests-for-current-guix source commit) (map (lambda (test) (system-test (inherit test) - (value (mparameterize %store-monad ((current-guix-package guix)) + (value (store-parameterize ((current-guix-package guix)) (system-test-value test))))) (match (getenv "TESTS") (#f diff --git a/etc/manifests/time-travel.scm b/etc/manifests/time-travel.scm index 039ca89889..5256d2195c 100644 --- a/etc/manifests/time-travel.scm +++ b/etc/manifests/time-travel.scm @@ -22,7 +22,7 @@ (use-modules (srfi srfi-9) (ice-9 match) (guix channels) (guix gexp) ((guix store) #:select (%store-monad)) - ((guix monads) #:select (mparameterize return)) + ((guix monads) #:select (store-parameterize return)) ((guix git) #:select (%repository-cache-directory)) ((guix build utils) #:select (mkdir-p))) @@ -40,9 +40,9 @@ (define-gexp-compiler (guix-instance-compiler (instance <guix-instance>) ;; When this manifest is evaluated by Cuirass, make sure it does not ;; fiddle with the cached checkout that Cuirass is also using since ;; concurrent accesses are unsafe. - (mparameterize %store-monad ((%repository-cache-directory - (string-append (%repository-cache-directory) - "/time-travel/" system))) + (store-parameterize ((%repository-cache-directory + (string-append (%repository-cache-directory) + "/time-travel/" system))) (return (mkdir-p (%repository-cache-directory))) (latest-channel-derivation channels))))) diff --git a/gnu/tests.scm b/gnu/tests.scm index 2a9e51511f..1e3dbf0944 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm @@ -34,7 +34,7 @@ (define-module (gnu tests) #:use-module (gnu services shepherd) #:use-module (guix discovery) #:use-module (guix monads) - #:use-module ((guix store) #:select (%store-monad)) + #:use-module ((guix store) #:select (%store-monad store-parameterize)) #:use-module ((guix utils) #:select (%current-system %current-target-system)) #:use-module (srfi srfi-1) @@ -289,9 +289,9 @@ (define (write-system-test test port) (define-gexp-compiler (compile-system-test (test <system-test>) system target) "Compile TEST to a derivation." - (mparameterize %store-monad ((%current-system system) - (%current-target-system target)) - (system-test-value test))) + (store-parameterize ((%current-system system) + (%current-target-system target)) + (system-test-value test))) (define (test-modules) "Return the list of modules that define system tests." diff --git a/guix/gexp.scm b/guix/gexp.scm index ad51bc55b7..9ce6810172 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -733,26 +733,28 @@ (define-gexp-compiler compile-parameterized <parameterized> (lambda (parameterized system target) (match (parameterized-bindings parameterized) (((parameters values) ...) - (let ((fluids (map parameter-fluid parameters)) - (thunk (parameterized-thunk parameterized))) - ;; Install the PARAMETERS for the dynamic extent of THUNK. - (with-fluids* fluids - (map (lambda (thunk) (thunk)) values) - (lambda () - ;; Special-case '%current-system' and '%current-target-system' to - ;; make sure we get the desired effect. - (let ((system (if (memq %current-system parameters) - (%current-system) - system)) - (target (if (memq %current-target-system parameters) - (%current-target-system) - target))) - (match (thunk) - ((? struct? obj) - (lower-object obj system #:target target)) - (obj ;store item - (with-monad %store-monad - (return obj))))))))))) + (let ((thunk (parameterized-thunk parameterized)) + (values (map (lambda (thunk) (thunk)) values))) + ;; Install the PARAMETERS for the store monad. + (state-with-parameters parameters values + ;; Install the PARAMETERS for the dynamic extent of THUNK. + ;; Special-case '%current-system' and '%current-target-system' to + ;; make sure we get the desired effect. + (with-fluids* (map parameter-fluid parameters) + values + (lambda () + (let ((system (if (memq %current-system parameters) + (%current-system) + system)) + (target (if (memq %current-target-system parameters) + (%current-target-system) + target))) + (match (thunk) + ((? struct? obj) + (lower-object obj system #:target target)) + (obj ;store item + (with-monad %store-monad + (return obj)))))))))))) expander => (lambda (parameterized lowered output) (match (parameterized-bindings parameterized) diff --git a/guix/monads.scm b/guix/monads.scm index 0bd8ac9315..0df82bb465 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -40,7 +40,6 @@ (define-module (guix monads) mbegin mwhen munless - mparameterize lift0 lift1 lift2 lift3 lift4 lift5 lift6 lift7 lift listm foldm @@ -58,7 +57,8 @@ (define-module (guix monads) set-current-state state-push state-pop - run-with-state)) + run-with-state + state-parameterize)) ;;; Commentary: ;;; @@ -399,21 +399,6 @@ (define-syntax munless (mbegin %current-monad mexp0 mexp* ...))))) -(define-syntax mparameterize - (syntax-rules () - "This form implements dynamic scoping, similar to 'parameterize', but in a -monadic context." - ((_ monad ((parameter value) rest ...) body ...) - (let ((old-value (parameter))) - (mbegin monad - ;; XXX: Non-local exits are not correctly handled. - (return (parameter value)) - (mlet monad ((result (mparameterize monad (rest ...) body ...))) - (parameter old-value) - (return result))))) - ((_ monad () body ...) - (mbegin monad body ...)))) - (define-syntax define-lift (syntax-rules () ((_ liftn (args ...)) @@ -600,4 +585,37 @@ (define (state-push value) (lambda (state) (values state (cons value state)))) +(define-public (state-with-parameters parameters parameter-values mval) + "Set PARAMETERS to PARAMETER-VALUES for the dynamic extent of MVAL, a value +in the state monad." + (define (set-value parameter value) + (parameter value)) + + (lambda (state) + ;; XXX: 'with-fluids*' does not work with prompts, therefore the parameters + ;; are set globally. This leaves the parameters changed upon a non-local + ;; exit and restores them only after running MVAL to completion. See + ;; <https://issues.guix.gnu.org/76485>. + (let ((old-values (map set-value parameters parameter-values))) + (call-with-values + (lambda () + (mval state)) + (lambda (value state) + (map set-value parameters old-values) + (values value state)))))) + +(define-syntax state-parameterize + (syntax-rules () + "This form implements dynamic scoping, similar to 'parameterize', but also +in the monadic context of the state monad." + ((_ ((param value) ...) body ...) + (let ((parameters (list param ...)) + (values (list value ...))) + (state-with-parameters parameters values + ;; Install the parameters also for the evaluation of body ... + (with-fluids* (map parameter-fluid parameters) + values + (lambda () + (mbegin %state-monad body ...)))))))) + ;;; monads.scm end here diff --git a/guix/store.scm b/guix/store.scm index cf5848e580..bae8e7762b 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -178,6 +178,7 @@ (define-module (guix store) store-lift store-lower run-with-store + store-parameterize %guile-for-build current-system set-current-system @@ -1919,6 +1920,7 @@ (define-syntax new (identifier-syntax old))) (define-alias %store-monad %state-monad) (define-alias store-return state-return) (define-alias store-bind state-bind) +(define-alias store-parameterize state-parameterize) ;; Instantiate templates for %STORE-MONAD since it's syntactically different ;; from %STATE-MONAD. diff --git a/tests/gexp.scm b/tests/gexp.scm index e870f6cb1b..2376c70d1b 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -451,6 +451,26 @@ (define (match-input thing) (return (string=? (derivation-file-name drv) (derivation-file-name result))))) +(test-assertm "with-parameters for %graft?" + (mlet* %store-monad ((replacement -> (package + (inherit %bootstrap-guile) + (name (string-upcase + (package-name + %bootstrap-guile))))) + (guile -> (package + (inherit %bootstrap-guile) + (replacement replacement))) + (drv0 (package->derivation %bootstrap-guile)) + (drv1 (package->derivation replacement)) + (obj0 -> (with-parameters ((%graft? #f)) + guile)) + (obj1 -> (with-parameters ((%graft? #t)) + guile)) + (result0 (lower-object obj0)) + (result1 (lower-object obj1))) + (return (and (eq? drv0 result0) + (eq? drv1 result1))))) + (test-assert "with-parameters + file-append" (let* ((system (match (%current-system) ("aarch64-linux" "x86_64-linux") diff --git a/tests/monads.scm b/tests/monads.scm index 7f255f02bf..c05d13776a 100644 --- a/tests/monads.scm +++ b/tests/monads.scm @@ -136,18 +136,16 @@ (define (g x) %monads %monad-run)) -(test-assert "mparameterize" +(test-assert "state-parameterize" (let ((parameter (make-parameter 'outside))) - (every (lambda (monad run) - (equal? - (run (mlet monad ((outer (return (parameter))) - (inner - (mparameterize monad ((parameter 'inside)) - (return (parameter))))) - (return (list outer inner (parameter))))) - '(outside inside outside))) - %monads - %monad-run))) + (equal? + (run-with-state + (mlet %state-monad ((outer (return (parameter))) + (inner + (state-parameterize ((parameter 'inside)) + (return (parameter))))) + (return (list outer inner (parameter))))) + '(outside inside outside)))) (test-assert "mlet* + text-file + package-file" (run-with-store %store -- 2.48.1
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 4 Mar 2025 20:31:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 15:31:50 2025 Received: from localhost ([127.0.0.1]:33126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpYve-0006nj-74 for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 15:31:50 -0500 Received: from mout01.posteo.de ([185.67.36.65]:38565) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <david.elsing@HIDDEN>) id 1tpYva-0006nQ-Sd for 76485 <at> debbugs.gnu.org; Tue, 04 Mar 2025 15:31:48 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 6206C240028 for <76485 <at> debbugs.gnu.org>; Tue, 4 Mar 2025 21:31:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1741120300; bh=+n5X0K4uV9a2CHdSpqUrxNhJ7JhRW/8DTc13cVJToyM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=IS+XRUn8k9rsvaU2Y2eZlk0gMZm7hnKTpHKGF1N9a+Dd0IlsynHcRhdtZIoTrLBye D0Y+DfK10xumM+B1R2S2+89P2lAOkVKvDoXCc+x0Yqas+yRzlST8WmNoRgT2w1Mg99 q6qNmU5/mPUwN0zDXVTYu/903TpHWBBYrvP0OshkHnM97VncGji0qWybJ1UUiG0IRa eARbE8FowMYQU+LrjJl+waHr2CxyjX0meZ90p7VpnHWaHjb7jUfKiSl2rlFFj4gN+e YYKqKJ6IjDc3GKyBEDvm0gYhwcjLh6xUkxxe1h6DjBn8Dt6jxlkW5/B9zerak02JDS 6GEP7LuBmlEAA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Z6nQg3nhYz6txy; Tue, 4 Mar 2025 21:31:39 +0100 (CET) From: David Elsing <david.elsing@HIDDEN> To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Subject: Re: [bug#76485] [PATCH] gexp: =?utf-8?Q?=E2=80=98with-parameters?= =?utf-8?Q?=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <87zfi2c7q0.fsf@HIDDEN> References: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> <86jz9dslcg.fsf@HIDDEN> <87ldtrybf7.fsf@HIDDEN> <86eczgsko0.fsf@HIDDEN> <87zfi2c7q0.fsf@HIDDEN> Date: Tue, 04 Mar 2025 20:31:39 +0000 Message-ID: <868qpky1uc.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Hi Ludo', Ludovic Court=C3=A8s <ludo@HIDDEN> writes: > I guess my contradiction is that I=E2=80=99m looking for a =E2=80=9Cgener= ic=E2=80=9D solution > but whose genericity is limited by the set of monads defined in (guix > monads) and by my imagination. :-) Ah yes, but I don't think a generic solution is needed at this point, as only the state monad is used in Guix. :) I also tried to find a general way to apply `with-fluids*' for monads in `mparameterize' and then noticed it might not make much sense. > The core of the problem here is that (guix monads), to a large extent, > addresses problems already addressed by other Scheme constructs such as > parameters/fluids, but in an incompatible way. So really, > =E2=80=98mparameterize=E2=80=99 and the many commits that fixed interacti= ons between > =E2=80=98%current-system=E2=80=99 & co. and the monad are really band aid. I don't find the combination of the state monad and parameters so bad, and the idea of using the store monad to accumulate what to build is quite nice. To me the combination with prompts is a bit confusing though, it might be clearer to have continuations as part of the store monad. > So in this case I=E2=80=99m also looking for a =E2=80=9Cquick fix=E2=80= =9D more than extending > (guix monads). Yes that makes sense, in my opinion a quick fix for the state monad is fine. > Would you like to send a patch that does it the way you want? > Preferably limited to fixing =E2=80=98with-parameters=E2=80=99 in particu= lar so it also > works for =E2=80=98%graft?=E2=80=99. > > Or are you saying that the patch at the beginning of this thread (where > =E2=80=98mcall-with-parameters=E2=80=99 is specialized for the state mona= d) is good > enough? Oh, maybe you didn't see my previous patch where I specialized `mcall-with-parameters' and `mparameterize' to the state monad, I only sent it to Debbugs. I updated the patch and used your workaround for avoiding using `with-fluids*' by setting and later restoring the parameters. Cheers, David
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 3 Mar 2025 18:03:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 03 13:03:58 2025 Received: from localhost ([127.0.0.1]:51430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpA8w-0008R5-Br for submit <at> debbugs.gnu.org; Mon, 03 Mar 2025 13:03:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37478) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tpA8t-0008Qb-6g for 76485 <at> debbugs.gnu.org; Mon, 03 Mar 2025 13:03:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tpA8l-0001dr-6v; Mon, 03 Mar 2025 13:03:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=3K2VMqr7Eg2Cje2OgtGGIG8tMPonZYJQR/rswAULdlw=; b=ZJf4HwVJmgnVP5+mS++B QsJxDtkOCPVsA+P3lB5pUeQ50w2v6IVAMtxy4z00bPv4cSZT02G+lLb5FKw9mobJBOPi0gmtrDHFv KO+Fnpsg+hKx7u5dfM4uEHx7zrpaEdzr8Z+LUdNWSwPiCvU6sw9Qb3+vKCeM70j437p/iiqMVMptY uxYQznoEO9q8vhhFtIJzrIVN0dCxAfGvldpxM+ISwMglT4YPgmMkuE5KGKE+051CutM34Xck0ounz ETDsudWW/6/Jfj2b3zM3GRQdn5yLHol3FRHLc1bUlZuBkjVd475nGm1GIf6wjsVZvUCjuaRVN1/6c M3jcnqefOOl/kw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH] gexp: =?utf-8?Q?=E2=80=98with-parameters?= =?utf-8?Q?=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <86eczgsko0.fsf@HIDDEN> (David Elsing's message of "Sat, 01 Mar 2025 17:52:31 +0000") References: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> <86jz9dslcg.fsf@HIDDEN> <87ldtrybf7.fsf@HIDDEN> <86eczgsko0.fsf@HIDDEN> Date: Mon, 03 Mar 2025 19:03:19 +0100 Message-ID: <87zfi2c7q0.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Hi David, David Elsing <david.elsing@HIDDEN> skribis: > I thought about it some more and I think my issue is that in general, > the number of times a function passed to bind is evaluated is not fixed. > Attached is an example for a monad which acts as a combination of the > state monad and the maybe monad. I used two parameters, because they are > set at different times in the implementation of `mparameterize' (but > this seems to be a different issue to me). In particular, p2 is not > restored at the end, because no function application is done for a > "nothing" value. > > Another problematic example would be a "coroutine" monad [1], which can > pause the evaluation of its "steps", during which the parameters could > be used or changed elsewhere. Hmm right. I guess my contradiction is that I=E2=80=99m looking for a =E2=80=9Cgeneric= =E2=80=9D solution but whose genericity is limited by the set of monads defined in (guix monads) and by my imagination. :-) >> Because of that, I have a preference for =E2=80=98mparameterize=E2=80=99= rather than >> =E2=80=98state-parameterize=E2=80=99 or any other specific variant. >> >> WDYT? > > To my understanding, what we actually want is to affect the way the > function of the state monad applies to the passed state, or formulated > in a different way, the state to include the parameters. This would be > effectively achieved using `with-fluids*' inside the monadic procedure > (except that they are not part of the final state). It can be though of > expanding the state of the state monad with the parameters, where the > initial state contains the "outside" parameters. Of course, now there > are two different ways to pass on state, through the state monad and the > parameters... :) > > Does this make sense? I think so. :-) The core of the problem here is that (guix monads), to a large extent, addresses problems already addressed by other Scheme constructs such as parameters/fluids, but in an incompatible way. So really, =E2=80=98mparameterize=E2=80=99 and the many commits that fixed interaction= s between =E2=80=98%current-system=E2=80=99 & co. and the monad are really band aid. So in this case I=E2=80=99m also looking for a =E2=80=9Cquick fix=E2=80=9D = more than extending (guix monads). > Because `with-fluids*' does not work with prompts, I still think your > solution is a good workaround when specialized for the state monad, as > long as the parameters are not used externally until the execution is > completely finished. Yes, the semantics are clumsy. Would you like to send a patch that does it the way you want? Preferably limited to fixing =E2=80=98with-parameters=E2=80=99 in particula= r so it also works for =E2=80=98%graft?=E2=80=99. Or are you saying that the patch at the beginning of this thread (where =E2=80=98mcall-with-parameters=E2=80=99 is specialized for the state monad)= is good enough? Tell me what you prefer. :-) (There=E2=80=99s a couple of patch series depending on this fix.) Thanks, Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 1 Mar 2025 17:52:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 01 12:52:51 2025 Received: from localhost ([127.0.0.1]:43132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1toR18-0004m6-OQ for submit <at> debbugs.gnu.org; Sat, 01 Mar 2025 12:52:51 -0500 Received: from mout02.posteo.de ([185.67.36.66]:60041) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <david.elsing@HIDDEN>) id 1toR15-0004lO-7f for 76485 <at> debbugs.gnu.org; Sat, 01 Mar 2025 12:52:49 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 5C9AD240101 for <76485 <at> debbugs.gnu.org>; Sat, 1 Mar 2025 18:52:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1740851560; bh=QST4ohp8vHEuyTiCK+X/q2y2uWTIx5+dlMTVW63RskU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=FVzPXBzQf2HmRFZ7cQEb8tWREEiSQXQamL/zjcqLTI2ftBkxaYcgfElsJwG/VeB3A yFz/CrSoJmDroJ8Xk0jLI6xhePJO9M2cDYuMqy9BL6hHCzNlVrAs5IzVpSyu+GHuMN qstiv7awxENXm1jLLymZYd3s5Xx6kc+P8qKmNcNczCGImQgzVkMreKB7hbTkTkQeST ZNmLYhh2+LdBoRpd8DFCRHU1bTDm861A1CW2R+5OeKxgp4vIA1D6DstTrdjDSiXAMT u61D8XD3T1RnSIvMmsH/YCkzKwwuHo6sadPLpC08QBx+uS276gJ251fcQVf4d3QLUF U4lPwr5vIUBGQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Z4t2Z6ZYDz6tyv; Sat, 1 Mar 2025 18:52:38 +0100 (CET) From: David Elsing <david.elsing@HIDDEN> To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Subject: Re: [bug#76485] [PATCH] gexp: =?utf-8?Q?=E2=80=98with-parameters?= =?utf-8?Q?=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <87ldtrybf7.fsf@HIDDEN> References: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> <86jz9dslcg.fsf@HIDDEN> <87ldtrybf7.fsf@HIDDEN> Date: Sat, 01 Mar 2025 17:52:31 +0000 Message-ID: <86eczgsko0.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo', I thought about it some more and I think my issue is that in general, the number of times a function passed to bind is evaluated is not fixed. Attached is an example for a monad which acts as a combination of the state monad and the maybe monad. I used two parameters, because they are set at different times in the implementation of `mparameterize' (but this seems to be a different issue to me). In particular, p2 is not restored at the end, because no function application is done for a "nothing" value. Another problematic example would be a "coroutine" monad [1], which can pause the evaluation of its "steps", during which the parameters could be used or changed elsewhere. Ludovic Court=C3=A8s <ludo@HIDDEN> writes: > Yes, though it would be nice to have a variant of =E2=80=98parameterize= =E2=80=99 =E2=80=9Cthat > works for any monad=E2=80=9D, that was the intent of =E2=80=98mparameteri= ze=E2=80=99. I think what you describe (although I'm not too familiar with Haskell) is like the ReaderT (or StateT if the parameters can change within the monad) monad transformer, where the parameters are stored in the additional state provided by ReaderT. This is however a new monad and different from setting the parameters globally in different functions passed to bind. > Because of that, I have a preference for =E2=80=98mparameterize=E2=80=99 = rather than > =E2=80=98state-parameterize=E2=80=99 or any other specific variant. > > WDYT? To my understanding, what we actually want is to affect the way the function of the state monad applies to the passed state, or formulated in a different way, the state to include the parameters. This would be effectively achieved using `with-fluids*' inside the monadic procedure (except that they are not part of the final state). It can be though of expanding the state of the state monad with the parameters, where the initial state contains the "outside" parameters. Of course, now there are two different ways to pass on state, through the state monad and the parameters... :) Does this make sense? Because `with-fluids*' does not work with prompts, I still think your solution is a good workaround when specialized for the state monad, as long as the parameters are not used externally until the execution is completely finished. > Yes, that=E2=80=99s because =E2=80=98with-fluids*=E2=80=99 is implemented= in C, which makes it a > =E2=80=9Ccontinuation barrier=E2=80=9D (continuations that contain C stac= k frames cannot > be resumed). It=E2=80=99s a limitation of the current implementation rat= her > than a bug, strictly speaking. :-) Ah I see, thanks for the explanation! Are there plans to change that and do you think it would be difficult to do? Maybe the suspension could also be done without prompts by instead modifying the store monad, similar to [1]? It would probably be less straightforward though and maybe better suitable for languages like Haskell. Cheers, David [1] https://hackage.haskell.org/package/monad-coroutine-0.9.2/docs/Control-= Monad-Coroutine.html --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=test-mparameterize.scm (use-modules (guix monads) (ice-9 match)) (define-inlinable (test-return value) (lambda (state) (list 'just value state))) (define-inlinable (test-bind mvalue mproc) (lambda (state) (match (mvalue state) (('just value state2) ((mproc value) state2)) (('nothing state2) (list 'nothing state2))))) (define-monad %test-monad (bind test-bind) (return test-return)) (define mval (mlet %test-monad ((a (return 3)) (b (lambda (state) (list 'nothing state)))) (return 2))) (define p1 (make-parameter 1)) (define p2 (make-parameter 1)) (pk "A" (p1) (p2)) (define mval2 (mparameterize %test-monad ((p1 3) (p2 3)) mval)) (pk "B" (p1) (p2)) (p1 2) (p2 2) (pk "C" (p1) (p2)) (pk (mval2 1)) (pk "D" (p1) (p2)) ;;; Output: ;;; ("A" 1 1) ;;; ("B" 3 1) ;;; ("C" 2 2) ;;; ((nothing 1)) ;;; ("D" 2 3) --=-=-=--
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 28 Feb 2025 08:29:33 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 28 03:29:32 2025 Received: from localhost ([127.0.0.1]:44801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tnvkS-0005Kh-ID for submit <at> debbugs.gnu.org; Fri, 28 Feb 2025 03:29:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47286) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tnvkQ-0005K9-BS for 76485 <at> debbugs.gnu.org; Fri, 28 Feb 2025 03:29:30 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tnvkL-0002No-23; Fri, 28 Feb 2025 03:29:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=Pli7yQLuy0WAn5H3hfEXDMHvEl7bUYCbtQks2Qxxe4g=; b=aHU5tibOEUQgcxkgC+2Q sIcuvtBILWYUjxrLj1ZKU8/gICuyds1CfP8WxFiimz+Fz4Pm88kozgkwBV1QjW5JzZQbN/BCYqb3u epQi8hyRCKOAtxwz+djXZkU1XHcZl7Ia+bsQdEywZhjC/Hedcp+gYx3iCFEKW7ZmIZJ46z6AmccZR INPGRfZ3C0uPeCOVZZntMUOvpJzaG2HIcSych/xS/kfo3f2nHsmwEQdyBcBXxMxTlwOuNGvzKz+gW UaJDh2wOg2VJZgtb6gc7BemSJe5USDKEV8v1A2lUopn6w/SDYHbHVlor2TpRSSEHuEzTagw1SeNM2 WpXWcAT+F9/nHw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH] gexp: =?utf-8?Q?=E2=80=98with-parameters?= =?utf-8?Q?=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <87ldtrybf7.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Thu, 27 Feb 2025 10:38:52 +0100") References: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> <86jz9dslcg.fsf@HIDDEN> <87ldtrybf7.fsf@HIDDEN> Date: Fri, 28 Feb 2025 09:29:20 +0100 Message-ID: <87senyv5en.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s <ludo@HIDDEN> skribis: > Yes, though it would be nice to have a variant of =E2=80=98parameterize= =E2=80=99 =E2=80=9Cthat > works for monad=E2=80=9D, that was the intent of =E2=80=98mparameterize= =E2=80=99. I meant: =E2=80=9Cthat works for any monad=E2=80=9D. > Because of that, I have a preference for =E2=80=98mparameterize=E2=80=99 = rather than > =E2=80=98state-parameterize=E2=80=99 or any other specific variant. Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 27 Feb 2025 09:39:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 27 04:39:07 2025 Received: from localhost ([127.0.0.1]:58164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tnaME-0003Ks-Iq for submit <at> debbugs.gnu.org; Thu, 27 Feb 2025 04:39:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60948) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tnaMA-0003KH-5n for 76485 <at> debbugs.gnu.org; Thu, 27 Feb 2025 04:39:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tnaM4-00013f-0D; Thu, 27 Feb 2025 04:38:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=p/0EYXcx9BU2X1BctFucUe6mDyrGopybM5L5UVIZxEg=; b=p8ehTayuPoHs7kqc+olC 2wzSMdgzo7fp2Z4erU3L+Xs119DirVyBsgbz7gnDWqRPNLmDZF1aWsG4K1ZoqhtNSs9H7+U/uLIlM 5ysR6pYlvhIG/1N3FmhEsT9LhX9K7MkKuQi7YanZQd7Gio2Y0vLA520//652je4n2ErwgSsLrV49f iW6ZMD7uT6ZZGytQh34xBVGC89JLnSzvDtTrsUc7EhFGxhfXrVbXcQRTVnq/A0i5jrjGMiLBNXPz3 xWyP13ZHKIHupiRmic++BgR365VzUSvhmi9fpKmjZNZJEVauDbo3IYTpRZMh3W5kHUCzhRs37wXSV U8iXbzmQEIp6Kw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: David Elsing <david.elsing@HIDDEN> Subject: Re: [bug#76485] [PATCH] gexp: =?utf-8?Q?=E2=80=98with-parameters?= =?utf-8?Q?=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <86jz9dslcg.fsf@HIDDEN> (David Elsing's message of "Tue, 25 Feb 2025 22:36:31 +0000") References: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> <86jz9dslcg.fsf@HIDDEN> Date: Thu, 27 Feb 2025 10:38:52 +0100 Message-ID: <87ldtrybf7.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: 76485 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Hi David, David Elsing <david.elsing@HIDDEN> skribis: >> + ;; XXX: Non-local exits can leave PARAMETERS set to VALUES. >> + (mlet* %store-monad ((old-values >> + (return (map set-value parameters values))) >> + (result (thunk))) >> + (mbegin %store-monad >> + (return (map set-value parameters old-values)) ;restore old values >> + (return result)))) > > However, I'm not convinced it is meaningful to set the parameters for a > general monad, e.g. for the identity monad or the list monad, there is > no way for the parameters to have an effect, only during the evaluation > of a function. Still, =E2=80=98mparameterized=E2=80=99 does the right thing, whether you= =E2=80=99re using =E2=80=98%state-monad=E2=80=99 or =E2=80=98%identity-monad=E2=80=99: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,optimize (mparameterize %identity-monad ((current-out= put-port (%make-void-port "w"))) (mlet* %identity-monad ((x (return 2)) (y (return 3)) (z (return (+ x y)))) (return (* z 2)))) $26 =3D (let ((old-value (current-output-port))) (current-output-port (%make-void-port "w")) (let ((mvalue 10)) (current-output-port old-value) mvalue)) scheme@(guile-user)> ,optimize (mparameterize %state-monad ((current-output= -port (%make-void-port "w"))) (mlet* %state-monad ((x (return 2)) (y (return 3)) (z (return (+ x y)))) (return (* z 2)))) $27 =3D (let* ((old-value (current-output-port)) (mvalue (let ((value (current-output-port (%make-void-port "w")))) (lambda (state) (values value state))))) (lambda (state) (call-with-values (lambda () (mvalue state)) (lambda (value state) ((begin (current-output-port old-value) (lambda (state) (values 10 state))) state))))) --8<---------------cut here---------------end--------------->8--- That is, no matter what, it changes the value of the parameters before evaluation of the body happens (whether or not it=E2=80=99s delayed) and ch= anges it back after. > Instead, I would suggest to only do this for the state monad, as the > parameters have an effect during the function application of the > monadic value to the state. The same applies to `mparameterized' in > (guix monads). Do you think that makes sense? Yes, though it would be nice to have a variant of =E2=80=98parameterize=E2= =80=99 =E2=80=9Cthat works for monad=E2=80=9D, that was the intent of =E2=80=98mparameterize=E2= =80=99. Because of that, I have a preference for =E2=80=98mparameterize=E2=80=99 ra= ther than =E2=80=98state-parameterize=E2=80=99 or any other specific variant. WDYT? > This allows for the use of `with-fluids*', keeping the parameterization > local. In the following message is a patch with the changes, which > (apart from the issue below) appears to work. Yes, that=E2=80=99s because =E2=80=98with-fluids*=E2=80=99 is implemented i= n C, which makes it a =E2=80=9Ccontinuation barrier=E2=80=9D (continuations that contain C stack = frames cannot be resumed). It=E2=80=99s a limitation of the current implementation rather than a bug, strictly speaking. :-) Thanks, Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 25 Feb 2025 22:49:44 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 25 17:49:44 2025 Received: from localhost ([127.0.0.1]:48883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tn3kF-0007Se-7Z for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 17:49:44 -0500 Received: from mout01.posteo.de ([185.67.36.65]:56155) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <david.elsing@HIDDEN>) id 1tn3kB-0007SN-Tf for 76485 <at> debbugs.gnu.org; Tue, 25 Feb 2025 17:49:41 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id CF790240027 for <76485 <at> debbugs.gnu.org>; Tue, 25 Feb 2025 23:49:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1740523773; bh=UUmdj5ZbWUA2FVVdlNZCEe1KRCI36dyLtLKMCdPErs0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=ee+re6gsnWe/ydzLLkL81oxnIcdF0uS4IFqqXOstWeqqokBdMCbYMj7Qw2Z+hFUdd o06Z+aIlP3f89ZSrIaHi9Okd89UbqZoCGxvdEAj0dwpCUmcEujSfTR880k5vGF7Jn7 o6b0AHWs6p9VJbeFKriU4PkBAsO2LUw3Lm6H+vbCW3lK6z4LMSgMZj+vbeRClyAbwr tRaijhT+ddMu3JOvh5RGXaUsknpsM7A+p7icwfdflHuRClxJ4uVNV32CzWqMcAYq1R HsZ03zz7lXUnGSdnUyPze/jGTipxZ7Vv7ykUi/HXGJpWHtuWA50WMNF5pogC7SQ5ty 372whtjXK3DnQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Z2Xq11H5Hz9rxG; Tue, 25 Feb 2025 23:49:32 +0100 (CET) From: David Elsing <david.elsing@HIDDEN> To: 76485 <at> debbugs.gnu.org Subject: [PATCH] =?UTF-8?q?[WIP]=20gexp:=20=E2=80=98with-parameters?= =?UTF-8?q?=E2=80=99=20properly=20handles=20=E2=80=98%graft=3F=E2=80=99.?= Date: Tue, 25 Feb 2025 22:48:58 +0000 Message-ID: <20250225224907.30550-1-david.elsing@HIDDEN> In-Reply-To: <86jz9dslcg.fsf@HIDDEN> References: <86jz9dslcg.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 Cc: David Elsing <david.elsing@HIDDEN>, =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Note: Using ‘with-fluids*’ with a prompt does not work in Guile: <https://issues.guix.gnu.org/76485#2> * .dir-locals.el (scheme-mode): Remove mparameterize indentation rules. Add state-parameterize and store-parameterize indentation rules. * etc/manifests/system-tests.scm (test-for-current-guix): Replace mparameterize with store-parameterize. * etc/manifests/time-travel.scm (guix-instance-compiler): Likewise. * gnu/tests.scm (compile-system-test): Likewise. * guix/gexp.scm (compile-parameterized): Use state-with-parameters. * guix/monads.scm (mparameterize): Remove macro. (state-with-parameters): New procedure. (state-parameterize): New macro. * guix/store.scm (store-parameterize): New macro. * tests/gexp.scm ("with-parameters for %graft?"): New test. * tests/monads.scm ("mparameterize"): Remove test. ("state-parameterize"): New test. Co-authored-by: Ludovic Courtès <ludo@HIDDEN> --- .dir-locals.el | 3 ++- etc/manifests/system-tests.scm | 2 +- etc/manifests/time-travel.scm | 8 +++--- gnu/tests.scm | 9 ++++--- guix/gexp.scm | 42 ++++++++++++++++--------------- guix/monads.scm | 46 +++++++++++++++++++++------------- guix/store.scm | 2 ++ tests/gexp.scm | 20 +++++++++++++++ tests/monads.scm | 20 +++++++-------- 9 files changed, 93 insertions(+), 59 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index d629b51c8a..76c9e12992 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -138,7 +138,8 @@ (eval . (put 'munless 'scheme-indent-function 1)) (eval . (put 'mlet* 'scheme-indent-function 2)) (eval . (put 'mlet 'scheme-indent-function 2)) - (eval . (put 'mparameterize 'scheme-indent-function 2)) + (eval . (put 'state-parameterize 'scheme-indent-function 2)) + (eval . (put 'store-parameterize 'scheme-indent-function 2)) (eval . (put 'run-with-store 'scheme-indent-function 1)) (eval . (put 'run-with-state 'scheme-indent-function 1)) (eval . (put 'wrap-program 'scheme-indent-function 1)) diff --git a/etc/manifests/system-tests.scm b/etc/manifests/system-tests.scm index 4e16c53dcf..430f507520 100644 --- a/etc/manifests/system-tests.scm +++ b/etc/manifests/system-tests.scm @@ -53,7 +53,7 @@ (define (tests-for-current-guix source commit) (map (lambda (test) (system-test (inherit test) - (value (mparameterize %store-monad ((current-guix-package guix)) + (value (store-parameterize ((current-guix-package guix)) (system-test-value test))))) (match (getenv "TESTS") (#f diff --git a/etc/manifests/time-travel.scm b/etc/manifests/time-travel.scm index 039ca89889..5256d2195c 100644 --- a/etc/manifests/time-travel.scm +++ b/etc/manifests/time-travel.scm @@ -22,7 +22,7 @@ (use-modules (srfi srfi-9) (ice-9 match) (guix channels) (guix gexp) ((guix store) #:select (%store-monad)) - ((guix monads) #:select (mparameterize return)) + ((guix monads) #:select (store-parameterize return)) ((guix git) #:select (%repository-cache-directory)) ((guix build utils) #:select (mkdir-p))) @@ -40,9 +40,9 @@ (define-gexp-compiler (guix-instance-compiler (instance <guix-instance>) ;; When this manifest is evaluated by Cuirass, make sure it does not ;; fiddle with the cached checkout that Cuirass is also using since ;; concurrent accesses are unsafe. - (mparameterize %store-monad ((%repository-cache-directory - (string-append (%repository-cache-directory) - "/time-travel/" system))) + (store-parameterize ((%repository-cache-directory + (string-append (%repository-cache-directory) + "/time-travel/" system))) (return (mkdir-p (%repository-cache-directory))) (latest-channel-derivation channels))))) diff --git a/gnu/tests.scm b/gnu/tests.scm index 2a9e51511f..db9d1f0b0f 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm @@ -34,7 +34,7 @@ (define-module (gnu tests) #:use-module (gnu services shepherd) #:use-module (guix discovery) #:use-module (guix monads) - #:use-module ((guix store) #:select (%store-monad)) + #:use-module ((guix store) #:select (%store-monad store-parameterize)) #:use-module ((guix utils) #:select (%current-system %current-target-system)) #:use-module (srfi srfi-1) @@ -289,9 +289,10 @@ (define (write-system-test test port) (define-gexp-compiler (compile-system-test (test <system-test>) system target) "Compile TEST to a derivation." - (mparameterize %store-monad ((%current-system system) - (%current-target-system target)) - (system-test-value test))) + (store-parameterize + ((%current-system system) + (%current-target-system target)) + (system-test-value test))) (define (test-modules) "Return the list of modules that define system tests." diff --git a/guix/gexp.scm b/guix/gexp.scm index ad51bc55b7..9ce6810172 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -733,26 +733,28 @@ (define-gexp-compiler compile-parameterized <parameterized> (lambda (parameterized system target) (match (parameterized-bindings parameterized) (((parameters values) ...) - (let ((fluids (map parameter-fluid parameters)) - (thunk (parameterized-thunk parameterized))) - ;; Install the PARAMETERS for the dynamic extent of THUNK. - (with-fluids* fluids - (map (lambda (thunk) (thunk)) values) - (lambda () - ;; Special-case '%current-system' and '%current-target-system' to - ;; make sure we get the desired effect. - (let ((system (if (memq %current-system parameters) - (%current-system) - system)) - (target (if (memq %current-target-system parameters) - (%current-target-system) - target))) - (match (thunk) - ((? struct? obj) - (lower-object obj system #:target target)) - (obj ;store item - (with-monad %store-monad - (return obj))))))))))) + (let ((thunk (parameterized-thunk parameterized)) + (values (map (lambda (thunk) (thunk)) values))) + ;; Install the PARAMETERS for the store monad. + (state-with-parameters parameters values + ;; Install the PARAMETERS for the dynamic extent of THUNK. + ;; Special-case '%current-system' and '%current-target-system' to + ;; make sure we get the desired effect. + (with-fluids* (map parameter-fluid parameters) + values + (lambda () + (let ((system (if (memq %current-system parameters) + (%current-system) + system)) + (target (if (memq %current-target-system parameters) + (%current-target-system) + target))) + (match (thunk) + ((? struct? obj) + (lower-object obj system #:target target)) + (obj ;store item + (with-monad %store-monad + (return obj)))))))))))) expander => (lambda (parameterized lowered output) (match (parameterized-bindings parameterized) diff --git a/guix/monads.scm b/guix/monads.scm index 0bd8ac9315..431c2a6a25 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -40,7 +40,6 @@ (define-module (guix monads) mbegin mwhen munless - mparameterize lift0 lift1 lift2 lift3 lift4 lift5 lift6 lift7 lift listm foldm @@ -58,7 +57,8 @@ (define-module (guix monads) set-current-state state-push state-pop - run-with-state)) + run-with-state + state-parameterize)) ;;; Commentary: ;;; @@ -399,21 +399,6 @@ (define-syntax munless (mbegin %current-monad mexp0 mexp* ...))))) -(define-syntax mparameterize - (syntax-rules () - "This form implements dynamic scoping, similar to 'parameterize', but in a -monadic context." - ((_ monad ((parameter value) rest ...) body ...) - (let ((old-value (parameter))) - (mbegin monad - ;; XXX: Non-local exits are not correctly handled. - (return (parameter value)) - (mlet monad ((result (mparameterize monad (rest ...) body ...))) - (parameter old-value) - (return result))))) - ((_ monad () body ...) - (mbegin monad body ...)))) - (define-syntax define-lift (syntax-rules () ((_ liftn (args ...)) @@ -600,4 +585,29 @@ (define (state-push value) (lambda (state) (values state (cons value state)))) -;;; monads.scm end here +(define-public (state-with-parameters parameters values mval) + "Set PARAMETERS to VALUES for the dynamic extent of MVAL, a value in the +state monad." + (lambda (state) + (with-fluids* (map parameter-fluid parameters) + values + (lambda () + (run-with-state mval state))))) + +(define-syntax state-parameterize + (syntax-rules () + "This form implements dynamic scoping, similar to 'parameterize', but also +in the monadic context of the state monad." + ((_ ((param value) ...) body ...) + (let ((parameters (list param ...)) + (values (list value ...))) + (state-with-parameters parameters values + ;; Install the parameters also for the evaluation of body ... + (with-fluids* (map parameter-fluid parameters) + values + (lambda () + (mbegin %state-monad body ...)))))))) + +;;; Local Variables: +;;; eval: (put 'state-with-parameters 'scheme-indent-function 2) +;;; End: diff --git a/guix/store.scm b/guix/store.scm index cf5848e580..bae8e7762b 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -178,6 +178,7 @@ (define-module (guix store) store-lift store-lower run-with-store + store-parameterize %guile-for-build current-system set-current-system @@ -1919,6 +1920,7 @@ (define-syntax new (identifier-syntax old))) (define-alias %store-monad %state-monad) (define-alias store-return state-return) (define-alias store-bind state-bind) +(define-alias store-parameterize state-parameterize) ;; Instantiate templates for %STORE-MONAD since it's syntactically different ;; from %STATE-MONAD. diff --git a/tests/gexp.scm b/tests/gexp.scm index e870f6cb1b..2376c70d1b 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -451,6 +451,26 @@ (define (match-input thing) (return (string=? (derivation-file-name drv) (derivation-file-name result))))) +(test-assertm "with-parameters for %graft?" + (mlet* %store-monad ((replacement -> (package + (inherit %bootstrap-guile) + (name (string-upcase + (package-name + %bootstrap-guile))))) + (guile -> (package + (inherit %bootstrap-guile) + (replacement replacement))) + (drv0 (package->derivation %bootstrap-guile)) + (drv1 (package->derivation replacement)) + (obj0 -> (with-parameters ((%graft? #f)) + guile)) + (obj1 -> (with-parameters ((%graft? #t)) + guile)) + (result0 (lower-object obj0)) + (result1 (lower-object obj1))) + (return (and (eq? drv0 result0) + (eq? drv1 result1))))) + (test-assert "with-parameters + file-append" (let* ((system (match (%current-system) ("aarch64-linux" "x86_64-linux") diff --git a/tests/monads.scm b/tests/monads.scm index 7f255f02bf..4c9adcc264 100644 --- a/tests/monads.scm +++ b/tests/monads.scm @@ -136,18 +136,16 @@ (define (g x) %monads %monad-run)) -(test-assert "mparameterize" +(test-assert "state-parameterize" (let ((parameter (make-parameter 'outside))) - (every (lambda (monad run) - (equal? - (run (mlet monad ((outer (return (parameter))) - (inner - (mparameterize monad ((parameter 'inside)) - (return (parameter))))) - (return (list outer inner (parameter))))) - '(outside inside outside))) - %monads - %monad-run))) + (equal? + (run-with-state + (mlet %state-monad ((outer (return (parameter))) + (inner + (state-parameterize ((parameter 'inside)) + (return (parameter))))) + (return (list outer inner (parameter))))) + '(outside inside outside)))) (test-assert "mlet* + text-file + package-file" (run-with-store %store -- 2.48.1
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Received: (at 76485) by debbugs.gnu.org; 25 Feb 2025 22:36:44 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 25 17:36:44 2025 Received: from localhost ([127.0.0.1]:48838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tn3Xg-0003pe-Ac for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 17:36:44 -0500 Received: from mout01.posteo.de ([185.67.36.65]:41423) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <david.elsing@HIDDEN>) id 1tn3Xd-0003pL-5q for 76485 <at> debbugs.gnu.org; Tue, 25 Feb 2025 17:36:42 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A8ACA240027 for <76485 <at> debbugs.gnu.org>; Tue, 25 Feb 2025 23:36:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1740522993; bh=Lx6B23dhx3DMRnim33AkMfG+SNK3+WiJw4dmodsLY3A=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=qXrHQLwoWuganC31mnV8sfMAxee/7bLvIhf9xkYutGk2x6EzrJzY1kjPYS14MHQjo 4xZtWnyvioNfb7iyG2MrPlFbgP5X5TN9D8TmjcnHMbTyXnHtFfbc+/pBmHphLytyN6 38820Qlt8Xlrk5hXvNCOXDHBCjQ7JRp6FNsDpVYrVpsuVTn5Jt333/stFosPTvFozo 9njk4O9HbdqJlih5kAtt3VJzkZnP+QOuBtRFKdCduRya/ALtOVvozvabJOzv/YsP25 cqiTpC2k1yD7Rxb8i48RuimHkAZTYLZjucA5/7k0fNcnZkvPIX0yi3KNUJJWBNRzYS a0+cZ2+1JmHzQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Z2XX00XKcz6tsb; Tue, 25 Feb 2025 23:36:31 +0100 (CET) From: David Elsing <david.elsing@HIDDEN> To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, 76485 <at> debbugs.gnu.org Subject: Re: [PATCH] gexp: =?utf-8?Q?=E2=80=98with-parameters=E2=80=99?= properly handles =?utf-8?B?4oCYJWdyYWZ0P+KAmS4=?= In-Reply-To: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> References: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> Date: Tue, 25 Feb 2025 22:36:31 +0000 Message-ID: <86jz9dslcg.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76485 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, Ludovic Court=C3=A8s <ludo@HIDDEN> writes: > + (mcall-with-parameters > + parameters > + (map (lambda (thunk) (thunk)) values) Composing the monadic value here is a good idea I think. > + ;; XXX: Non-local exits can leave PARAMETERS set to VALUES. > + (mlet* %store-monad ((old-values > + (return (map set-value parameters values))) > + (result (thunk))) > + (mbegin %store-monad > + (return (map set-value parameters old-values)) ;restore old values > + (return result)))) However, I'm not convinced it is meaningful to set the parameters for a general monad, e.g. for the identity monad or the list monad, there is no way for the parameters to have an effect, only during the evaluation of a function. Instead, I would suggest to only do this for the state monad, as the parameters have an effect during the function application of the monadic value to the state. The same applies to `mparameterized' in (guix monads). Do you think that makes sense? This allows for the use of `with-fluids*', keeping the parameterization local. In the following message is a patch with the changes, which (apart from the issue below) appears to work. When testing the patch however, I noticed that `with-fluids*' does not work with prompts and I get the following error: --8<---------------cut here---------------start------------->8--- ERROR: Wrong type (expecting resumable continuation): #<vm-continuation 7f5= 95e325690> --8<---------------cut here---------------end--------------->8--- Attached is a minimal example, which works fine if `with-fluids*' is removed. Is this behavior expected (I didn't see it in the documentation) or is it a bug in Guile? Cheers, David --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=test-prompt-fluids.scm (define p (make-parameter 1)) (define cont (call-with-prompt 'foo (lambda () (with-fluids* (list (parameter-fluid p)) (list 2) (lambda () (+ (abort-to-prompt 'foo) (p))))) (lambda (k) k))) (p 3) (pk (cont 0)) --=-=-=--
guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.Ludovic Courtès <ludo@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 22 Feb 2025 15:00:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 22 10:00:59 2025 Received: from localhost ([127.0.0.1]:52663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tlqzs-0002PV-Gi for submit <at> debbugs.gnu.org; Sat, 22 Feb 2025 10:00:59 -0500 Received: from lists.gnu.org ([2001:470:142::17]:50054) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tlqyy-0002CB-PY for submit <at> debbugs.gnu.org; Sat, 22 Feb 2025 10:00:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tlqys-0000z6-IA for guix-patches@HIDDEN; Sat, 22 Feb 2025 09:59:50 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1tlqys-00079u-90; Sat, 22 Feb 2025 09:59:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=4MSsxYPaMgrM4+6gjxOmnvFcZ1QVQka/05Yj9YSAEB4=; b=K5Q5n1RsPmwPJF Rd4FxRGRk8mOcJmOgIFl+CaSZCPxihn91jEHgycT70yPTBCg75PM2if3hHRweWTBIIG5/or/o1mwN AcWCCtw2Xim2MjseW4nQKT9eI7aj9kveDiT4a86vg5Kf4L/HxEBKmepMX6QeN5ZLyroZVre+Y1vUN CsEl/pFvspX4D/qb9KqYuHLHd35gG8bv+bMPn7O9usAuvcx4fxD7eFhJVAs4hM63BucG3aMLCk5TJ 7uNpZG8Zqy2dKFJrxhQiixO57/reUQGt5hfd6xWuDPrAeCDR8FTNmgRpwU7E9OtmuDk0U3qFvDewU pZwyXLxOslqTCc+eb9dQ==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN> To: guix-patches@HIDDEN Subject: [PATCH] =?UTF-8?q?gexp:=20=E2=80=98with-parameters=E2=80=99=20pro?= =?UTF-8?q?perly=20handles=20=E2=80=98%graft=3F=E2=80=99.?= Date: Sat, 22 Feb 2025 15:59:37 +0100 Message-ID: <256e623843a70b001801dcddd7acb4138e6216b4.1740236293.git.ludo@HIDDEN> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit Cc: David Elsing <david.elsing@HIDDEN>, =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Fixes <https://issues.guix.gnu.org/75879>. * guix/gexp.scm (mcall-with-parameters): New procedure. (compile-parameterized): Use it instead of ‘with-fluids’. * tests/gexp.scm ("with-parameters for %graft?"): New test. Reported-by: David Elsing <david.elsing@HIDDEN> Change-Id: Iddda7ead2aeef24dd989ac37a53fc99b726731b3 --- guix/gexp.scm | 31 ++++++++++++++++++++++++------- tests/gexp.scm | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/guix/gexp.scm b/guix/gexp.scm index ad51bc55b78..012a6b2573a 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -728,19 +728,34 @@ (define-syntax-rule (with-parameters ((param value) ...) body ...) (lambda () body ...))) +(define (mcall-with-parameters parameters values thunk) + "Set PARAMETERS to VALUES for the dynamic extent of THUNK, a monadic +procedure." + ;; This is the procedural variant of 'mparameterize'. + (define (set-value parameter value) + (parameter value)) + + ;; XXX: Non-local exits can leave PARAMETERS set to VALUES. + (mlet* %store-monad ((old-values + (return (map set-value parameters values))) + (result (thunk))) + (mbegin %store-monad + (return (map set-value parameters old-values)) ;restore old values + (return result)))) + (define-gexp-compiler compile-parameterized <parameterized> compiler => (lambda (parameterized system target) (match (parameterized-bindings parameterized) (((parameters values) ...) - (let ((fluids (map parameter-fluid parameters)) - (thunk (parameterized-thunk parameterized))) + (let ((thunk (parameterized-thunk parameterized))) ;; Install the PARAMETERS for the dynamic extent of THUNK. - (with-fluids* fluids - (map (lambda (thunk) (thunk)) values) + ;; Special-case '%current-system' and '%current-target-system' to + ;; make sure we get the desired effect. + (mcall-with-parameters + parameters + (map (lambda (thunk) (thunk)) values) (lambda () - ;; Special-case '%current-system' and '%current-target-system' to - ;; make sure we get the desired effect. (let ((system (if (memq %current-system parameters) (%current-system) system)) @@ -2350,4 +2365,6 @@ (define* (references-file item #:optional (name "references") (read-hash-extend #\$ read-ungexp) (read-hash-extend #\+ (cut read-ungexp <> <> #t))) -;;; gexp.scm ends here +;;; Local Variables: +;;; eval: (put 'mcall-with-parameters 'scheme-indent-function 2) +;;; End: diff --git a/tests/gexp.scm b/tests/gexp.scm index e870f6cb1b9..2376c70d1ba 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -451,6 +451,26 @@ (define %extension-package (return (string=? (derivation-file-name drv) (derivation-file-name result))))) +(test-assertm "with-parameters for %graft?" + (mlet* %store-monad ((replacement -> (package + (inherit %bootstrap-guile) + (name (string-upcase + (package-name + %bootstrap-guile))))) + (guile -> (package + (inherit %bootstrap-guile) + (replacement replacement))) + (drv0 (package->derivation %bootstrap-guile)) + (drv1 (package->derivation replacement)) + (obj0 -> (with-parameters ((%graft? #f)) + guile)) + (obj1 -> (with-parameters ((%graft? #t)) + guile)) + (result0 (lower-object obj0)) + (result1 (lower-object obj1))) + (return (and (eq? drv0 result0) + (eq? drv1 result1))))) + (test-assert "with-parameters + file-append" (let* ((system (match (%current-system) ("aarch64-linux" "x86_64-linux") base-commit: 90aa90eb05429553402e0b5225d23f84742a9286 -- 2.48.1
Ludovic Courtès <ludo@HIDDEN>
:guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
.
Full text available.guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
:bug#76485
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.