diff --git a/nt/primitives/nt.nix b/nt/primitives/nt.nix index 3fdefaa..de48737 100644 --- a/nt/primitives/nt.nix +++ b/nt/primitives/nt.nix @@ -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; diff --git a/nt/primitives/util/enforce.nix b/nt/primitives/util/enforce.nix index 10c780a..b18e417 100644 --- a/nt/primitives/util/enforce.nix +++ b/nt/primitives/util/enforce.nix @@ -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: diff --git a/nt/primitives/util/parse.nix b/nt/primitives/util/parse.nix index e43e2b8..c8dfd07 100644 --- a/nt/primitives/util/parse.nix +++ b/nt/primitives/util/parse.nix @@ -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 diff --git a/nt/primitives/util/trapdoor.nix b/nt/primitives/util/trapdoor.nix index 64c1d75..5cda0dc 100644 --- a/nt/primitives/util/trapdoor.nix +++ b/nt/primitives/util/trapdoor.nix @@ -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; }