Skip to content

Commit bb1f9b0

Browse files
committed
Nix.Builtins: replaceStrings: add doc
1 parent f5fc8db commit bb1f9b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Nix/Builtins.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,15 @@ genericClosure = fromValue @(AttrSet (NValue t f m)) >=> \s ->
923923
WValue j : _ -> checkComparable k' j
924924
fmap (t :) <$> go op (ts <> ys) (S.insert (WValue k') ks)
925925

926+
-- | Takes:
927+
-- 1. List of expressions to replace.
928+
-- (finds the occurances of them)
929+
-- 2. List of expressions to replace corresponding occurance. (arg 1 & 2 lists matched by index)
930+
-- 3. Expression to process
931+
-- -> returns the expression with requested replacements.
932+
--
933+
-- Example:
934+
-- builtins.replaceStrings ["ll" "e"] [" " "i"] "Hello world" == "Hi o world".
926935
replaceStrings
927936
:: MonadNix e t f m
928937
=> NValue t f m

0 commit comments

Comments
 (0)