module Top.Solver.TypeGraph where
import Top.Solver
import Top.Constraint
import Top.Constraint.Information
import Top.Implementation.General
import Top.Implementation.Basic
import Top.Implementation.Overloading
import Top.Implementation.TypeInference
import Top.Implementation.TypeGraphSubstitution
import Top.Implementation.TypeGraph.Heuristic
import Top.Monad.Select
type TG info = BasicMonad (TGS info)
type TGS info = And ( Fix (BasicState info) )
( And ( Simple (TIState info) )
( And ( Simple (TypeGraphState info) )
( Simple (OverloadingState info) )
)
)
solveTypeGraph :: (Solvable constraint (TG info), TypeConstraintInfo info)
=> TG info () -> SolveOptions -> [constraint] -> TG info (SolveResult info)
solveTypeGraph m options cs =
do initialize cs options >> m
onlySolveConstraints cs
solveResult
typegraphConstraintSolver :: (TypeConstraintInfo info, Solvable constraint (TG info))
=> PathHeuristics info -> ConstraintSolver constraint info
typegraphConstraintSolver hs =
let setHeuristics = deselect (modify (\tgs -> tgs { heuristics = hs }))
in makeConstraintSolver (solveTypeGraph setHeuristics)
typegraphConstraintSolverDefault :: (TypeConstraintInfo info, Solvable constraint (TG info))
=> ConstraintSolver constraint info
typegraphConstraintSolverDefault =
makeConstraintSolver (solveTypeGraph (return ()))