futhark
Safe HaskellNone
LanguageGHC2021

Language.Futhark.TypeChecker.Terms.Unsized

Description

Unsized type checking.

This checker generates type constraints (type CtTy) which are then solved to find a solution. The result is a decorated AST where most of the type annotations are just references to type variables. Further, all the size-specific annotations (e.g. existential sizes) just contain dummy values, such as empty lists.

If Futhark had no fancy type system features, then this pass would essentially be all you needed.

Synopsis

Documentation

checkSingleExp :: ExpBase (NoInfo :: Type -> Type) VName -> TypeM (Either TypeError ([TypeParam], Map TyVar (TypeBase () NoMode)), Exp) Source #

Type check a single expression, which may have a polymorphic type.

checkSizeExp :: ExpBase (NoInfo :: Type -> Type) VName -> TypeM (Either TypeError ([UnconTyVar], Map TyVar (TypeBase () NoMode)), Exp) Source #

Type-check a single size expression in isolation, which must have type i64.

type Solution = Map TyVar (Either [PrimType] (TypeBase () NoMode)) Source #

A solution maps a type variable to its substitution. This substitution is complete, in the sense there are no right-hand sides that contain a type variable.