Subject: [bug#76485] [PATCH] gexp: ‘with-parameters’ properly handles ‘%graft?’.

From: David Elsing <[email-masked]>
Date: Tue, 04 Mar 2025 20:31:39 +0000

Hi Ludo',

Ludovic Courtès <[email-masked]> writes:

> I guess my contradiction is that I’m looking for a “generic” 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,
> ‘mparameterize’ and the many commits that fixed interactions between
> ‘%current-system’ & 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’m also looking for a “quick fix” 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 ‘with-parameters’ in particular so it also
> works for ‘%graft?’.
>
> Or are you saying that the patch at the beginning of this thread (where
> ‘mcall-with-parameters’ is specialized for the state monad) 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