lib: remove upstreamed function repeat
(replicate
)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
rec {
|
||||
attrsets = import ./attrsets.nix { inherit stdlib; };
|
||||
lists = import ./lists.nix { inherit stdlib; };
|
||||
strings = import ./strings.nix { inherit stdlib lists; };
|
||||
strings = import ./strings.nix { inherit stdlib; };
|
||||
termColors = import ./termColors.nix { inherit stdlib strings; };
|
||||
trivial = import ./trivial.nix { inherit stdlib; };
|
||||
}
|
||||
|
@@ -3,9 +3,6 @@ let
|
||||
inherit (stdlib.trivial) const;
|
||||
inherit (stdlib.lists) range any all;
|
||||
in {
|
||||
# a -> Int -> [a]
|
||||
repeat = item: times: map (const item) (range 1 times);
|
||||
|
||||
# [Bool] -> Bool
|
||||
any' = any (boolean: boolean);
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
{ stdlib, lists }:
|
||||
{ stdlib }:
|
||||
let
|
||||
inherit (stdlib.lists) length;
|
||||
inherit (lists) repeat;
|
||||
inherit (stdlib.lists) length replicate;
|
||||
inherit (stdlib.strings) concatStringsSep replaceStrings splitString;
|
||||
in rec {
|
||||
# String -> [String]
|
||||
@@ -15,13 +14,13 @@ in rec {
|
||||
mapLines = splitMap "\n";
|
||||
|
||||
# String -> Int -> String
|
||||
repeatString = string: times: concatStringsSep "" (repeat string times);
|
||||
repeatString = string: times: concatStringsSep "" (replicate times string);
|
||||
|
||||
# Replaces any occurences in a list of strings with a single replacement.
|
||||
# NOTE: This function does not support regex patterns.
|
||||
#
|
||||
# [String] -> String -> String -> String
|
||||
replaceStrings' = from: to: replaceStrings from (repeat to (length from));
|
||||
replaceStrings' = from: to: replaceStrings from (replicate (length from) to);
|
||||
|
||||
# [String] -> String
|
||||
unlines = concatStringsSep "\n";
|
||||
|
Reference in New Issue
Block a user