mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 04:12:44 +03:00
Remove backward-compatible implementations of some primops
Nixpkgs requires at least Nix 1.2 anyway, so these are now useless.
This commit is contained in:
parent
785eaf2cea
commit
a8b693fef7
@ -20,7 +20,7 @@ rec {
|
||||
let attr = head attrPath;
|
||||
in
|
||||
if attrPath == [] then e
|
||||
else if builtins ? hasAttr && hasAttr attr e
|
||||
else if hasAttr attr e
|
||||
then attrByPath (tail attrPath) default (getAttr attr e)
|
||||
else default;
|
||||
|
||||
@ -110,7 +110,7 @@ rec {
|
||||
collect = pred: attrs:
|
||||
if pred attrs then
|
||||
[ attrs ]
|
||||
else if builtins.isAttrs attrs then
|
||||
else if isAttrs attrs then
|
||||
concatMap (collect pred) (attrValues attrs)
|
||||
else
|
||||
[];
|
||||
|
@ -10,7 +10,7 @@ let
|
||||
|
||||
in rec {
|
||||
|
||||
inherit (builtins) head tail length isList elemAt;
|
||||
inherit (builtins) head tail length isList elemAt concatLists filter elem;
|
||||
|
||||
|
||||
# Create a list consisting of a single element. `singleton x' is
|
||||
@ -58,10 +58,6 @@ in rec {
|
||||
in imap' 0;
|
||||
|
||||
|
||||
# Concatenate a list of lists.
|
||||
concatLists = builtins.concatLists or (fold (x: y: x ++ y) []);
|
||||
|
||||
|
||||
# Map and concatenate the result.
|
||||
concatMap = f: list: concatLists (map f list);
|
||||
|
||||
@ -75,24 +71,10 @@ in rec {
|
||||
else [x];
|
||||
|
||||
|
||||
# Filter a list using a predicate; that is, return a list containing
|
||||
# every element from `list' for which `pred' returns true.
|
||||
filter =
|
||||
builtins.filter or
|
||||
(pred: list:
|
||||
fold (x: y: if pred x then [x] ++ y else y) [] list);
|
||||
|
||||
|
||||
# Remove elements equal to 'e' from a list. Useful for buildInputs.
|
||||
remove = e: filter (x: x != e);
|
||||
|
||||
|
||||
# Return true if `list' has an element `x'.
|
||||
elem =
|
||||
builtins.elem or
|
||||
(x: list: fold (a: bs: x == a || bs) false list);
|
||||
|
||||
|
||||
# Find the sole element in the list matching the specified
|
||||
# predicate, returns `default' if no such element exists, or
|
||||
# `multiple' if there are multiple matching elements.
|
||||
|
Loading…
Reference in New Issue
Block a user