diff options
author | Vincent Ambo <tazjin@google.com> | 2019-08-08T12·05+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-08-28T13·36+0100 |
commit | 103e0b4d2531569903c362e9e592b297248057ca (patch) | |
tree | c6b746a9cc042d2a7a726cd8fb23de600261ded8 /yants.nix | |
parent | cb0d07fa30c40beaef815614fee949f496edc514 (diff) |
feat: Add derivation type
Diffstat (limited to 'yants.nix')
-rw-r--r-- | yants.nix | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/yants.nix b/yants.nix index 03e5114033a6..c5fff0ea7d0f 100644 --- a/yants.nix +++ b/yants.nix @@ -28,6 +28,8 @@ with builtins; let "${n}" = t1: t2: typedef "${n}<${t1.name},${t2.name}>" (c t1 t2); }; + ofType = t: x: isAttrs x && x ? "type" && x.type == t; + typeSet = foldl' (s: t: s // (if t ? "name" then { "${t.name}" = t; } else t)) {}; # Struct checker implementation @@ -76,6 +78,7 @@ in (typeSet [ (typedef "bool" isBool) (typedef "float" isFloat) (typedef "string" isString) + (typedef "derivation" (ofType "derivation")) # Polymorphic types (poly "option" (t: v: (isNull v) || t.check v)) |