about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/yants/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/nix/yants/default.nix b/nix/yants/default.nix
index 3e9a4c00a29a..058444d27be9 100644
--- a/nix/yants/default.nix
+++ b/nix/yants/default.nix
@@ -76,9 +76,13 @@ with builtins; let
   # error message constructor.
   typedef = name: check: typedef' {
     inherit name;
-    checkType = check;
-    checkToBool = r: r;
-    toError = value: _result: typeError name value;
+    checkType = v:
+      let res = check v;
+      in {
+        ok = res;
+      } // (lib.optionalAttrs (!res) {
+        err = typeError name v;
+      });
   };
 
   checkEach = name: t: l: foldl' (acc: e: