Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Solve v loc a = Solve {
- unSolve :: Env -> SolveState v loc -> (a, SolveState v loc)
- data Env = Env {}
- data SolveState v loc = SolveState {
- unifVars :: !(Set Symbol)
- newUnifVars :: [UVar v loc]
- constraints :: !(UFMap (UVar v loc) (Descriptor v loc))
- typeMap :: !(Map (Type v loc) (NonEmpty (UVar v loc)))
- data Descriptor v loc = Descriptor {
- descriptorConstraint :: Maybe (Constraint (UVar v loc) v loc)
- type ConstraintMap v loc = UFMap (UVar v loc) (Descriptor v loc)
- run :: Env -> SolveState v loc -> Solve v loc a -> (a, SolveState v loc)
- emptyState :: SolveState v loc
- find :: Var v => UVar v loc -> Solve v loc (Maybe (Constraint (UVar v loc) v loc))
- genStateL :: Lens' (SolveState v loc) (GenState v loc)
- runGen :: Var v => Gen v loc a -> Solve v loc a
- addUnconstrainedVar :: Var v => UVar v loc -> Solve v loc ()
Documentation
newtype Solve v loc a Source #
Solve | |
|
Instances
MonadReader Env (Solve v loc) Source # | |
MonadFix (Solve v loc) Source # | |
Defined in Unison.KindInference.Solve.Monad | |
Applicative (Solve v loc) Source # | |
Defined in Unison.KindInference.Solve.Monad | |
Functor (Solve v loc) Source # | |
Monad (Solve v loc) Source # | |
MonadState (SolveState v loc) (Solve v loc) Source # | |
Defined in Unison.KindInference.Solve.Monad get :: Solve v loc (SolveState v loc) # put :: SolveState v loc -> Solve v loc () # state :: (SolveState v loc -> (a, SolveState v loc)) -> Solve v loc a # |
data SolveState v loc Source #
The SolveState
holds all kind constraints gathered for each
type. For example, after processing data and effect decls the
typeMap
will hold entries for every decl, and looking up the
corresponding UVar
in constraints
will return its kind.
The other fields, unifVars
and newUnifVars
, are relevant when
interleaving constraint generation with solving. Constraint
generation needs to create fresh unification variables, so it needs
the set of bound unification variables from
unifVars
. newUnifVars
holds the uvars that are candidates for
kind defaulting (see
defaultUnconstrainedVars
).
SolveState | |
|
Instances
MonadState (SolveState v loc) (Solve v loc) Source # | |
Defined in Unison.KindInference.Solve.Monad get :: Solve v loc (SolveState v loc) # put :: SolveState v loc -> Solve v loc () # state :: (SolveState v loc -> (a, SolveState v loc)) -> Solve v loc a # |
data Descriptor v loc Source #
Constraints associated with a unification variable
Descriptor | |
|
type ConstraintMap v loc = UFMap (UVar v loc) (Descriptor v loc) Source #
run :: Env -> SolveState v loc -> Solve v loc a -> (a, SolveState v loc) Source #
Runner for the Solve
monad
emptyState :: SolveState v loc Source #
Initial solve state
find :: Var v => UVar v loc -> Solve v loc (Maybe (Constraint (UVar v loc) v loc)) Source #
Lookup the constraints associated with a unification variable
genStateL :: Lens' (SolveState v loc) (GenState v loc) Source #
Helper for inteleaving constraint generation and solving