unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: "(" <paren@disroot.org>, guix-devel@gnu.org
Subject: Re: Struggling to write Dissecting Guix, Part 2
Date: Wed, 25 Jan 2023 10:58:32 +0100	[thread overview]
Message-ID: <86tu0f541j.fsf@gmail.com> (raw)
In-Reply-To: <CQ13296O7II3.PG3SUFZDBPRI@guix-framework>

Hi,

On Wed, 25 Jan 2023 at 07:12, "(" <paren@disroot.org> wrote:

> I've been struggling to write Part 2 of Dissecting Guix; I'm just not sure where to start to
> explain monads.

Here my attempt to explain monads using Guile:

1:    https://simon.tournier.info/posts/2021-02-03-monad.html

My aim was to provide the “intuition” of the concept.  Therefore, I have
tried to explain the monad concept using as simple as possible other
concepts and in the same time I tried to avoid the “monad fallacy” [2].
(summarized by «Monads are Like Burritos» ;-)))


> It's hard for a variety of reasons, those being that:
>
>   - Guile has no type system, so you can't express monads in terms of types

I do not think the concept of monad is related to the type system but
instead it appears to me related to the composition.


>   - Guix doesn't implement very many monads (only state, identity, and store), so it's
>     difficult to explain with a simpler monad, as there are no simpler monads

In [1], I am using the simple monads: list and maybe.

Their implementation is poor but they bring the concept to the table.
Well, I planned to use this introduction of the concepts to then write
another post about the state monad – which is the only we are really
interested in. ;-)


>   - Guix doesn't have functors or monoids either, so it's hard to "progressively" explain
>     first functors, then monoids, then monads

I think monad can be introduced using the well-known ’map’ which uses
functor without digging in too much details.


>  - Monads are just difficult in general :P

Well, from my point of view, it is hard because the concept appears
difficult at first then after the oohh moment it becomes hard to explain
without using the concept itself.  IMHO, it is well summarized in this
post:

2: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/

Cheers,
simon


  reply	other threads:[~2023-01-25 10:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25  7:12 Struggling to write Dissecting Guix, Part 2 (
2023-01-25  9:58 ` zimoun [this message]
2023-01-26  6:32   ` (
2023-01-25 15:54 ` Wojtek Kosior via Development of GNU Guix and the GNU System distribution.
2023-01-26  6:33   ` (
2023-01-26 11:17   ` Simon Tournier
2023-01-26 20:03     ` bokr
2023-01-27 11:50       ` Simon Tournier
2023-01-25 19:39 ` david larsson
2023-01-26  6:34   ` (
2023-01-28 18:28     ` david larsson
2023-01-26 20:45 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.

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=86tu0f541j.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=paren@disroot.org \
    /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).