| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Language.Futhark.TypeChecker.UnionFind
Synopsis
- data TyVarNode s
- data TyVarSol
- makeTyVarNode :: TyVar -> TyVarInfo () -> ST s (TyVarNode s)
- makeTyParamNode :: TyVar -> Level -> Liftedness -> Loc -> ST s (TyVarNode s)
- find :: TyVarNode s -> ST s (TyVarNode s, ReprInfo)
- getSol :: TyVarNode s -> ST s TyVarSol
- getKey :: TyVarNode s -> ST s TyVar
- assignNewSol :: TyVarNode s -> TyVarSol -> ST s ()
- union :: TyVarNode s -> TyVarNode s -> ST s ()
- unionNewSol :: TyVarNode s -> TyVarNode s -> TyVarSol -> ST s ()
Documentation
A node in the union-find graph containing information about a type variable.
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. |
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.
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.