summaryrefslogtreecommitdiff
path: root/src/GF/UseGrammar/Editing.hs
diff options
context:
space:
mode:
authoraarne <unknown>2004-11-01 21:41:18 +0000
committeraarne <unknown>2004-11-01 21:41:18 +0000
commit2bd22e078aa0205f60bb414d2e7f17d73db1eaea (patch)
tree4a070991183a09d21f4a517bf05fd4cfa1610df5 /src/GF/UseGrammar/Editing.hs
parent42ff99469a12e54958f07b58b24f69834c9c1569 (diff)
some bug fixes in type check and solve
Diffstat (limited to 'src/GF/UseGrammar/Editing.hs')
-rw-r--r--src/GF/UseGrammar/Editing.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/GF/UseGrammar/Editing.hs b/src/GF/UseGrammar/Editing.hs
index 45e180b0d..12113b91f 100644
--- a/src/GF/UseGrammar/Editing.hs
+++ b/src/GF/UseGrammar/Editing.hs
@@ -187,10 +187,11 @@ refineWithTreeReal :: Bool -> CGrammar -> Tree -> Meta -> Action
refineWithTreeReal der gr tree m state = do
state' <- replaceSubTree tree state
let cs0 = allConstrs state'
- (cs,ms) = splitConstraints cs0
+ (cs,ms) = splitConstraints gr cs0
v = vClos $ tree2exp (bodyTree tree)
msubst = (m,v) : ms
- metaSubstRefinements gr msubst $ mapLoc (performMetaSubstNode msubst) state'
+ metaSubstRefinements gr msubst $
+ mapLoc (reduceConstraintsNode gr . performMetaSubstNode msubst) state'
-- without dep. types, no constraints, no grammar needed - simply: do
-- testErr (actIsMeta state) "move pointer to meta"
@@ -339,12 +340,13 @@ reCheckState gr st = annotate gr (tree2exp (loc2tree st)) >>= return . tree2loc
-- extract metasubstitutions from constraints and solve them
solveAll :: CGrammar -> State -> Err State
-solveAll gr st0 = do
- st <- reCheckState gr st0
- let cs0 = allConstrs st
- (cs,ms) = splitConstraints cs0
- metaSubstRefinements gr ms $ mapLoc (performMetaSubstNode ms) st
-
+solveAll gr st = solve st >>= solve where
+ solve st0 = do ---- why need twice?
+ st <- reCheckState gr st0
+ let cs0 = allConstrs st
+ (cs,ms) = splitConstraints gr cs0
+ metaSubstRefinements gr ms $
+ mapLoc (reduceConstraintsNode gr . performMetaSubstNode ms) st
-- active refinements