From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:46125) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbSKc-00058B-I6 for guix-patches@gnu.org; Thu, 13 Jun 2019 12:12:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbSKa-0005vj-G2 for guix-patches@gnu.org; Thu, 13 Jun 2019 12:12:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50640) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbSKY-0005nZ-7t for guix-patches@gnu.org; Thu, 13 Jun 2019 12:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hbSKY-0008Fp-1X for guix-patches@gnu.org; Thu, 13 Jun 2019 12:12:02 -0400 Subject: [bug#36048] [PATCH] guix: import: hackage: handle hackage revisions Resent-Message-ID: Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) From: Robert Vollmert In-Reply-To: <87sgse43sc.fsf@ngyro.com> Date: Thu, 13 Jun 2019 18:11:00 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20190601223636.74362-1-rob@vllmrt.net> <87sgse43sc.fsf@ngyro.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Timothy Sample Cc: 36048@debbugs.gnu.org Hi Timothy, thanks for the detailed feedback, this is very helpful! I=E2=80=99ve sent an updated patch addressing some of the concerns, but = have some questions regarding others. (I just realized that the documentation updates probably anticipate multiple return values.) > On 13. Jun 2019, at 04:28, Timothy Sample wrote: >> + (let-values (((port get-hash) (open-sha256-input-port port))) >> + (cons >> + (read-cabal (canonical-newline-port port)) >> + (bytevector->nix-base32-string (get-hash))))) [=E2=80=A6] > Also, I think returning multiple values would be more natural here > (i.e., replace =E2=80=9Ccons=E2=80=9D with =E2=80=9Cvalues=E2=80=9D). I tried building it that way to begin with, but I=E2=80=99m having = issues making it work (nicely, or maybe at all). I think it comes down to later functions optionally failing with a single #f-value. Judging by the lack of infrastructure, I imagine functions that return different numbers of values are not idiomatic scheme. Should this be changed to return two values (#f #f) on failure? Or to raise an exception and handle it higher up when we want to ignore a failure? Currently, implementing this with values/let-values results in me doing more or less a combination of let-values and match, at which point it seems that any potential benefits of using multiple values as opposed to a pair/list are lost. (There=E2=80=99s no match-values = form is there?) Cheers Rob