From 103e0b4d2531569903c362e9e592b297248057ca Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 8 Aug 2019 13:05:29 +0100 Subject: feat: Add derivation type --- yants.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'yants.nix') 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)) -- cgit 1.4.1