Subject: Re: [PATCH v3] gnu: emacs-haskell-snippets: Use correct directory for snippets.

From: Liliana Marie Prikler <[email-masked]>
Date: Mon, 16 Oct 2023 18:57:56 +0200

Am Montag, dem 16.10.2023 um 12:57 +0200 schrieb Rostislav Svoboda:
> Hi Liliana,
> 
> Your patch works (thank you) and I improved it a tiny bit. (See
> attachment.) BTW shouldn't the revision number in the (git-version
> "0.1.0" "1" commit) be increased to "2" in your patch and to "3" in
> mine?
No.  It should just be one patch anyway and the change doesn't affect
the source code, but the build recipe.  As such, the rebuild is going
to happen either way.

> DRY in the specification of the relative path of the snippets
> directory.
You can just amend my commit.

> -                (let ((snippets
> -                       (string-append
> -                        (elpa-directory (assoc-ref outputs "out"))
> -                        "/snippets/haskell-mode")))
> -                  (mkdir-p snippets)
> -                  (copy-recursively "snippets/haskell-mode"
> snippets)))))))
> +                (let* ((relative-dirpath "snippets/haskell-mode")
> +                       (installation-dir
> +                        (string-append (elpa-directory (assoc-ref
> outputs "out"))
> +                                       "/" relative-dirpath)))
> +                  (mkdir-p installation-dir)
> +                  (copy-recursively relative-dirpath installation-
> dir)))))))
Now you repeat yourself on relative-dirpath (which is a very Java name
anyway, just five characters shorter than the original value won't win
you Kolmogorov complexity).  Plus you're requiring let* instead of let.

Btw. don't 
  ((compose 
    (lambda (src dst) (mkdir-p src) (copy-recursively dst src))
    (lambda (dir store) (values dir (string-append store "/" dir)))
   "snippets/haskell-mode" (elpa-directory (assoc-ref outputs "out")))
to avoid gratuitous repetition.

Sometimes explicit is better than implicit, even if it comes at the
cost of typing a constant twice :)

Cheers