Skip to content

Commit 1b26c43

Browse files
committed
Nix.Builtins: replaceStrings: m refactor: refact process
M src/Nix/Builtins.hs
1 parent 7fbb8be commit 1b26c43

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Nix/Builtins.hs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -959,22 +959,23 @@ replaceStrings tfrom tto ts =
959959

960960
finish = makeNixString . LazyText.toStrict . Builder.toLazyText
961961

962-
go orig resultAccum ctx = case lookupPrefix orig of
962+
go source resultAccum ctx = case lookupPrefix source of
963963
Nothing ->
964-
process resultAccum orig ctx
964+
process source resultAccum ctx
965965
Just (prefix, replacementNS, rest) ->
966966
( if prefix == mempty
967967
then
968-
process newResultAccum rest
968+
process rest newResultAccum
969969
else
970970
go rest newResultAccum
971-
) (ctx <> newCtx)
971+
) newCtx
972972
where
973-
replacement = Builder.fromText $ stringIgnoreContext replacementNS
973+
replacement = Builder.fromText $ stringIgnoreContext replacementNS
974974
newResultAccum = resultAccum <> replacement
975-
newCtx = NixString.getContext replacementNS
975+
additionalCtx = NixString.getContext replacementNS
976+
newCtx = ctx <> additionalCtx
976977
where
977-
process r t =
978+
process t r =
978979
maybe
979980
(finish r)
980981
(\(h, t) -> go t (r <> Builder.singleton h))

0 commit comments

Comments
 (0)