@@ -107,11 +107,13 @@ rec {
107107 # replaceChars ["<" ">"] ["<" ">"] "<foo>" returns "<foo>".
108108 replaceChars = del: new: s:
109109 let
110+ substList = lib.zipLists del new;
110111 subst = c:
111− (lib.fold
112− (sub: res: if sub.fst == c then sub else res)
113− {fst = c; snd = c;} (lib.zipLists del new)
114− ).snd;
112+ let found = lib.findFirst (sub: sub.fst == c) null substList; in
113+ if found == null then
114+ c
115+ else
116+ found.snd;
115117 in
116118 stringAsChars subst s;
117119