@@ -277,8 +277,8 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
277277 getImps _ = []
278278
279279 mkAuxC wname lhs ns (PClauses fc o n cs)
280− | n == fname = do cs' <- mapM (mkAux wname lhs ns) cs
281− return $ PClauses fc o wname cs'
280+ | True = do cs' <- mapM (mkAux wname lhs ns) cs
281+ return $ PClauses fc o wname cs'
282282 | otherwise = fail $ "with clause uses wrong function name " ++ show n
283283 mkAuxC wname lhs ns d = return $ d
284284
@@ -292,15 +292,16 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
292292 Just mvars -> do logLvl 3 ("Match vars : " ++ show mvars)
293293 lhs <- updateLHS n wname mvars ns tm w
294294 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)
296296 = do i <- get
297297 let tm = addImpl i tm_in
298298 logLvl 2 ("Matching " ++ showImp True tm ++ " against " ++
299299 showImp True toplhs)
300+ withs' <- mapM (mkAuxC wname toplhs ns) withs
300301 case matchClause toplhs tm of
301302 Nothing -> fail "with clause does not match top level"
302303 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'
304305
305306 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
306307 = return $ substMatches mvars $