mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 13:57:10 +03:00
Merge branch 'composeExtensions'
This commit is contained in:
commit
52f998a2ce
@ -80,6 +80,15 @@ rec {
|
|||||||
# argument, but it's nice this way if several uses of `extends` are cascaded.
|
# argument, but it's nice this way if several uses of `extends` are cascaded.
|
||||||
extends = f: rattrs: self: let super = rattrs self; in super // f self super;
|
extends = f: rattrs: self: let super = rattrs self; in super // f self super;
|
||||||
|
|
||||||
|
# Compose two extending functions of the type expected by 'extends'
|
||||||
|
# into one where changes made in the first are available in the
|
||||||
|
# 'super' of the second
|
||||||
|
composeExtensions =
|
||||||
|
f: g: self: super:
|
||||||
|
let fApplied = f self super;
|
||||||
|
super' = super // fApplied;
|
||||||
|
in fApplied // g self super';
|
||||||
|
|
||||||
# Create an overridable, recursive attribute set. For example:
|
# Create an overridable, recursive attribute set. For example:
|
||||||
#
|
#
|
||||||
# nix-repl> obj = makeExtensible (self: { })
|
# nix-repl> obj = makeExtensible (self: { })
|
||||||
|
Loading…
Reference in New Issue
Block a user