Here is what I'm trying to do: I have a package that inherits from the ocaml package. Because of Various Reasons (tm) I am using substitute-keyword-arguments and modify-phases and I need to duplicate the shebang patching phase after multiple phases. What I wanted to do was write a helper function like: (duplicate-after 'conf-2 'patch-sh 'patch-sh-again) Then I realized I'd have to patch modify-phases to add this to its grammar. Then came the realizations that in Haskell this would instead be a composition of curried applications, that's the thing that the cut macro emulates in Scheme. So, (modify-phases foo (add-after 'a 'b f) (delete 'c)) is really: ``` (compose (cut add-after <> 'a 'b f) (cut delete <> 'c)) ``` And from having used Fennel a bit I know that it copied a very nice syntactic feature from Clojure, called the threading macros, which implements this exact idiom without having to write cut everywhere.
Guix currently has at least a few modify-whatever and substitute-whatever macros that all hardcode a few operations. Couldn't they be made much cleaner and more general by using a solid library of data manipulation functions and threading macros? The phases list could be treated like the actual data type it is, an ordered key-value mapping. ps.: On that note, Guile has generics, why doesn't any code use it? When I have to write things like string<? or package-native-inputs -- instead of < and native-inputs -- I feel like I'm in C again.
