Skip to content

Commit 2e081f4

Browse files
committed
Nix.Builtins: replaceStrings: m refactor: form newResultAccum
M src/Nix/Builtins.hs
1 parent 1afdec3 commit 2e081f4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Nix/Builtins.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -970,16 +970,15 @@ replaceStrings tfrom tto ts =
970970
(if prefix == mempty
971971
then
972972
maybe
973-
(finish (resultAccum <> Builder.fromText replacement))
974-
(\(h,t) -> go t (mconcat [ resultAccum
975-
, Builder.fromText replacement
976-
, Builder.singleton h ]))
973+
(finish newResultAccum)
974+
(\(h,t) -> go t (newResultAccum <> Builder.singleton h))
977975
(Text.uncons rest)
978976
else
979-
go rest (resultAccum <> Builder.fromText replacement))
977+
go rest newResultAccum)
980978
(ctx <> newCtx)
981979
where
982-
replacement = stringIgnoreContext replacementNS
980+
replacement = Builder.fromText $ stringIgnoreContext replacementNS
981+
newResultAccum = resultAccum <> replacement
983982
newCtx = NixString.getContext replacementNS
984983
toValue
985984
$ go (stringIgnoreContext ns) mempty

0 commit comments

Comments
 (0)