From 496f1fc8767f9d8ce1bb69b6e6460c2b7b7dd4b4 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Thu, 1 Jun 2006 10:26:49 +0000 Subject: The SLinType type is changed so that you don't have to use enumerateTerms each time when you want to know the possible table arguments --- src/GF/Conversion/SimpleToMCFG/Nondet.hs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/GF/Conversion/SimpleToMCFG/Nondet.hs') diff --git a/src/GF/Conversion/SimpleToMCFG/Nondet.hs b/src/GF/Conversion/SimpleToMCFG/Nondet.hs index 514f2b382..d6ff052f5 100644 --- a/src/GF/Conversion/SimpleToMCFG/Nondet.hs +++ b/src/GF/Conversion/SimpleToMCFG/Nondet.hs @@ -136,15 +136,13 @@ simplifyCase (pat, term) = liftM2 (,) (simplifyTerm pat) (simplifyTerm term) reduceTerm :: SLinType -> SPath -> STerm -> CnvMonad () --reduceTerm ctype path (Variants terms) -- = member terms >>= reduceTerm ctype path -reduceTerm (StrT) path term = updateLin (path, term) -reduceTerm (ConT _ _) path term = do pat <- expandTerm term - updateHead (path, pat) +reduceTerm (StrT) path term = updateLin (path, term) +reduceTerm (ConT _) path term = do pat <- expandTerm term + updateHead (path, pat) reduceTerm (RecT rtype) path term - = sequence_ [ reduceTerm ctype (path ++. lbl) (term +. lbl) | - (lbl, ctype) <- rtype ] -reduceTerm (TblT ptype vtype) path table - = sequence_ [ reduceTerm vtype (path ++! pat) (table +! pat) | - pat <- enumeratePatterns ptype ] + = sequence_ [ reduceTerm ctype (path ++. lbl) (term +. lbl) | (lbl, ctype) <- rtype ] +reduceTerm (TblT pats vtype) path table + = sequence_ [ reduceTerm vtype (path ++! pat) (table +! pat) | pat <- pats ] ------------------------------------------------------------ @@ -174,7 +172,7 @@ unifyPType arg (RecT prec) = sequence [ liftM ((,) lbl) $ unifyPType (arg +. lbl) ptype | (lbl, ptype) <- prec ] -unifyPType (Arg nr _ path) (ConT con terms) = +unifyPType (Arg nr _ path) (ConT terms) = do (_, args, _, _) <- readState case lookup path (ecatConstraints (args !! nr)) of Just term -> return term -- cgit v1.2.3