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

From: Ludovic Courtès <[email-masked]>
Date: Tue, 04 Mar 2025 23:18:25 +0100

Hey David,

David Elsing <[email-masked]> 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,
>> ‘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.

That’s right, glad you like it.  :-)

Overall I think the initial motivation for having monads (the “store”
monad in particular) still makes sense.  It’s 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’m not sure.  In a way, file-like objects achieve something similar to
the store monad, but in a more “Schemey” way.  Likewise, Scheme 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’t play well with other features (first of all by
“contaminating” 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’.