futhark
Safe HaskellNone
LanguageGHC2021

Language.Futhark.TypeChecker.UnionFind

Synopsis

Documentation

data TyVarNode s Source #

A node in the union-find graph containing information about a type variable.

Instances

Instances details
Eq (TyVarNode s) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.UnionFind

Methods

(==) :: TyVarNode s -> TyVarNode s -> Bool #

(/=) :: TyVarNode s -> TyVarNode s -> Bool #

data TyVarSol Source #

A (partial) solution for a type variable.

Constructors

Solved Type

Has been assigned this type.

Param Level Liftedness Loc

Is an explicit (rigid) type parameter in the source program.

Unsolved (TyVarInfo ())

Is unsolved but has this constraint.

Instances

Instances details
Show TyVarSol Source # 
Instance details

Defined in Language.Futhark.TypeChecker.UnionFind

Eq TyVarSol Source # 
Instance details

Defined in Language.Futhark.TypeChecker.UnionFind

makeTyVarNode :: TyVar -> TyVarInfo () -> ST s (TyVarNode s) Source #

Create a fresh node of a type variable and return it. A fresh node is in the equivalence class that contains only itself.

makeTyParamNode :: TyVar -> Level -> Liftedness -> Loc -> ST s (TyVarNode s) Source #

Create a fresh node of a type parameter and return it. A fresh node is in the equivalence class that contains only itself.

find :: TyVarNode s -> ST s (TyVarNode s, ReprInfo) Source #

find node returns the representative of node's equivalence class and the information associated with this equivalence class.

This method performs the path compression.

getSol :: TyVarNode s -> ST s TyVarSol Source #

Return the solution associated with the argument node's equivalence class.

getKey :: TyVarNode s -> ST s TyVar Source #

Return the name of the representative type variable.

assignNewSol :: TyVarNode s -> TyVarSol -> ST s () Source #

Assign a new solution/type to the node's equivalence class.

Precondition: The node is in an equivalence class representing an unsolved/flexible type variable.

union :: TyVarNode s -> TyVarNode s -> ST s () Source #

Join the equivalence classes of the nodes. The resulting equivalence class has the same solution and key as the second argument.

unionNewSol :: TyVarNode s -> TyVarNode s -> TyVarSol -> ST s () Source #

Join the equivalence classes of the nodes. The resulting equivalence class has the same key as the second argument while new_sol is the new solution.