[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Alternative syntax for interacting with the store monad
From: |
Simon Tournier |
Subject: |
Re: Alternative syntax for interacting with the store monad |
Date: |
Mon, 02 Dec 2024 18:15:24 +0100 |
Hi,
On Sat, 30 Nov 2024 at 17:50, Justin Veilleux <terramorpha@cock.li> wrote:
> (define (list-bind xs f)
> (apply append! (map f xs)))
>
> (define list-pure list)
>
> (with-monad list-bind list-pure
> (let ((x (bind '(1 2))))
> (pure
> (list
> x
> (bind '("thing1" "thing2"))))))
In [1], Josselin proposed something à la Haskell:
(mdo %store-monad
(drv <- (gexp-derivation "myderivation" test-gexp))
(output <- (return (derivation->output-path drv)))
(built-derivations (list drv))
(return (format #t "~a~%" output)))
Well, the conclusion seems that « it’s normally not necessary to use the
monadic interface unless you’re getting into internals or writing a new
tool. » Therefore, I do not know if improving the syntax is worth.
Cheers,
simon
1: Re: Viewing derivation output in the store
Josselin Poiret <dev@jpoiret.xyz>
Thu, 21 Apr 2022 09:44:05 +0200
id:87v8v2g9tm.fsf@jpoiret.xyz
https://lists.gnu.org/archive/html/guix-devel/2022-04
https://yhetil.org/guix/87v8v2g9tm.fsf@jpoiret.xyz
- Re: Alternative syntax for interacting with the store monad,
Simon Tournier <=