feat: Add derivation type
This commit is contained in:
parent
cb0d07fa30
commit
103e0b4d25
1 changed files with 3 additions and 0 deletions
|
@ -28,6 +28,8 @@ with builtins; let
|
||||||
"${n}" = t1: t2: typedef "${n}<${t1.name},${t2.name}>" (c t1 t2);
|
"${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)) {};
|
typeSet = foldl' (s: t: s // (if t ? "name" then { "${t.name}" = t; } else t)) {};
|
||||||
|
|
||||||
# Struct checker implementation
|
# Struct checker implementation
|
||||||
|
@ -76,6 +78,7 @@ in (typeSet [
|
||||||
(typedef "bool" isBool)
|
(typedef "bool" isBool)
|
||||||
(typedef "float" isFloat)
|
(typedef "float" isFloat)
|
||||||
(typedef "string" isString)
|
(typedef "string" isString)
|
||||||
|
(typedef "derivation" (ofType "derivation"))
|
||||||
|
|
||||||
# Polymorphic types
|
# Polymorphic types
|
||||||
(poly "option" (t: v: (isNull v) || t.check v))
|
(poly "option" (t: v: (isNull v) || t.check v))
|
||||||
|
|
Loading…
Reference in a new issue