@@ -625,10 +625,15 @@ elabClause info tcgen (_, PWith fc fname lhs_in withs wval_in withblock)
625 return $ PWith fc wname lhs ws wval withs'
625 return $ PWith fc wname lhs ws wval withs'
627 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
627 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
628+ = let ns' = map (keepMvar (map fst mvars) fc') ns in
628− = return $ substMatches mvars $
629+ return $ substMatches mvars $
629− PApp fc (PRef fc' wname) (map (pexp . (PRef fc')) ns ++ [pexp w])
630+ PApp fc (PRef fc' wname)
631+ (map pexp ns' ++ [pexp w])
630 updateLHS n wname mvars ns tm w = fail $ "Not implemented match " ++ show tm
632 updateLHS n wname mvars ns tm w = fail $ "Not implemented match " ++ show tm
634+ keepMvar mvs fc v | v `elem` mvs = PRef fc v
635+ | otherwise = Placeholder
632 fullApp (PApp _ (PApp fc f args) xs) = fullApp (PApp fc f (args ++ xs))
637 fullApp (PApp _ (PApp fc f args) xs) = fullApp (PApp fc f (args ++ xs))
633 fullApp x = x
638 fullApp x = x