The suffete::prelude module exposes well-known constants. Importing it gives you the common-case Elements and Types without going through the interner.
Each TYPE_* constant is the singleton type wrapping the corresponding Element. Use these when you need a TypeId for a single Element ; it saves the construction call.
Constant
Type
Equivalent
TYPE_NEVER
never
TypeBuilder::new().push(NEVER).build()
TYPE_MIXED
mixed
TypeBuilder::new().push(MIXED).build()
TYPE_NULL
null
...
TYPE_VOID
void
...
TYPE_TRUE
true
...
TYPE_FALSE
false
...
TYPE_BOOL
bool
...
TYPE_INT
int
...
TYPE_FLOAT
float
...
TYPE_STRING
string
...
TYPE_NUMERIC
numeric
...
TYPE_SCALAR
scalar
...
TYPE_ARRAY_KEY
array-key
...
TYPE_NUMERIC_STRING
numeric-string
...
TYPE_NON_EMPTY_STRING
non-empty-string
...
TYPE_OBJECT_ANY
object
...
TYPE_RESOURCE
resource
...
TYPE_OPEN_RESOURCE
open-resource
...
TYPE_CLOSED_RESOURCE
closed-resource
...
TYPE_EMPTY_ARRAY
array{}
...
The TYPE_* constants are computed at boot time and exposed as consts. Comparing t == TYPE_INT is a single u64 compare ; faster than constructing a TypeBuilder and calling build.
use suffete::prelude::*;
// Use the Element constant when constructing a union:
let t = TypeBuilder::new().push(INT).push(STRING).build();
// Use the Type constant when you need a TypeId directly:
let int_only: TypeId = TYPE_INT;
// Use the Type constant in operations:
let result = lattice::refines(some_t, TYPE_MIXED, &world, opts, &mut report);
For non-trivial Elements (named objects, sealed shapes, callable signatures), use the ElementId constructors or the interner directly. The prelude only covers the well-known singletons.
The prelude is the place for frequently-needed constants. New entries should:
Have a clearly-defined PHP-side meaning (so the name is unambiguous).
Be a singleton (one canonical Element / Type per name).
Get used often enough that an analyser shouldn't have to construct it inline.
Refinement variants that can be expressed as flag combinations on the basic kinds (e.g. truthy-string) are typically not in the prelude ; they are constructed via the interner with a StringInfo carrying the flags.