@@ -290,7 +290,7 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
290 case matchClause toplhs tm of
290 case matchClause toplhs tm of
291 Nothing -> fail "with clause does not match top level"
291 Nothing -> fail "with clause does not match top level"
292 Just mvars -> do logLvl 3 ("Match vars : " ++ show mvars)
292 Just mvars -> do logLvl 3 ("Match vars : " ++ show mvars)
293− lhs <- updateLHS n wname mvars ns tm w
293+ lhs <- updateLHS n wname mvars ns (fullApp tm) w
294 return $ PClause wname lhs ws rhs wheres
294 return $ PClause wname lhs ws rhs wheres
295 mkAux wname toplhs ns (PWith n tm_in (w:ws) wval withs)
295 mkAux wname toplhs ns (PWith n tm_in (w:ws) wval withs)
296 = do i <- get
296 = do i <- get
@@ -300,13 +300,16 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
300 withs' <- mapM (mkAuxC wname toplhs ns) withs
300 withs' <- mapM (mkAuxC wname toplhs ns) withs
301 case matchClause toplhs tm of
301 case matchClause toplhs tm of
302 Nothing -> fail "with clause does not match top level"
302 Nothing -> fail "with clause does not match top level"
303− Just mvars -> do lhs <- updateLHS n wname mvars ns tm w
303+ Just mvars -> do lhs <- updateLHS n wname mvars ns (fullApp tm) w
304 return $ PWith wname lhs ws wval withs'
304 return $ PWith wname lhs ws wval withs'
306 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
306 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
307 = return $ substMatches mvars $
307 = return $ substMatches mvars $
308 PApp fc (PRef fc' wname) (map (pexp . (PRef fc')) ns ++ [pexp w])
308 PApp fc (PRef fc' wname) (map (pexp . (PRef fc')) ns ++ [pexp w])
309− updateLHS n wname mvars ns tm w = fail $ "Not implemented " ++ show tm
309+ updateLHS n wname mvars ns tm w = fail $ "Not implemented match " ++ show tm
311+ fullApp (PApp _ (PApp fc f args) xs) = fullApp (PApp fc f (args ++ xs))
311data MArgTy = IA | EA | CA deriving Show
314data MArgTy = IA | EA | CA deriving Show