rename enfType -> enfIsType

This commit is contained in:
Emile Clark-Boman 2026-01-25 00:12:55 +10:00
parent bf82113bf2
commit d20a15c01c
4 changed files with 11 additions and 11 deletions

View file

@ -9,7 +9,7 @@
inherit
(this.util)
enfType
enfIsType
enfIsClassSig
flipCurry
hasAttrAt
@ -38,7 +38,7 @@
else builder;
parseDecl = base: decl:
assert enfType "set" decl "parseDecl";
assert enfIsType "set" decl "parseDecl";
# ^^^^ "Type declaration must be provided as an attribute set, got "${typeOf decl}" instead!"
decl |> projectOnto base;

View file

@ -12,7 +12,7 @@
isTypeSig
;
in rec {
enfType = type: value: msg: let
enfIsType = type: value: msg: let
got = typeOf value;
in
got == type || throw "${msg}: expected primitive nix type \"${type}\" but got \"${got}\"";
@ -23,12 +23,12 @@ in rec {
# NOTE: use enfHasAttr' if you can guarantee xs is type set
enfHasAttr = name: xs: msg:
enfType "set" xs msg && enfHasAttr' name xs msg;
enfIsType "set" xs msg && enfHasAttr' name xs msg;
enfIsClassSig = sig: msg:
isClassSig sig || throw "${msg}: given value \"${toString sig}\" of primitive nix type \"${typeOf sig}\" is not a valid Typeclass signature";
enfTypeSig = sig: msg:
enfIsTypeSig = sig: msg:
isTypeSig sig || throw "${msg}: given value \"${toString sig}\" of primitive nix type \"${typeOf sig}\" is not a valid Type signature";
enfIsNT = T: msg:

View file

@ -8,7 +8,7 @@
inherit
(this)
enfType
enfIsType
is
Wrap
;
@ -17,7 +17,7 @@ in rec {
# given path as a list of strings, return that value of an
# attribute set at that path
getAttrAt = path: xs:
assert enfType "set" xs "getAttrAt";
assert enfIsType "set" xs "getAttrAt";
foldl' (left: right:
if left != null && isAttrs left.value && hasAttr right left.value
then Wrap left.value.${right}
@ -29,7 +29,7 @@ in rec {
# given path as a list of strings, return that value of an
# attribute set at that path
hasAttrAt = path: xs:
assert enfType "set" xs "hasAttrAt";
assert enfIsType "set" xs "hasAttrAt";
getAttrAt path xs != null; # NOTE: inefficient (im lazy)
# Alternative to mapAttrsRecursiveCond

View file

@ -10,7 +10,7 @@
(this)
enfHasAttr
enfHasAttr'
enfType
enfIsType
;
masterkey = "_''traps''_";
@ -50,11 +50,11 @@ in rec {
openTrapdoorSet = key: xs: xs.${key};
# TODO: implement a function called enfTypeAny (for cases like this where it might be function or set)
# TODO: implement a function called enfIsTypeAny (for cases like this where it might be function or set)
openTrapdoor = key: T:
if isFunction T
then openTrapdoorFn key T
else
assert enfType "set" T "openTrapdoor";
assert enfIsType "set" T "openTrapdoor";
openTrapdoorSet key T;
}