chr-core 0.1.0.0 → 0.1.0.1
raw patch · 3 files changed
+7/−6 lines, 3 files
Files
- chr-core.cabal +2/−2
- src/CHR/Solve/MonoBacktrackPrio.hs +3/−2
- src/CHR/Types/Core.hs +2/−2
chr-core.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: chr-core-version: 0.1.0.0+version: 0.1.0.1 synopsis: Constraint Handling Rules description: Constraint Handling Rules evaluation engine license: BSD3@@ -40,7 +40,7 @@ FlexibleInstances, RankNTypes build-depends: - base >=4.9 && < 5,+ base >=4.8 && < 5, -- array >= 0.3, hashable >= 1.2.4, unordered-containers >= 0.2.7,
src/CHR/Solve/MonoBacktrackPrio.hs view
@@ -1109,7 +1109,8 @@ -- | Match the stored CHR with a set of possible constraints, giving a substitution on success slvMatch- :: ( MonoBacktrackPrio c g bp p s env m+ :: forall c g bp p s env m+ . ( MonoBacktrackPrio c g bp p s env m -- these below should not be necessary as they are implied (via superclasses) by MonoBacktrackPrio, but deeper nested superclasses seem not to be picked up... , CHRMatchable env c s , CHRCheckable env g s@@ -1125,7 +1126,7 @@ -> CHRMonoBacktrackPrioT c g bp p s env m (Maybe (FoundSlvMatch c g bp p s)) slvMatch env chr@(StoredCHR {_storedChrRule = Rule {rulePrio = mbpr, ruleHead = hc, ruleGuard = gd, ruleBacktrackPrio = mbbpr, ruleBodyAlts = alts}}) cnstrs headInx = do subst <- getl $ bst ^* chrbstSolveSubst- curbprio <- fmap chrPrioLift $ getl $ bst ^* chrbstBacktrackPrio+ curbprio <- fmap (chrPrioLift (Proxy :: Proxy env) (Proxy :: Proxy s)) $ getl $ bst ^* chrbstBacktrackPrio return $ fmap (\(s,ws) -> FoundSlvMatch s freevars ws (FoundMatchSortKey (fmap ((,) s) mbpr) (Set.size ws) (_storedChrInx chr)) [ FoundBodyAlt i bp a | (i,a) <- zip [0..] alts, let bp = maybe minBound (chrPrioEval env s) $ rbodyaltBacktrackPrio a ])
src/CHR/Types/Core.hs view
@@ -263,7 +263,7 @@ type family CHRPrioEvaluatableVal p :: * -- | A PrioEvaluatable participates in the reduction process to indicate the rule priority, higher prio takes precedence-class (Ord (CHRPrioEvaluatableVal x), Bounded (CHRPrioEvaluatableVal x)) => CHRPrioEvaluatable env x subst | x -> env subst where+class (Ord (CHRPrioEvaluatableVal x), Bounded (CHRPrioEvaluatableVal x)) => CHRPrioEvaluatable env x subst where -- | Reduce to a prio representation chrPrioEval :: env -> subst -> x -> CHRPrioEvaluatableVal x chrPrioEval _ _ _ = minBound@@ -273,7 +273,7 @@ chrPrioCompare e (s1,x1) (s2,x2) = chrPrioEval e s1 x1 `compare` chrPrioEval e s2 x2 -- | Lift prio val into prio- chrPrioLift :: CHRPrioEvaluatableVal x -> x+ chrPrioLift :: proxy env -> proxy subst -> CHRPrioEvaluatableVal x -> x ------------------------------------------------------------------------------------------- --- Prio