From 76f9b1638cef4f77fea94e77c1440bf85eaf52d3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 8 Aug 2019 13:13:31 +0100 Subject: feat: Add function type It's not currently possible to check arguments for curried functions, but there might be something on the horizon for attribute set functions. --- yants.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'yants.nix') diff --git a/yants.nix b/yants.nix index c5fff0ea7d0f..e7b758f4b955 100644 --- a/yants.nix +++ b/yants.nix @@ -78,8 +78,9 @@ in (typeSet [ (typedef "bool" isBool) (typedef "float" isFloat) (typedef "string" isString) - (typedef "derivation" (ofType "derivation")) - + (typedef "derivation" (x: isAttrs x && x ? "type" && x.type == "derivation")) + (typedef "function" (x: isFunction x || (isAttrs x && x ? "__functor" + && isFunction x.__functor))) # Polymorphic types (poly "option" (t: v: (isNull v) || t.check v)) -- cgit 1.4.1