From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 06 05:16:25 2017 Received: (at submit) by debbugs.gnu.org; 6 Apr 2017 09:16:25 +0000 Received: from localhost ([127.0.0.1]:34453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3Wh-0005ht-CO for submit@debbugs.gnu.org; Thu, 06 Apr 2017 05:16:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51901) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3Wf-0005hf-Dt for submit@debbugs.gnu.org; Thu, 06 Apr 2017 05:16:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cw3WW-0004fk-B5 for submit@debbugs.gnu.org; Thu, 06 Apr 2017 05:16:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cw3WW-0004fV-7s for submit@debbugs.gnu.org; Thu, 06 Apr 2017 05:16:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cw3WU-0006oQ-RX for guix-patches@gnu.org; Thu, 06 Apr 2017 05:16:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cw3WU-0004eN-26 for guix-patches@gnu.org; Thu, 06 Apr 2017 05:16:10 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:35129) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cw3WT-0004eD-S3 for guix-patches@gnu.org; Thu, 06 Apr 2017 05:16:09 -0400 Received: by mail-pg0-x243.google.com with SMTP id g2so7127259pge.2 for ; Thu, 06 Apr 2017 02:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=73BNL2ROVxR2bHRN4gHysdntIDIzadOGJfTIc+CWVWM=; b=n2dQRveSxYLZ/mpiqKLXD7Z4AcpRV3Pp9WPtpfB/9bgBMASG9hGa0K2tJfBqRuJhGT ZL466rx0q3m+6JKiUI2GAFfnp2NFRsEiahrxMhFgPJ5Y0KWFcpuENnsE5B9nFPM5PnJT wjRs4SzzXQf5Dk986ks8hXV2PXgQpKAWuJbbSpFZhgPI1xEO9LHBq8ACXRFjn21Pjk3K oi5eH1SYOXo673u0O8rcogDMCcAy9HAMNzZXOHWccgVxQhbIhhpjI+LlAPphbvmX5n1H jWS0jDYijlTOfMBVysuXnzVYY/R1OmbKRtKMx7H4AXEcOJYhgURXahwagXrxu6NvnbCN UarQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=73BNL2ROVxR2bHRN4gHysdntIDIzadOGJfTIc+CWVWM=; b=DaDqCfH9ERyUac3It1jCMJQ4dTSmKwd6nU3imgf8oOcyriani4NLnJ4q78Lut8O43p Ruoa8fV9zMaKfKg0RcYJmM9qObGaJIXe7FxZXGDhB2TOf73PXXcEFgrxTTg/RtkwCA2+ NmhvCxpiBbN2nWYlJeLhBQ2pUFjRerSijnSFf+RoWU8q0rVzLpok/7ekAjKUE/0ZmxqP t+tM95sboIFav0m2LkaoH+0e9q2P1DnfMtz3oIGVjhosxu5jO02RTWlEGNQJAygfWfue 4YLG+ZsHZN7qrV9isqP7KuqEj/1npnPwnjhPux2/Ru7S3hMKtIYcrLfQod/0j7p9ouZ+ KfNw== X-Gm-Message-State: AFeK/H29dJf4S0IHDuc8PWpnFH6gex3lpoXq1SjTavWXH0f3OhB6WaM1MU00tO4yJS0+Cw== X-Received: by 10.98.211.143 with SMTP id z15mr34613657pfk.46.1491470168388; Thu, 06 Apr 2017 02:16:08 -0700 (PDT) Received: from garuda.hsd1.wa.comcast.net. ([2601:602:9d02:4725:4e0f:6eff:fef6:70b9]) by smtp.gmail.com with ESMTPSA id i15sm2538742pfa.34.2017.04.06.02.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 02:16:07 -0700 (PDT) From: Chris Marusich To: guix-patches@gnu.org Subject: [PATCH 0/3] Improve documentation for monads. Date: Thu, 6 Apr 2017 02:15:46 -0700 Message-Id: <20170406091546.24107-1-cmmarusich@gmail.com> X-Mailer: git-send-email 2.12.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: Chris Marusich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi, The following patch series attempts to clarify how one is supposed to use some of the monad-related syntax that Guix provides. It also documents two commonly used forms (mwhen and munless) that were missing from the manual. Some of this might seem obvious to someone who is already familiar with monads. However, since I only recently learned about monads, a lot of these details were not obvious to me at all. For example, I didn't know that every expression in an mbegin needs to be a monadic expression (despite having read the manual multiple times). This was especially confusing because the same is NOT true for an mlet. I hope these patches will help clarify for other monad newbies how this syntax is supposed to be used. -- Chris Chris Marusich (3): monads: Use intent-revealing parameter names. monads, doc: Improve mwhen and munless documentation. monads: Improve mlet, mlet*, and mbegin documentation. doc/guix.texi | 28 +++++++++++++++++++++++++--- guix/monads.scm | 36 +++++++++++++++++++++++------------- 2 files changed, 48 insertions(+), 16 deletions(-) -- 2.12.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 06 05:29:24 2017 Received: (at 26382) by debbugs.gnu.org; 6 Apr 2017 09:29:24 +0000 Received: from localhost ([127.0.0.1]:34465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3jI-00061a-FZ for submit@debbugs.gnu.org; Thu, 06 Apr 2017 05:29:24 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3jG-00061N-V4 for 26382@debbugs.gnu.org; Thu, 06 Apr 2017 05:29:23 -0400 Received: by mail-pg0-f65.google.com with SMTP id 81so7211085pgh.3 for <26382@debbugs.gnu.org>; Thu, 06 Apr 2017 02:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eQaEHrhPOJs8pMZUKaLAgAHmsEUCyu2DF9b7ZNnj47k=; b=AlIEBaSZznBrOk7hye+AHIqkZnidP6EcEw+JyNHYsTuJdMlWMrn8MfRVzSwqLOEhEZ Zn3wkfFmj7lh2EAfEvfrMpCNo2RklU2Sjo7Wo1kWESDEPXcCvBk5GlQQmM63CdOY6jql 4/Ac/nP/T5ep92PkbyDfliE2/IpXX+DND4QkTdbuMvzT6erHo7l2HoLZO8zk94gpCn1m MWWUka+56mQVcIybatB+/lX/MgXiRRl2jOk4uDx55pSiqDXEbNXDlWFASPC1uST3J22L xwfmLgcdIdD+ffqsR6FBW2MzmLYgjYJ7btRqoqYZnpel3sSc63GN57Hdt9is/XU4Jhwj 36fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eQaEHrhPOJs8pMZUKaLAgAHmsEUCyu2DF9b7ZNnj47k=; b=nqgEnQ6TSR+c8Kp/HByc14c9o35Wgf8aZd3kmIItnR2RXd4SBoPfTEW3whHCRHCrMP eOVqi91/P4ah3dZndDydLBrEjIA4cinmCu7CrF5umAnVVW1ChN8JfweZD56WJRsS2Ey6 T0kR3jXZdNHPUQ0I3+NR0kyN3+k8VG/nViCDgOdm0fook73CFDN3vg3s8JzQOykza9m1 +z8tcoU8AQ95hLEKdGBxYOtc0hKCg0wu19Bb4f6FiEO1dxMVAklHDCUyZCKIwYkUgsvU jaSTxE1Cf1nYmYqc3ECAvXgZaVYKOv5RJLrJXZnOO+f8pbPfAUlBxLr6OesS7467Rnw5 0bqQ== X-Gm-Message-State: AFeK/H1NmDCrDvVmR82CEnDRh3E2DAb3EIQ8kYDahVQO2v7IjuJQ0VyZI05S2qnS0d4gog== X-Received: by 10.84.130.99 with SMTP id 90mr42416958plc.94.1491470956590; Thu, 06 Apr 2017 02:29:16 -0700 (PDT) Received: from garuda.hsd1.wa.comcast.net. ([2601:602:9d02:4725:4e0f:6eff:fef6:70b9]) by smtp.gmail.com with ESMTPSA id r17sm2631336pfa.13.2017.04.06.02.29.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 02:29:15 -0700 (PDT) From: Chris Marusich To: 26382@debbugs.gnu.org Subject: [PATCH 1/3] monads: Use intent-revealing parameter names. Date: Thu, 6 Apr 2017 02:28:34 -0700 Message-Id: <20170406092836.24766-1-cmmarusich@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170406091546.24107-1-cmmarusich@gmail.com> References: <20170406091546.24107-1-cmmarusich@gmail.com> X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 26382 Cc: Chris Marusich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) * guix/monads.scm (mwhen, munless): Rename parameters from 'exp0' and 'exp' to 'mexp0' and 'mexp', respectively. This makes it more obvious that these expressions must be monadic expressions. --- guix/monads.scm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/guix/monads.scm b/guix/monads.scm index 0b0ad239d..6933f7f15 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -204,23 +204,23 @@ the last one." (define-syntax mwhen (syntax-rules () - "When CONDITION is true, evaluate EXP0..EXP* as in an 'mbegin'. When + "When CONDITION is true, evaluate MEXP0..MEXP* as in an 'mbegin'. When CONDITION is false, return *unspecified* in the current monad." - ((_ condition exp0 exp* ...) + ((_ condition mexp0 mexp* ...) (if condition (mbegin %current-monad - exp0 exp* ...) + mexp0 mexp* ...) (return *unspecified*))))) (define-syntax munless (syntax-rules () - "When CONDITION is false, evaluate EXP0..EXP* as in an 'mbegin'. When + "When CONDITION is false, evaluate MEXP0..MEXP* as in an 'mbegin'. When CONDITION is true, return *unspecified* in the current monad." - ((_ condition exp0 exp* ...) + ((_ condition mexp0 mexp* ...) (if condition (return *unspecified*) (mbegin %current-monad - exp0 exp* ...))))) + mexp0 mexp* ...))))) (define-syntax define-lift (syntax-rules () -- 2.12.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 06 05:29:32 2017 Received: (at 26382) by debbugs.gnu.org; 6 Apr 2017 09:29:33 +0000 Received: from localhost ([127.0.0.1]:34468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3jQ-00061z-Mq for submit@debbugs.gnu.org; Thu, 06 Apr 2017 05:29:32 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3jO-00061i-QT for 26382@debbugs.gnu.org; Thu, 06 Apr 2017 05:29:31 -0400 Received: by mail-pg0-f67.google.com with SMTP id 81so7211809pgh.3 for <26382@debbugs.gnu.org>; Thu, 06 Apr 2017 02:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fSkQi/cdDOseGtwagrDhvWC0sqAGVxLmAoGhBpSTIB4=; b=PmNADEnP3wJ6pLV898gh/cRkgb+pvW7LQnY51ofmeLyH2rePPGaNWighv/9352jVkT OH1kF0bXFquYeeVa9FqCGz79T0aaRDIE5eo0Z+17eA4FSe+ZrRQ8n0W9XpGtyhSQAhIz L3irJ3P+89IZRfwVZMHDcL1Xz/RNI+Owm00jhlMfE+Fe3EnFyUVRW+wXQbBIrinDhjBv ZohJNcflDOC67hAavKzv7n+YCPWy79gOWXE2fxypC1++VwgPCujcljbhxe/ZY9Iy5RaK gZhjgl0D/xj3+x4z6kY5DD8Un7TRYz0Y8Sl19kjT0c6lFVndTupZSzbJzol7E8MmOVDb VMoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fSkQi/cdDOseGtwagrDhvWC0sqAGVxLmAoGhBpSTIB4=; b=FePTuTkJ5iCUbhvQNJYpncGBkvaGmEHR4LRVSrOMZQdeElG1M2aOfq7SLXcbMo49Si WFjry7Bv1mALHG6PHmCUwh87AtJbJidxglz9Oj0BXgb8RY+IC/LfEpqQSOAUWxwmn32u UlkVoyfDow6hKbo9c9ATGhgZUHwmtZBJYa6Z5SwAmXGfIJvcmmkoYBbnAKMOEFO+XFTl q1TKhAPwTnGcwX8RehHaC/OSWFsSagxlA1A0kJ3Q5dUGH3AsKmsIBFMZEqb5gVlP12hI rnKFkwxNwPWQAMt+4oYYh/5T12qlKLfTshpbr3sr7Qs050EDQG0iGXDj4ap9MJeoGxDJ 0xpA== X-Gm-Message-State: AFeK/H2uG3Gp6i/Y3kyj/p2xTSBDxF5JSB+7ypIZUBw1MFUEICfyJgHhR3/V/OzDzVqoZQ== X-Received: by 10.98.197.133 with SMTP id j127mr34448818pfg.238.1491470964549; Thu, 06 Apr 2017 02:29:24 -0700 (PDT) Received: from garuda.hsd1.wa.comcast.net. ([2601:602:9d02:4725:4e0f:6eff:fef6:70b9]) by smtp.gmail.com with ESMTPSA id r17sm2631336pfa.13.2017.04.06.02.29.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 02:29:23 -0700 (PDT) From: Chris Marusich To: 26382@debbugs.gnu.org Subject: [PATCH 2/3] monads, doc: Improve mwhen and munless documentation. Date: Thu, 6 Apr 2017 02:28:35 -0700 Message-Id: <20170406092836.24766-2-cmmarusich@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170406092836.24766-1-cmmarusich@gmail.com> References: <20170406091546.24107-1-cmmarusich@gmail.com> <20170406092836.24766-1-cmmarusich@gmail.com> X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 26382 Cc: Chris Marusich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) * doc/guix.texi ((guix) The Store Monad) : Document them. * guix/monads.scm (mwhen, munless): Clarify their intended use. --- doc/guix.texi | 14 ++++++++++++++ guix/monads.scm | 12 ++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index aa779e38e..a1aae8f6c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4027,6 +4027,20 @@ monadic expressions are ignored. In that sense, it is analogous to @code{begin}, but applied to monadic expressions. @end deffn +@deffn {Scheme System} mwhen @var{condition} @var{mexp0} @var{mexp*} ... +When @var{condition} is true, evaluate the sequence of monadic +expressions @var{mexp0}..@var{mexp*} as in an @code{mbegin}. When +@var{condition} is false, return @code{*unspecified*} in the current +monad. Every expression in the sequence must be a monadic expression. +@end deffn + +@deffn {Scheme System} munless @var{condition} @var{mexp0} @var{mexp*} ... +When @var{condition} is false, evaluate the sequence of monadic +expressions @var{mexp0}..@var{mexp*} as in an @code{mbegin}. When +@var{condition} is true, return @code{*unspecified*} in the current +monad. Every expression in the sequence must be a monadic expression. +@end deffn + @cindex state monad The @code{(guix monads)} module provides the @dfn{state monad}, which allows an additional value---the state---to be @emph{threaded} through diff --git a/guix/monads.scm b/guix/monads.scm index 6933f7f15..fe3d5d78f 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -204,8 +204,10 @@ the last one." (define-syntax mwhen (syntax-rules () - "When CONDITION is true, evaluate MEXP0..MEXP* as in an 'mbegin'. When -CONDITION is false, return *unspecified* in the current monad." + "When CONDITION is true, evaluate the sequence of monadic expressions +MEXP0..MEXP* as in an 'mbegin'. When CONDITION is false, return *unspecified* +in the current monad. Every expression in the sequence must be a monadic +expression." ((_ condition mexp0 mexp* ...) (if condition (mbegin %current-monad @@ -214,8 +216,10 @@ CONDITION is false, return *unspecified* in the current monad." (define-syntax munless (syntax-rules () - "When CONDITION is false, evaluate MEXP0..MEXP* as in an 'mbegin'. When -CONDITION is true, return *unspecified* in the current monad." + "When CONDITION is false, evaluate the sequence of monadic expressions +MEXP0..MEXP* as in an 'mbegin'. When CONDITION is true, return *unspecified* +in the current monad. Every expression in the sequence must be a monadic +expression." ((_ condition mexp0 mexp* ...) (if condition (return *unspecified*) -- 2.12.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 06 05:29:37 2017 Received: (at 26382) by debbugs.gnu.org; 6 Apr 2017 09:29:37 +0000 Received: from localhost ([127.0.0.1]:34471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3jU-00062H-VS for submit@debbugs.gnu.org; Thu, 06 Apr 2017 05:29:37 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw3jT-00061q-Rr for 26382@debbugs.gnu.org; Thu, 06 Apr 2017 05:29:36 -0400 Received: by mail-pg0-f65.google.com with SMTP id g2so7198503pge.2 for <26382@debbugs.gnu.org>; Thu, 06 Apr 2017 02:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cOrVi4Yui8FTh0FeUcYNlJeS9bd9carJTxt3pM0xRMY=; b=BwSqC7x1296Lbl2+gQZ0NhyN2V+B5gHx7eX7K3ELhKxOwZO2KKWYcpNToTskeK6sKw bg02YeDBf0qqn+c+6nrEkEo/smQp25Y3e5Qh5NjQI11t1nTdL1uFxlEtBqmDLAZKipVf q0hp7tDivbbuTCpZKlAjgmPehoSVLuLEpFiC5WpLA0opUsciR9XbUPvsKhzBKmksWA+P iCYfQIbxQuwSukY/DejHA/Z2BZ1Zd1aphCq8nIxY3XM0Zy2pOKuTjocVZNM06IUG8XOM xaFoXW0zuzfiCOw4eOyMYPllhABNK+84wddrV+lmkBgqt0KXuV7cJFNkp4OvgVpQMgSG qM4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cOrVi4Yui8FTh0FeUcYNlJeS9bd9carJTxt3pM0xRMY=; b=OdjbjU0pP6ULMj/5MukfMh2epYh4pyFo7W1+AzjiWd6eq446r+6mWd3QCXZ6/zYMGt sKyvKgp0fy3F1gI5ylD7dJOt5uiaFhUczJ53Z/hoAG6AIXZ5V5dx8ZSyoAIOo64mwsrk 2ZqBBHUKcKhh4iaZuc5QjKqovVGR+Pwfn1GX4s8vEe6gXxmmoQ89zXGbiYn/4fNRxRle PhipOTqmfBeBrFRW7amawv+zDVarfiU69VSeEdny5haG1cQu5dRadoAZsgyNx/urXy+R bjCGxbDj2Cm8SJf/P/ee4Xpf5XOUH7zORCM1b9gNN4XloPZPGcl1yserBwLvoH1QzrHQ G+yQ== X-Gm-Message-State: AFeK/H32g7eRlr2J9BU4B4gNY6ncZUyMwhpMze+4dPOq/sR2/5u5m/S2z7smjxtxyCldPg== X-Received: by 10.99.56.17 with SMTP id f17mr35610959pga.228.1491470969663; Thu, 06 Apr 2017 02:29:29 -0700 (PDT) Received: from garuda.hsd1.wa.comcast.net. ([2601:602:9d02:4725:4e0f:6eff:fef6:70b9]) by smtp.gmail.com with ESMTPSA id r17sm2631336pfa.13.2017.04.06.02.29.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 02:29:28 -0700 (PDT) From: Chris Marusich To: 26382@debbugs.gnu.org Subject: [PATCH 3/3] monads: Improve mlet, mlet*, and mbegin documentation. Date: Thu, 6 Apr 2017 02:28:36 -0700 Message-Id: <20170406092836.24766-3-cmmarusich@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170406092836.24766-1-cmmarusich@gmail.com> References: <20170406091546.24107-1-cmmarusich@gmail.com> <20170406092836.24766-1-cmmarusich@gmail.com> X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 26382 Cc: Chris Marusich X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) * doc/guix.texi ((guix) The Store Monad) : Clarify their intended usage. * guix/monads.scm (mlet*, mbegin): Update docstrings accordingly. --- doc/guix.texi | 14 +++++++++++--- guix/monads.scm | 16 +++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a1aae8f6c..5cd33a31d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4011,8 +4011,15 @@ in this example: @deffnx {Scheme Syntax} mlet* @var{monad} ((@var{var} @var{mval}) ...) @ @var{body} ... Bind the variables @var{var} to the monadic values @var{mval} in -@var{body}. The form (@var{var} -> @var{val}) binds @var{var} to the -``normal'' value @var{val}, as per @code{let}. +@var{body}, which is a sequence of expressions. As with the bind +operator, this can be thought of as ``unpacking'' the raw, non-monadic +value ``contained'' in @var{mval} and making @var{var} refer to that +raw, non-monadic value within the scope of the @var{body}. The form +(@var{var} -> @var{val}) binds @var{var} to the ``normal'' value +@var{val}, as per @code{let}. The binding operations occur in sequence +from left to right. The last expression of @var{body} must be a monadic +expression, and its result will become the result of the @code{mlet} or +@code{mlet*} when run in the @var{monad}. @code{mlet*} is to @code{mlet} what @code{let*} is to @code{let} (@pxref{Local Bindings,,, guile, GNU Guile Reference Manual}). @@ -4020,7 +4027,8 @@ Bind the variables @var{var} to the monadic values @var{mval} in @deffn {Scheme System} mbegin @var{monad} @var{mexp} ... Bind @var{mexp} and the following monadic expressions in sequence, -returning the result of the last expression. +returning the result of the last expression. Every expression in the +sequence must be a monadic expression. This is akin to @code{mlet}, except that the return values of the monadic expressions are ignored. In that sense, it is analogous to diff --git a/guix/monads.scm b/guix/monads.scm index fe3d5d78f..2f66f4262 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -157,9 +157,14 @@ though BIND is simply binary, as in: (define-syntax mlet* (syntax-rules (->) - "Bind the given monadic values MVAL to the given variables VAR. When the -form is (VAR -> VAL), bind VAR to the non-monadic value VAL in the same way as -'let'." + "Bind the variables VAR to the monadic values MVAL in BODY, which is a +sequence of expressions. As with the bind operator, this can be thought of as +\"unpacking\" the raw, non-monadic value \"contained\" in MVAL and making VAR +refer to that raw, non-monadic value within the scope of the BODY. The +form (VAR -> VAL) binds VAR to the \"normal\" value VAL, as per 'let'. The +binding operations occur in sequence from left to right. The last expression +of BODY must be a monadic expression, and its result will become the result of +the MLET* when run in the MONAD." ;; Note: the '->' symbol corresponds to 'is:' in 'better-monads.rkt'. ((_ monad () body ...) (with-monad monad body ...)) @@ -185,8 +190,9 @@ form is (VAR -> VAL), bind VAR to the non-monadic value VAL in the same way as (define-syntax mbegin (syntax-rules (%current-monad) - "Bind the given monadic expressions in sequence, returning the result of -the last one." + "Bind MEXP and the following monadic expressions in sequence, returning +the result of the last expression. Every expression in the sequence must be a +monadic expression." ((_ %current-monad mexp) mexp) ((_ %current-monad mexp rest ...) -- 2.12.0 From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 08 08:30:36 2017 Received: (at 26382) by debbugs.gnu.org; 8 Apr 2017 12:30:36 +0000 Received: from localhost ([127.0.0.1]:37173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwpVk-0005Ix-HN for submit@debbugs.gnu.org; Sat, 08 Apr 2017 08:30:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwpVh-0005Ig-Fw for 26382@debbugs.gnu.org; Sat, 08 Apr 2017 08:30:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwpVX-0000dG-Hs for 26382@debbugs.gnu.org; Sat, 08 Apr 2017 08:30:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40649) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwpVX-0000d3-Ds; Sat, 08 Apr 2017 08:30:23 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:59512 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cwpVW-0006QX-PO; Sat, 08 Apr 2017 08:30:23 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Chris Marusich Subject: Re: bug#26382: [PATCH 1/3] monads: Use intent-revealing parameter names. References: <20170406091546.24107-1-cmmarusich@gmail.com> <20170406092836.24766-1-cmmarusich@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Germinal an 225 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Sat, 08 Apr 2017 14:30:20 +0200 In-Reply-To: <20170406092836.24766-1-cmmarusich@gmail.com> (Chris Marusich's message of "Thu, 6 Apr 2017 02:28:34 -0700") Message-ID: <87zifrqdyb.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26382 Cc: 26382@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Chris Marusich skribis: > * guix/monads.scm (mwhen, munless): Rename parameters from 'exp0' and 'ex= p' to > 'mexp0' and 'mexp', respectively. This makes it more obvious that these > expressions must be monadic expressions. Applied, thanks! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 08 08:31:40 2017 Received: (at 26382) by debbugs.gnu.org; 8 Apr 2017 12:31:40 +0000 Received: from localhost ([127.0.0.1]:37177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwpWl-0005Kh-Qq for submit@debbugs.gnu.org; Sat, 08 Apr 2017 08:31:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwpWk-0005KU-MW for 26382@debbugs.gnu.org; Sat, 08 Apr 2017 08:31:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwpWa-0001ah-Od for 26382@debbugs.gnu.org; Sat, 08 Apr 2017 08:31:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwpWa-0001aX-L2; Sat, 08 Apr 2017 08:31:28 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:59576 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cwpWa-00087F-0A; Sat, 08 Apr 2017 08:31:28 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Chris Marusich Subject: Re: bug#26382: [PATCH 2/3] monads, doc: Improve mwhen and munless documentation. References: <20170406091546.24107-1-cmmarusich@gmail.com> <20170406092836.24766-1-cmmarusich@gmail.com> <20170406092836.24766-2-cmmarusich@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Germinal an 225 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Sat, 08 Apr 2017 14:31:26 +0200 In-Reply-To: <20170406092836.24766-2-cmmarusich@gmail.com> (Chris Marusich's message of "Thu, 6 Apr 2017 02:28:35 -0700") Message-ID: <87vaqfqdwh.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26382 Cc: 26382@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Chris Marusich skribis: > * doc/guix.texi ((guix) The Store Monad) : Document them. > * guix/monads.scm (mwhen, munless): Clarify their intended use. Applied! From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 08 08:36:48 2017 Received: (at 26382-done) by debbugs.gnu.org; 8 Apr 2017 12:36:48 +0000 Received: from localhost ([127.0.0.1]:37183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwpbk-0005SJ-EV for submit@debbugs.gnu.org; Sat, 08 Apr 2017 08:36:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwpbi-0005S6-PP for 26382-done@debbugs.gnu.org; Sat, 08 Apr 2017 08:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwpbY-0006RS-Ky for 26382-done@debbugs.gnu.org; Sat, 08 Apr 2017 08:36:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwpbY-0006RD-Hl; Sat, 08 Apr 2017 08:36:36 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:59856 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cwpbX-0007Vr-QR; Sat, 08 Apr 2017 08:36:36 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Chris Marusich Subject: Re: bug#26382: [PATCH 3/3] monads: Improve mlet, mlet*, and mbegin documentation. References: <20170406091546.24107-1-cmmarusich@gmail.com> <20170406092836.24766-1-cmmarusich@gmail.com> <20170406092836.24766-3-cmmarusich@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Germinal an 225 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Sat, 08 Apr 2017 14:36:34 +0200 In-Reply-To: <20170406092836.24766-3-cmmarusich@gmail.com> (Chris Marusich's message of "Thu, 6 Apr 2017 02:28:36 -0700") Message-ID: <87o9w7qdnx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26382-done Cc: 26382-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Chris Marusich skribis: > * doc/guix.texi ((guix) The Store Monad) : Clarify > their intended usage. > * guix/monads.scm (mlet*, mbegin): Update docstrings accordingly. [...] > --- a/guix/monads.scm > +++ b/guix/monads.scm > @@ -157,9 +157,14 @@ though BIND is simply binary, as in: >=20=20 > (define-syntax mlet* > (syntax-rules (->) > - "Bind the given monadic values MVAL to the given variables VAR. Whe= n the > -form is (VAR -> VAL), bind VAR to the non-monadic value VAL in the same = way as > -'let'." > + "Bind the variables VAR to the monadic values MVAL in BODY, which is= a > +sequence of expressions. As with the bind operator, this can be thought= of as > +\"unpacking\" the raw, non-monadic value \"contained\" in MVAL and makin= g VAR > +refer to that raw, non-monadic value within the scope of the BODY. The > +form (VAR -> VAL) binds VAR to the \"normal\" value VAL, as per 'let'. = The > +binding operations occur in sequence from left to right. The last expre= ssion > +of BODY must be a monadic expression, and its result will become the res= ult of > +the MLET* when run in the MONAD." > ;; Note: the '->' symbol corresponds to 'is:' in 'better-monads.rkt'. > ((_ monad () body ...) > (with-monad monad body ...)) I applied the patch but decided to leave out the hunk above so that the docstring remains concise (I view the docstring as a helper rather than as a reference here.) Let me know what you think. And yes, I agree that the fact that the body of =E2=80=98mlet=E2=80=99 is a= regular value whereas the body of =E2=80=98mbegin=E2=80=99 is a monadic value can b= e confusing. Making it this way appeared to cater to the most common use cases, though. Thanks for improving the documentation! Ludo=E2=80=99. From unknown Thu Aug 21 14:54:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 07 May 2017 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator