Skip to content

Reference

Lookup material for the Hem language and toolchain.

Updated View as Markdown

These reference pages document Hem language rules, syntax, and tooling. They are organized for quick lookup rather than step-by-step learning. If you are new to Hem, start with the tour.

Language

Expressions and control flow covers expression-based if, match, try, and catch, block return values, guarded bindings, loops, and cases where expressions are not permitted as values.

Data transformation covers immutable variable bindings, variable shadowing, destructuring, arrow functions, and first-argument pipe operators that compile to standard function calls.

Safety by construction details compiler checks that prevent truthiness checks, type coercion in equality, mixed-type + operations, unchecked array indexing, implicit mutation, unused Option/Result values, and untyped any leaks.

Absence (?T) covers the unboxed representation of optional values (undefined/null): how ?T is created, how it is handled and unpacked, and where the underlying JavaScript representation appears.

Variants, brands, and errors covers custom variant types, nominal brand types, tagged errors, their emitted TypeScript types, and structural equality generation via deriving Eq.

Pattern matching covers pattern syntax, as variable bindings, exhaustiveness checking for closed types, record pattern matching, and multi-value tuple matches.

Errors and failures covers error declarations, raise, postfix catch, try blocks, error propagation, which failures appear in types, and how error handling maps to Effect error channels.

Concurrency and resources covers concurrent and groups across values, Promises, carriers, and Effects, as well as use, resource, defer, resource ownership, task cancellation, and cleanup order.

JSX covers conditional rendering, pattern matching within JSX expressions, prop shorthand syntax, optional props, explicit boolean attributes, and compilation to standard TSX.

Standard Option and Result covers @hem-lang/std imports, boxed Option and Result types, helper methods, Some / Ok carrier bindings, must-use validation, async handling, Effect integration, and JavaScript interop.

TypeScript interop covers TypeScript type checker integration, imported types, type narrowing, type predicates, assertion functions, tagged templates, directives, class declarations, JSX, and generated sibling files.

Removed constructs lists unsupported JavaScript and TypeScript features, their typed alternatives in Hem, operator restrictions, and must-use enforcement.

Effect boundaries covers the optional Effect extension, including capability verification and compiler checks for bindings, execution boundaries, channel types, and scoped resources.

Toolchain

The hem CLI documents CLI commands, options, file resolution rules, and output files.

Configuration covers tsconfig.json settings, compiler type-checking options, Vite plugin configuration, and generated file manifests.

Diagnostics lists all compiler diagnostic codes and explanations. This list is generated directly from the compiler registry.

Normative sources

The language specification and grammar define official language behavior:

Reference pages cite relevant specification sections. If a reference page conflicts with the specification, the specification takes precedence.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close