unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: Justin Veilleux <terramorpha@cock.li>, guix-devel@gnu.org
Subject: Re: Alternative syntax for interacting with the store monad
Date: Mon, 02 Dec 2024 18:15:24 +0100	[thread overview]
Message-ID: <87h67mnh03.fsf@gmail.com> (raw)
In-Reply-To: <875xo49w0p.fsf@cock.li>

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


      reply	other threads:[~2024-12-02 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30 22:50 Alternative syntax for interacting with the store monad Justin Veilleux
2024-12-02 17:15 ` Simon Tournier [this message]

Reply instructions:

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

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

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87h67mnh03.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=terramorpha@cock.li \
    /path/to/YOUR_REPLY

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

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

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).