for now prefer openTrapdoor
until I know for sure the structures won't change, then we can optimise
This commit is contained in:
parent
7247a8e9af
commit
886f7181ac
1 changed files with 5 additions and 5 deletions
|
|
@ -11,33 +11,33 @@
|
|||
(this)
|
||||
enfIsNT
|
||||
ntTrapdoorKey
|
||||
openTrapdoorFn
|
||||
openTrapdoor
|
||||
toTypeSig
|
||||
;
|
||||
in rec {
|
||||
# check if a value is an nt type/class
|
||||
isNT = T: let
|
||||
content = openTrapdoorFn ntTrapdoorKey T;
|
||||
content = openTrapdoor ntTrapdoorKey T;
|
||||
names = attrNames content;
|
||||
in
|
||||
isAttrs content
|
||||
&& all (name: elem name names) ["sig" "derive" "ops" "req"];
|
||||
|
||||
isNixClass = T: let
|
||||
content = openTrapdoorFn ntTrapdoorKey T;
|
||||
content = openTrapdoor ntTrapdoorKey T;
|
||||
in
|
||||
isAttrs content
|
||||
&& attrNames content == ["sig" "derive" "ops" "req"];
|
||||
|
||||
isNixType = T: let
|
||||
content = openTrapdoorFn ntTrapdoorKey T;
|
||||
content = openTrapdoor ntTrapdoorKey T;
|
||||
in
|
||||
isAttrs content
|
||||
&& attrNames content == ["instance" "sig" "derive" "ops" "req"]
|
||||
&& content.instance == false;
|
||||
|
||||
isNixTypeInstance = T: let
|
||||
content = openTrapdoorFn ntTrapdoorKey T;
|
||||
content = openTrapdoor ntTrapdoorKey T;
|
||||
in
|
||||
isAttrs content
|
||||
&& attrNames content == ["instance" "sig" "derive" "ops" "req"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue