allow ignoring additional arguments

This commit is contained in:
Charlotte 🦝 Delenk 2022-09-12 15:13:19 +01:00
parent e97af52bd4
commit bc74bc8af5
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
3 changed files with 8 additions and 2 deletions

View file

@ -15,4 +15,4 @@
nativeBuildInputs = [pkgs.dhall-nix];
};
in
import "${drv}" (import ./runtime.nix)
import "${drv}" (import ./runtime.nix pkgs.lib)

View file

@ -5,6 +5,7 @@ let Set = ./Set/Type.dhall
in { equal : Any → Any → Bool
, fix : ∀(t : Type) → (t → t) → t
, `fix'` : (Set → Set) → Set
, ignoreOtherArgs : ∀(A: Type) → ∀(B: Type) → (A → B) → A → B
, mergeAttrs : Set → Set → Set
, toAny : ∀(t : Type) → ∀(v : t) → Any
, toTypeUnchecked : ∀(t : Type) → ∀(v : Any) → t

View file

@ -1,8 +1,13 @@
{
lib: {
primops = {
equal = a: b: a == b;
fix = _: f: let x = f x; in x;
fix' = f: let x = f x // { __unfix__ = f; }; in x;
ignoreOtherArgs = _: _: f: let
args = lib.trivial.functionArgs f;
filterFunction = k: _: builtins.hasAttrs k set;
filteredFunction = s: f (lib.attrsets.filterAttrs filterFunction s);
in lib.trivial.setFunctionArgs filteredFunction args;
mergeAttrs = a: b: a // b;
toAny = _: v: v;
toTypeUnchecked = _: v: v;