Skip to content
This repository was archived by the owner on Nov 1, 2018. It is now read-only.

Commit

Permalink
changes parallel with uhc-util: CHR rules have field for priority, un…
Browse files Browse the repository at this point in the history
…used currently
  • Loading branch information
atzedijkstra committed Feb 19, 2016
1 parent b84bf35 commit e673ff9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
2 changes: 2 additions & 0 deletions EHC/src/ehc/CHR/Instances.chs
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,7 @@ instance CHRCheckable FIIn Guard VarMp where
instance IsCHRConstraint FIIn Constraint VarMp

instance IsCHRGuard FIIn Guard VarMp

-- instance IsCHRPrio FIIn Prio VarMp
%%]

36 changes: 20 additions & 16 deletions EHC/src/ehc/CHR/Solve.chs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ Assumptions (to be documented further)
%%]

%%[(9 hmtyinfer) import(UHC.Util.CHR.Solve.TreeTrie.Mono hiding(IsCHRSolvable(..), SolveState, SolveTrace, SolveStep, CHRStore), qualified UHC.Util.CHR.Solve.TreeTrie.Mono as Mono) export(module UHC.Util.CHR.Solve.TreeTrie.Mono, IsCHRSolvable(..), SolveState, SolveTrace, SolveStep, CHRStore', CHRSolverConstraint)
instance Mono.IsCHRSolvable FIIn Constraint Guard VarMp
instance Mono.IsCHRSolvable FIIn Constraint Guard Prio VarMp

type CHRSolverConstraint = Constraint

-- | (Class alias) API for solving requirements, hiding Mono/Poly differences
class ( Mono.IsCHRSolvable env c g s
) => IsCHRSolvable env c g s
class ( Mono.IsCHRSolvable env c g p s
) => IsCHRSolvable env c g p s

instance IsCHRSolvable FIIn Constraint Guard VarMp
instance IsCHRSolvable FIIn Constraint Guard Prio VarMp

type CHRStore' e c g s = Mono.CHRStore c g
type SolveState e c g s = Mono.SolveState c g s
type SolveTrace e c g s = Mono.SolveTrace c g s
type SolveStep e c g s = Mono.SolveStep c g s
type CHRStore' e c g p s = Mono.CHRStore c g p
type SolveState e c g p s = Mono.SolveState c g p s
type SolveTrace e c g p s = Mono.SolveTrace c g p s
type SolveStep e c g p s = Mono.SolveStep c g p s
%%]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand All @@ -51,16 +51,16 @@ type instance ExtrValVarKey (CHRGuard FIIn VarMp) = TyVarId

-- | (Class alias) API for solving requirements, hiding Mono/Poly differences
class ( Poly.IsCHRSolvable env s
) => IsCHRSolvable env c g s
) => IsCHRSolvable env c g p s

instance IsCHRSolvable FIIn Constraint Guard VarMp
instance IsCHRSolvable FIIn Constraint Guard Prio VarMp

type instance TTKey (CHRConstraint FIIn VarMp) = TTKey Constraint

type CHRStore' e c g s = Poly.CHRStore e s
type SolveState e c g s = Poly.SolveState e s
type SolveTrace e c g s = Poly.SolveTrace e s
type SolveStep e c g s = Poly.SolveStep e s
type CHRStore' e c g p s = Poly.CHRStore e s
type SolveState e c g p s = Poly.SolveState e s
type SolveTrace e c g p s = Poly.SolveTrace e s
type SolveStep e c g p s = Poly.SolveStep e s
%%]

%%[(9999 hmtyinfer) import(Control.Monad, Data.Typeable, UHC.Util.Serialize)
Expand All @@ -85,8 +85,12 @@ instance Serialize (CHRRule FIIn VarMp) where
%%% For both variants
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%[(9 hmtyinfer) export(CHRStore)
type CHRStore = CHRStore' FIIn Constraint Guard VarMp
%%[(9 hmtyinfer) export(CHRStore, Prio)
-- dummy (for now)
type Prio = ()
-- type CHRPrio = Prio

type CHRStore = CHRStore' FIIn Constraint Guard Prio VarMp
%%]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
4 changes: 3 additions & 1 deletion EHC/src/ehc/Core/CommonBindExtract.cag
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

To be filled in hooks:
- boundval
- result: local attr boundval
- its type: SelVal
- its selection mechanism: inherited attr boundsel

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Selection criterium (on AG level thus only 1 is possible because hardwired via attr name)
Expand Down
8 changes: 4 additions & 4 deletions EHC/src/ehc/Pred/ToCHR.chs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ mkClassSimplChrs :: FIIn -> CHRStore -> CHRClassDecl -> CHRStore
mkClassSimplChrs env rules (context, head, infos)
= simps
where simps = chrStoreFromElems $ mapTrans (Set.fromList [head1]) [] head1 (zip infos (map (\p -> Red_Pred $ mkCHRPredOcc p sc1) context))
(superClassesWork, superClassesDone, _ :: SolveTrace FIIn Constraint Guard VarMp)
(superClassesWork, superClassesDone, _ :: SolveTrace FIIn Constraint Guard Prio VarMp)
= chrSolve' env rules (map (\p -> toSolverConstraint $ mkAssume $ mkCHRPredOcc p sc1) context)
superClasses = superClassesWork ++ superClassesDone
graph = mkRedGraphFromReductions $ filterMb fromSolverConstraint superClasses
Expand Down Expand Up @@ -279,9 +279,9 @@ mkInstanceChr (context, hd, i, s)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%[(9 hmtyinfer) export(SimplifyResult, SimplifyResult''(..),emptySimplifyResult)
data SimplifyResult'' p i g s
data SimplifyResult'' p i g pr s
= SimplifyResult
{ simpresSolveState :: SolveState FIIn (Constraint' p i) g s
{ simpresSolveState :: SolveState FIIn (Constraint' p i) g pr s
, simpresRedGraph :: RedGraph' p i

-- for debugging only:
Expand All @@ -291,7 +291,7 @@ data SimplifyResult'' p i g s
, simpresRemPredL :: [p] -- remaining pred occurrences, which cannot be proven, as a list
}

type SimplifyResult' g s = SimplifyResult'' CHRPredOcc RedHowAnnotation g s
type SimplifyResult' g s = SimplifyResult'' CHRPredOcc RedHowAnnotation g Prio s

type SimplifyResult = SimplifyResult' Guard VarMp

Expand Down

0 comments on commit e673ff9

Please sign in to comment.