@@ -277,8 +277,8 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
277 getImps _ = []
277 getImps _ = []
279 mkAuxC wname lhs ns (PClauses fc o n cs)
279 mkAuxC wname lhs ns (PClauses fc o n cs)
280− | n == fname = do cs' <- mapM (mkAux wname lhs ns) cs
280+ | True = do cs' <- mapM (mkAux wname lhs ns) cs
281− return $ PClauses fc o wname cs'
281+ return $ PClauses fc o wname cs'
282 | otherwise = fail $ "with clause uses wrong function name " ++ show n
282 | otherwise = fail $ "with clause uses wrong function name " ++ show n
283 mkAuxC wname lhs ns d = return $ d
283 mkAuxC wname lhs ns d = return $ d
@@ -292,15 +292,16 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
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 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 wheres)
295+ mkAux wname toplhs ns (PWith n tm_in (w:ws) wval withs)
296 = do i <- get
296 = do i <- get
297 let tm = addImpl i tm_in
297 let tm = addImpl i tm_in
298 logLvl 2 ("Matching " ++ showImp True tm ++ " against " ++
298 logLvl 2 ("Matching " ++ showImp True tm ++ " against " ++
299 showImp True toplhs)
299 showImp True toplhs)
300+ withs' <- mapM (mkAuxC wname toplhs ns) withs
300 case matchClause toplhs tm of
301 case matchClause toplhs tm of
301 Nothing -> fail "with clause does not match top level"
302 Nothing -> fail "with clause does not match top level"
302 Just mvars -> do lhs <- updateLHS n wname mvars ns tm w
303 Just mvars -> do lhs <- updateLHS n wname mvars ns tm w
303− return $ PWith wname lhs ws wval wheres
304+ return $ PWith wname lhs ws wval withs'
305 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
306 = return $ substMatches mvars $
307 = return $ substMatches mvars $