Skip to main content

Crate rexlang_typesystem

Crate rexlang_typesystem 

Source
Expand description

Hindley-Milner type system with parametric polymorphism, type classes, and ADTs. The goal is to provide a reusable library for building typing environments for Rex. Features:

  • Type variables, type constructors, function and tuple types.
  • Schemes with quantified variables and class constraints.
  • Type classes with superclass relationships and instance resolution.
  • Basic ADTs (List, Result, Option) and numeric/string primitives in the prelude.
  • Utilities to register additional function/type declarations (e.g. (-), (/)).

Structs§

AdtConflict
AdtDecl
A type declaration for an algebraic data type.
AdtParam
A named type parameter for an ADT (e.g. a in List a).
AdtVariant
A single ADT variant with zero or more constructor arguments.
Class
ClassEnv
ClassInfo
Semantic information about a type class declaration, derived from Rex source.
ClassMethodInfo
CollectAdtsError
Instance
Predicate
PreparedInstanceDecl
Scheme
Type
TypeConst
TypeEnv
TypeSystem
TypeSystemLimits
TypeVar
TypeVarSupply
TypedExpr

Enums§

BuiltinTypeId
TypeError
TypeKind
TypedExprKind

Traits§

Types

Functions§

collect_adts_in_types
Collect all user-defined ADT constructors referenced by the provided types.
compose_subst
Compose substitutions a after b.
entails
generalize
Turn a monotype typ (plus constraints preds) into a polymorphic Scheme by quantifying over the type variables not free in env.
instantiate
prelude_typeclasses_program
unify
Compute a most-general unifier for two types.

Type Aliases§

Subst
TypeVarId