diff options
author | Shea Levy <shea@shealevy.com> | 2017-09-29 09:11:26 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2017-09-29 09:11:26 -0400 |
commit | 1a1ad1a17dfbe1b4da3a0bb174c6830ac318a3a7 (patch) | |
tree | 32f1f408d7008e64e7a936f0c80859f0daa15dcd /lib/fixed-points.nix | |
parent | 8f33315f8f50fa5a01d082fb1cce57f1ac2c20d1 (diff) |
Revert "Merge branch 'improved-make-overridable' of git://github.com/ElvishJerricco/nixpkgs"
This reverts commit c3af1210b4c5d7ef380e75add463b37574fdcc8b, reversing
changes made to 49f175cd0c80a39e1d05fc687c4a2a40e0aba58c.
Diffstat (limited to 'lib/fixed-points.nix')
-rw-r--r-- | lib/fixed-points.nix | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/lib/fixed-points.nix b/lib/fixed-points.nix index 2526360c111d..13e053b5aa7d 100644 --- a/lib/fixed-points.nix +++ b/lib/fixed-points.nix @@ -72,34 +72,8 @@ rec { # Same as `makeExtensible` but the name of the extending attribute is # customized. - makeExtensibleWithCustomName = extenderName: f: makeExtensibleWithInterface - (fixedPoint: extend: fixedPoint // { ${extenderName} = ext: extend (_: ext); }) - (_: f); - - # A version of `makeExtensible` that allows the function being fixed - # to return a different interface than the interface returned to the - # user. Along with `self` and `super` views of the internal - # interface, a `self` view of the output interface is also - # provided. `extend` is not added to the output by default. This is - # the job of the interface. - # - # nix-repl> foo = {a, b}: {c = a + b;} - # - # nix-repl> interface = {args, val, ...}: extend: val // {inherit extend;} - # - # nix-repl> obj = makeExtensibleWithInterface interface (output: self: { args = {a = 1; b = 2;}; val = foo self.args; }) - # - # nix-repl> obj.c - # 3 - # - # nix-repl> obj = obj.extend (output: self: super: { args = super.args // { b = output.d; }; }) - # - # nix-repl> obj = obj.extend (output: self: super: { val = super.val // { d = 10; }; }) - # - # nix-repl> { inherit (obj) c d; } - # { c = 11; d = 10; } - makeExtensibleWithInterface = interface: f: let i = interface - (fix' (f i)) - (fext: makeExtensibleWithInterface interface (i': (extends (fext i') (f i')))); - in i; + makeExtensibleWithCustomName = extenderName: rattrs: + fix' rattrs // { + ${extenderName} = f: makeExtensibleWithCustomName extenderName (extends f rattrs); + }; } |