@@ -290,7 +290,7 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
290290 case matchClause toplhs tm of
291291 Nothing -> fail "with clause does not match top level"
292292 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
294294 return $ PClause wname lhs ws rhs wheres
295295 mkAux wname toplhs ns (PWith n tm_in (w:ws) wval withs)
296296 = do i <- get
@@ -300,13 +300,16 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
300300 withs' <- mapM (mkAuxC wname toplhs ns) withs
301301 case matchClause toplhs tm of
302302 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
304304 return $ PWith wname lhs ws wval withs'
305305
306306 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
307307 = return $ substMatches mvars $
308308 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
310+
311+ fullApp (PApp _ (PApp fc f args) xs) = fullApp (PApp fc f (args ++ xs))
312+ fullApp x = x
310313
311314data MArgTy = IA | EA | CA deriving Show
312315