unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: Justin Veilleux <terramorpha@cock.li>,  guix-devel@gnu.org
Subject: Re: Alternative syntax for interacting with the store monad
Date: Fri, 03 Jan 2025 00:04:21 +0900	[thread overview]
Message-ID: <87seq145qi.fsf@gmail.com> (raw)
In-Reply-To: <87h67mnh03.fsf@gmail.com> (Simon Tournier's message of "Mon, 02 Dec 2024 18:15:24 +0100")

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> 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.

That's not a super convincing argument to me (I sometimes dabble with
the monad, and the reason I don't do it more often at the REPL is partly
because I need to retrain myself how to use it every time :-)).
Something more intuitive could help, though I agree having multiple
flavors of one interface could lead to poor consistency in the code
base...

I'm divided.

-- 
Thanks,
Maxim


  reply	other threads:[~2025-01-02 15:04 UTC|newest]

Thread overview: 5+ 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
2025-01-02 15:04   ` Maxim Cournoyer [this message]
2025-01-03 13:08     ` Simon Tournier
2024-12-14 23:41 ` Ludovic Courtès

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=87seq145qi.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=terramorpha@cock.li \
    --cc=zimon.toutoune@gmail.com \
    /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).