Skip to content

Guide

This section walks you through the Typist type system from first principles to advanced features. Each page is self-contained but builds on concepts introduced earlier. If you are new to Typist, follow the reading order below.

Reading Order

# Page Description
1 Type Annotations The :sig() attribute -- the single syntax for all type annotations
2 Type Hierarchy Primitive types, compound types, unions, records, literals, and their subtype relations
3 typedef and newtype Structural aliases versus nominal wrappers -- when and how to use each
4 Structs Nominal, immutable, blessed record types with optional fields and generics
5 ADTs and Pattern Matching Tagged unions with datatype and exhaustive match
6 Generics Parametric polymorphism with bounded quantification and type inference
7 Type Classes Ad-hoc polymorphism with instance dispatch and superclass hierarchies
8 Algebraic Effects Tracked side effects with scoped handlers and the effect row system
9 Effect Protocols State machine verification for effect operations
10 Gradual Typing Incremental adoption -- annotate at your own pace
11 Static vs Runtime The two enforcement modes and what each checks

Prerequisites

You should have Typist installed and working. If not, see Getting Started first.

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 during compile-time analysis and cross-file tooling.