Skip to content

Advanced

This section covers advanced type system features that build on the concepts introduced in the Guide. These topics are not required for everyday use of Typist, but they unlock the full power of the type system for library authors, framework designers, and anyone working with complex type-level abstractions.

Topics

Page Description
Rank-2 Polymorphism Universal quantification over function arguments -- when the callee, not the caller, chooses the type
Higher-Kinded Types Kinds, type constructors, and abstracting over parameterized types like ArrayRef
Type Narrowing Control-flow-sensitive type refinement via defined, isa, ref, truthiness, and early return
Subtyping Rules The complete subtype relation -- every rule, explained
Recursive Types Self-referential type aliases through type constructors

Prerequisites

You should be comfortable with:

All code examples assume:

use v5.40;
use Typist;

Type definitions (typedef, newtype, struct, datatype, effect, typeclass, instance) must appear inside BEGIN blocks so they are visible to opt-in CHECK-phase static analysis and other compile-time consumers.