From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id iBVGF4/ELmUrkAAA9RJhRA:P1 (envelope-from ) for ; Tue, 17 Oct 2023 19:29:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iBVGF4/ELmUrkAAA9RJhRA (envelope-from ) for ; Tue, 17 Oct 2023 19:29:51 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E3B9A5638C for ; Tue, 17 Oct 2023 19:29:50 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="XyYpGh/R"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1697563791; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=bjZ4UWsU/K6dzawskbfx4aX68i2OQ+apg27k351x4Ts=; b=r+Hkx9wugVmXDpNNVSFXvHOXuYWSd2GdXWaBPx8bLTifLEFXQ0ZTnijlNsfHr5Qp2daWLI kkJ1uvLQZpy/OiYzlec8eJLZWJUqSloBoPiqWJyUJVCRXgDLDxCwQwDn6wlsjpkop4OCw2 rD8FRz6lgyoQdGA6BalDMxaCY9uZciVcMIkaQvbVBhoH+3Gsxy9Q/Gg/Zag840RZz9FBxS xquKyCNYwaL1wZGvLg/kwC8LbqWVvSpu9uuCi5xVYVekO8q5dCbOd7VO4oZ9zRkhp2MED3 TuAO5TA36v0zIN7eu3lkgn1i15eC5N/EagtMCQ4REvgEiLC15zwYeWacLDHEeA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1697563791; a=rsa-sha256; cv=none; b=iT8ef6NX5V2nATxBEiv4/9PdGmt1vo8QfH6vf3+1ZXJfK26ZrbOMWgBtoULIqW3a3OuNKK +5LUJ5Ieyoo+gxask9x32kpxQQgyEIS94eK5GRmlCOCM64G0THMqBFcCYMhvDvLkLHHtPQ 360r2xmEkUz+xZGLmyNCyJYvTmXQ/aFLlrmKi+RWYS6uPfzQDlBzk2oIDOV0k/8mCdNf0q MRQ5aRB/r1gSF0WGuHxEJx1J6sCGd+bOhj1orRIuYS6E7JEjeDbZ/dHGDqaf9VUmTp25yI LY8IAOme5seEAEBotlfowKlPilGRr7kamRK6eed2L89ME/+f9Jtfv+y96mxmvQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="XyYpGh/R"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsnsw-0006rf-Uy; Tue, 17 Oct 2023 13:29:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qsnsv-0006rW-P3 for guix-patches@gnu.org; Tue, 17 Oct 2023 13:29:37 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsnsv-0006MN-Fh for guix-patches@gnu.org; Tue, 17 Oct 2023 13:29:37 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qsntK-0000Cf-EG for guix-patches@gnu.org; Tue, 17 Oct 2023 13:30:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66562] [PATCH v3] gnu: emacs-haskell-snippets: Use correct directory for snippets. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 17 Oct 2023 17:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66562 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Rostislav Svoboda Cc: 66562@debbugs.gnu.org Received: via spool by 66562-submit@debbugs.gnu.org id=B66562.1697563798729 (code B ref 66562); Tue, 17 Oct 2023 17:30:02 +0000 Received: (at 66562) by debbugs.gnu.org; 17 Oct 2023 17:29:58 +0000 Received: from localhost ([127.0.0.1]:60976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsntG-0000Bh-86 for submit@debbugs.gnu.org; Tue, 17 Oct 2023 13:29:58 -0400 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]:52584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsntC-0000BR-VM for 66562@debbugs.gnu.org; Tue, 17 Oct 2023 13:29:56 -0400 Received: by mail-ej1-x641.google.com with SMTP id a640c23a62f3a-991c786369cso959845466b.1 for <66562@debbugs.gnu.org>; Tue, 17 Oct 2023 10:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697563763; x=1698168563; darn=debbugs.gnu.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=bjZ4UWsU/K6dzawskbfx4aX68i2OQ+apg27k351x4Ts=; b=XyYpGh/RRXoriYyX6IU7PMfSAUksVgvP5ph53amEZZf+Cqaby4P+L0AW0HWY67Y2BB gfYOP4RqErmrp+OKQ11/Ccfg0a32fsPlu6rgOaICfSZfFY4YHpmoCizGX37sxcbespbz U/C26ZFXJXPe0TScTNM3uNd1dljBMrYtN/dQu8g1/nydCx82AbrtZHGKbojR7D3PnE4H +AqPl3ToRnaz6Mcl+QibmOsN33twMPQK1A9LKStRDV06gG7yCbe0ZbpHsY2015iO+hT5 usNTYTR6vsR2eH4dtSw9thPoU8AV/J7fjyFrmptvzXCo7pp7FKY4Ldj2zh8ijKFVT8c3 rdFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697563763; x=1698168563; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bjZ4UWsU/K6dzawskbfx4aX68i2OQ+apg27k351x4Ts=; b=VV/ifIXNTI/iw1uKLKSCcpjFXabb+Ze8m7YzA/tJarBieSLkunmESGT8n7KJiGKkju ZuRM0MS11IPrpuclR7X5HLszcuQuLBKJRdWKUBGQiRcw8MKxMMPaJdOZBp0qjhx+SnBz Hm9vt8NYIBNwZbUz/jN+VhpKpa/3tN4nl1ZZJ31OosFQndmFWfCK9izbYkNKq0BWEsu5 3RKofu0w0CfM0QVAmSlgOl1/4b447IdqRouaS4Htc6uRW70uI4qZ0bkE5U7U+/7Zy8SO oFBCYQq+nQhQm0uqHR/TZysObkd36xTj3QO+vDTHWHhOeaigCXL6AheFBrh4zAs3Yml3 Q88A== X-Gm-Message-State: AOJu0YwJwUgqbHgizn4KKZwF1xDTs5GVEsU5gU3NAhIU1CEuzd8ztTka /IN20q7hRMd4TTjVWPajgL4= X-Google-Smtp-Source: AGHT+IFkRYvK8H5g9jYOMoRQNIK2rJmWiaTMEM0jU4OIOLXgu/OCnthY+4t4DnBld22N0ylXjHd8bg== X-Received: by 2002:a17:907:3e8c:b0:9ad:8aac:362b with SMTP id hs12-20020a1709073e8c00b009ad8aac362bmr2840328ejc.23.1697563762993; Tue, 17 Oct 2023 10:29:22 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id i22-20020a1709064ed600b00992f2befcbcsm161708ejv.180.2023.10.17.10.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 10:29:21 -0700 (PDT) Message-ID: <70adcf74508ed4c7c6159d7b904e4ceca5e7a75e.camel@gmail.com> From: Liliana Marie Prikler Date: Tue, 17 Oct 2023 19:29:20 +0200 In-Reply-To: References: <36c6ef9a672215883a84b8fec5a58a440d32ee11.1697394827.git.liliana.prikler@gmail.com> <17cd7d2255c7e3e1efb1fb83fc4c0cc84c0c127e.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: 2.84 X-Migadu-Queue-Id: E3B9A5638C X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: 2.84 X-TUID: W6r1r1v5T8Ov Hi, Rostislav Am Dienstag, dem 17.10.2023 um 18:49 +0200 schrieb Rostislav Svoboda: > [=E2=80=A6] > > Plus you're requiring let* instead of let. >=20 > Having both variants is a language deficiency, in my opinion. Only > let should exist, functioning as let* does. This should extend to > lambda*, define*, etc. Only let should exist, functioning as let does. let* is sugar on top. (Not serious about this, there are reasons to have let*, but there are also reasons it's not the default behaviour.) > > Btw. don't > > =C2=A0 ((compose > > =C2=A0=C2=A0=C2=A0 (lambda (src dst) (mkdir-p src) (copy-recursively ds= t src)) > > =C2=A0=C2=A0=C2=A0 (lambda (dir store) (values dir (string-append store= "/" dir))) > > =C2=A0=C2=A0 "snippets/haskell-mode" (elpa-directory (assoc-ref outputs > > "out"))) > > to avoid gratuitous repetition. >=20 > On the one hand, we face gratuitous repetition; on the other, a > snippet like this better expresses compositional transformation > between inputs and outputs, which I find to be a way more important > that avoiding gratuitous repetition (pun intended). And as a side > effect it also simplifies debugging: >=20 > ((compose > =C2=A0 ;; (lambda (a b) (format #t "[DBG] 3. a: ~a; b: ~a\n" a b) (values > a b)) > =C2=A0 (lambda (src dst) (mkdir-p src) (copy-recursively src dst)) > =C2=A0 ;; (lambda (a b) (format #t "[DBG] 2. a: ~a; b: ~a\n" a b) (values > a b)) > =C2=A0 (lambda (dir store) (values dir (string-append store "/" dir))) > =C2=A0 ;; (lambda (a b) (format #t "[DBG] 1. a: ~a; b: ~a\n" a b) (values > a b)) > =C2=A0 ) > =C2=A0"snippets/haskell-mode" (elpa-directory (assoc-ref outputs "out"))) If you need to warp your head around through three debug statements, I'm not convinced you're improving the overall code all that much. > And if you insist, the gratuitous repetition could, in theory, be > avoided: >=20 > ((compose > =C2=A0 copy-recursively > =C2=A0 (juxt mkdir-p (partial string-append (elpa-directory (assoc-ref > outputs "out")) "/"))) > =C2=A0"snippets/haskell-mode") >=20 > Only if partial and juxt would exist... and here you go ;-) >=20 > (define (partial fun . args) > =C2=A0 "Partial function application." > =C2=A0 (lambda x (apply fun (append args x)))) >=20 > (define (juxt . fns) > =C2=A0 "Naive implementation. Inspired by Clojure's juxt. > ((juxt a b c) x) =3D> (list (a x) (b x) (c x))" > =C2=A0 (lambda args > =C2=A0=C2=A0=C2=A0 (map (lambda (fn) (apply fn args)) fns))) >=20 > Here yet another pattern appears, the map-reduce. Also the juxt > function just screams for "let's call the mkdir-p and (partial > string-append ...) in parallel". You can do all that, but it does go against the KISS principle :) > > Btw. don't (compose ...) >=20 > Quite the contrary, I think we should do more of (compose ...), > however functional composition is hard-to-impossible if e.g.: >=20 > - essential higher order functions like juxt and partial are not > available. We have partial. We call it cut. It's part of SRFI-26. It even simplifies the definition of juxt:=C2=A0 (lambda args (map (cut apply <> args) fns)) Anyhow, we quite often don't use it because we'd have to add it to #:modules and the benefit over raw lambdas is often negligible. > - mkdir-p and copy-recursively from the (guix build utils) aren't > monadic and mkdir-p returns #t instead of a path-string and > copy-recursively returns: >=20 > =C2=A0 scheme@(guile-user)> ,use (guix build utils) > =C2=A0 scheme@(guile-user)> (copy-recursively "/tmp/f1.txt" "/tmp/f2.txt"= ) > =C2=A0 `/tmp/foo.txt' -> `/tmp/fox.txt' >=20 > =C2=A0 eeeh... what exactly is the return value of copy-recursively? Hmm. It returns *unspecified*. Yes, most of this stuff is indeed not monadic. Scheme is not purely functional, so side effects are allowed :) > - copy-recursively, although naturally a reducer (i.e. a member of > the fold-family, think of 'a list of things goes into a container') > is not implemented as such. Hmm, disappointing... although a <...>- > fold is used in its implementation. Double hmm. There is a cost to constructing the return value of a fold. I personally can do without creating lists that no one will end up inspecting anyway. > - in general, the built-in compose function can't be called with zero > arguments. For that purpose I cobbled myself: >=20 > (define (comp . fns) > =C2=A0 "Like `compose'. Can be called with zero arguments. I.e. (thunk? > comp) =3D> #t > Works also for functions returning and accepting multiple values." > =C2=A0 (lambda args > =C2=A0=C2=A0=C2=A0 (if (null? fns) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (apply values args) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let [(proc (car fns)) (rest (= cdr fns))] > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (null? rest) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (apply proc args) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (let ((g (apply comp rest))) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (call-with-values (lambda () (apply g args)) > proc))))))) I'd argue that compose without procedures is quite meaningless, but maybe I'm thinking too hard. > And finally, in the (guix build utils) there's the install-file which > works with single files. What about adding its recursive version: >=20 > (define* (install-recursively source destination > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 #:key > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (log (current-output-port)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (follow-symlinks? #f) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (copy-file copy-file) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 keep-mtime? keep-permissions?) > =C2=A0 "Recursive version of install-file." > =C2=A0 (mkdir-p destination) > =C2=A0 (copy-recursively source > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (string-append destination "/" (= basename > destination)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:log log > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:follow-symlinks? follow-symlin= ks? > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:copy-file copy-file > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:keep-mtime? keep-mtime? > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:keep-permissions? keep-permiss= ions?)) There'd be no point in having copy-recursively then. For a more complete build system that already takes care of all that without having you fiddling with juxt, partial, etc., just take copy-build- system. Not that it's needed here, mind you. Cheers