Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
CHR TreeTrie based solver shared internals, for all solvers
Synopsis
- class (CHREmptySubstitution subst, LookupApply subst subst, VarExtractable x, VarLookupKey subst ~ ExtrValVarKey x) => CHRMatchable env x subst
- type family CHRMatchableKey subst :: *
- class CHREmptySubstitution subst
- class IsConstraint c
- type IsCHRBacktrackPrio env bp subst = (IsCHRPrio env bp subst, CHRMatchable env bp subst, PP (CHRPrioEvaluatableVal bp))
- type IsCHRPrio env p subst = (CHRPrioEvaluatable env p subst, Typeable p, PP p)
- type IsCHRGuard env g subst = (CHRCheckable env g subst, VarExtractable g, VarUpdatable g subst, Typeable g, PP g)
- type IsCHRConstraint env c subst = (CHRMatchable env c subst, VarExtractable c, VarUpdatable c subst, Typeable c, TreeTrieKeyable c, IsConstraint c, Ord c, Ord (TrTrKey c), PP c, PP (TrTrKey c))
- data Prio
- class (Ord (CHRPrioEvaluatableVal x), Bounded (CHRPrioEvaluatableVal x)) => CHRPrioEvaluatable env x subst
- type family CHRPrioEvaluatableVal p :: *
- class (CHREmptySubstitution subst, LookupApply subst subst) => CHRCheckable env x subst
- type CHRMatcher subst = StateT (CHRMatcherState subst (VarLookupKey subst)) (Either CHRMatcherFailure)
- data CHRMatcherFailure
- type NmToVarMp = HashMap String IVar
- type IVar = Key
- emptyNmToVarMp :: NmToVarMp
- type family TrTrKey x
- type CHRKey v = Key (TrTrKey v)
- type WorkTime = Int
- initWorkTime :: WorkTime
- data Work' k c
- = Work { }
- | Work_Residue {
- workCnstr :: !c
- | Work_Solve {
- workCnstr :: !c
- | Work_Fail
- type Work c = Work' (WorkKey c) c
- data SolveStep' c r s
- = SolveStep {
- stepChr :: r
- stepSubst :: s
- stepAlt :: Maybe [c]
- stepNewTodo :: [c]
- stepNewDone :: [c]
- | SolveStats { }
- | SolveDbg { }
- = SolveStep {
- type SolveTrace' c r s = [SolveStep' c r s]
- emptySolveTrace :: SolveTrace' c r s
- ppSolveTrace :: (PP r, PP c) => SolveTrace' c r s -> PP_Doc
Documentation
class (CHREmptySubstitution subst, LookupApply subst subst, VarExtractable x, VarLookupKey subst ~ ExtrValVarKey x) => CHRMatchable env x subst Source #
A Matchable participates in the reduction process as a reducable constraint.
Unification may be incorporated as well, allowing matching to be expressed in terms of unification.
This facilitates implementations of CHRBuiltinSolvable
.
Instances
(Ord (ExtrValVarKey ()), CHREmptySubstitution subst, LookupApply subst subst, VarLookupKey subst ~ ExtrValVarKey ()) => CHRMatchable env () subst Source # | |
Defined in CHR.Types.Core chrMatchTo :: env -> subst -> () -> () -> Maybe subst Source # chrUnify :: CHRMatchHow -> CHRMatchEnv (VarLookupKey subst) -> env -> subst -> () -> () -> Maybe subst Source # chrMatchToM :: env -> () -> () -> CHRMatcher subst () Source # chrUnifyM :: CHRMatchHow -> env -> () -> () -> CHRMatcher subst () Source # chrBuiltinSolveM :: env -> () -> CHRMatcher subst () Source # | |
CHRMatchable env x subst => CHRMatchable env (Maybe x) subst Source # | |
Defined in CHR.Types.Core chrMatchTo :: env -> subst -> Maybe x -> Maybe x -> Maybe subst Source # chrUnify :: CHRMatchHow -> CHRMatchEnv (VarLookupKey subst) -> env -> subst -> Maybe x -> Maybe x -> Maybe subst Source # chrMatchToM :: env -> Maybe x -> Maybe x -> CHRMatcher subst () Source # chrUnifyM :: CHRMatchHow -> env -> Maybe x -> Maybe x -> CHRMatcher subst () Source # chrBuiltinSolveM :: env -> Maybe x -> CHRMatcher subst () Source # | |
CHRMatchable env x subst => CHRMatchable env [x] subst Source # | |
Defined in CHR.Types.Core chrMatchTo :: env -> subst -> [x] -> [x] -> Maybe subst Source # chrUnify :: CHRMatchHow -> CHRMatchEnv (VarLookupKey subst) -> env -> subst -> [x] -> [x] -> Maybe subst Source # chrMatchToM :: env -> [x] -> [x] -> CHRMatcher subst () Source # chrUnifyM :: CHRMatchHow -> env -> [x] -> [x] -> CHRMatcher subst () Source # chrBuiltinSolveM :: env -> [x] -> CHRMatcher subst () Source # |
type family CHRMatchableKey subst :: * Source #
The key of a substitution
Instances
type CHRMatchableKey (StackedVarLookup subst) Source # | |
Defined in CHR.Types.Core |
class IsConstraint c Source #
The things a constraints needs to be capable of in order to participate in solving
type IsCHRBacktrackPrio env bp subst = (IsCHRPrio env bp subst, CHRMatchable env bp subst, PP (CHRPrioEvaluatableVal bp)) Source #
Alias API for backtrack priority requirements
type IsCHRPrio env p subst = (CHRPrioEvaluatable env p subst, Typeable p, PP p) Source #
Alias API for priority requirements
type IsCHRGuard env g subst = (CHRCheckable env g subst, VarExtractable g, VarUpdatable g subst, Typeable g, PP g) Source #
Alias API for guard requirements
type IsCHRConstraint env c subst = (CHRMatchable env c subst, VarExtractable c, VarUpdatable c subst, Typeable c, TreeTrieKeyable c, IsConstraint c, Ord c, Ord (TrTrKey c), PP c, PP (TrTrKey c)) Source #
Alias API for constraint requirements
Separate priority type, where minBound represents lowest prio, and compare sorts from high to low prio (i.e. high compare
low == LT)
class (Ord (CHRPrioEvaluatableVal x), Bounded (CHRPrioEvaluatableVal x)) => CHRPrioEvaluatable env x subst Source #
A PrioEvaluatable participates in the reduction process to indicate the rule priority, higher prio takes precedence
type family CHRPrioEvaluatableVal p :: * Source #
The type of value a prio representation evaluates to, must be Ord instance
Instances
type CHRPrioEvaluatableVal () Source # | |
Defined in CHR.Types.Core |
class (CHREmptySubstitution subst, LookupApply subst subst) => CHRCheckable env x subst Source #
A Checkable participates in the reduction process as a guard, to be checked. Checking is allowed to find/return substitutions for meta variables (not for global variables).
type CHRMatcher subst = StateT (CHRMatcherState subst (VarLookupKey subst)) (Either CHRMatcherFailure) Source #
Matching monad, keeping a stacked (pair) of subst (local + global), and a set of global variables upon which the solver has to wait in order to (possibly) match further/again type CHRMatcher subst = StateT (StackedVarLookup subst, CHRWaitForVarSet subst) (Either ())
data CHRMatcherFailure Source #
Failure of CHRMatcher
Instances
type TrTrKey (Maybe x) | |
Defined in CHR.Data.TreeTrie | |
type TrTrKey [x] | |
Defined in CHR.Data.TreeTrie | |
type TrTrKey (Work' k c) Source # | |
type TrTrKey (Rule cnstr guard bprio prio) Source # | |
Defined in CHR.Types.Rule |
All solver constraints are identified individually with a timestamp, also serving as its identification depending on the solver
A chunk of work to do when solving, a constraint + sequence nr
Work | |
Work_Residue | |
| |
Work_Solve | |
| |
Work_Fail |
data SolveStep' c r s Source #
A trace step
SolveStep | |
| |
SolveStats | |
SolveDbg | |
Instances
Show (SolveStep' c r s) Source # | |
Defined in CHR.Types showsPrec :: Int -> SolveStep' c r s -> ShowS # show :: SolveStep' c r s -> String # showList :: [SolveStep' c r s] -> ShowS # | |
(PP r, PP c) => PP (SolveStep' c r s) Source # | |
Defined in CHR.Types pp :: SolveStep' c r s -> PP_Doc # ppList :: [SolveStep' c r s] -> PP_Doc # |
type SolveTrace' c r s = [SolveStep' c r s] Source #
emptySolveTrace :: SolveTrace' c r s Source #
ppSolveTrace :: (PP r, PP c) => SolveTrace' c r s -> PP_Doc Source #