tcStmt ret (ForStatement l startE whileE incE ann bodyS) = tcStmtBlock l "for statement" $ tcLocal l "tcStmt for" $ do
    ((startE',whileE',incE',ann',bodyS',t'),rs,ws) <- withDecClassVars $ do
        startE' <- tcStmtBlock l "for statement" $ tcForInitializer startE
        whileE' <- tcStmtBlock l "for statement guard" $ mapM (tcGuard) whileE
        incE' <- withExprC ReadWriteExpr $ tcStmtBlock l "for statement increment" $ mapM (tcExpr Nothing) incE
        ann' <- mapM tcLoopAnn ann
        (bodyS',t') <- tcLocal l "tcStmt for body" $ tcLoopBodyStmt ret l bodyS
        return (startE',whileE',incE',ann',bodyS',t')
    debugTc $ do
        ppl <- ppr l
        pprs <- pp rs
        ppws <- pp ws
        locals <- State.gets (Map.keys . localVars)
        pplocals <- pp locals
        liftIO $ putStrLn $ "whileT " ++ ppl ++ ": " ++ show pprs ++ "  :  " ++ show ppws ++ "\n" ++ show pplocals
    return (ForStatement (Typed l $ WhileT rs ws) startE' whileE' incE' ann' bodyS',t')
tcStmt ret (ForStatement l startE whileE incE ann bodyS) = tcStmtBlock l "for statement" $ tcLocal l "tcStmt for" $ do
    ((startE',whileE',incE',ann',bodyS',t'),rs,ws) <- withDecClassVars $ do
        startE' <- tcStmtBlock l "for statement" $ tcForInitializer startE
        whileE' <- tcStmtBlock l "for statement guard" $ mapM (tcGuard) whileE
        incE' <- withExprC ReadWriteExpr $ tcStmtBlock l "for statement increment" $ mapM (tcExpr Nothing) incE
        ann' <- mapM tcLoopAnn ann
        (bodyS',t') <- tcLocal l "tcStmt for body" $ tcLoopBodyStmt ret l bodyS
        return (startE',whileE',incE',ann',bodyS',t')
    debugTc $ do
        ppl <- ppr l
        pprs <- pp rs
        ppws <- pp ws
        locals <- State.gets (Map.keys . localVars)
        pplocals <- pp locals
        liftIO $ putStrLn $ "whileT " ++ ppl ++ ": " ++ show pprs ++ "  :  " ++ show ppws ++ "\n" ++ show pplocals
    return (ForStatement (Typed l $ WhileT rs ws) startE' whileE' incE' ann' bodyS',t')
tcStmt ret (ForStatement l startE whileE incE ann bodyS) = tcStmtBlock l "for statement" $ tcLocal l "tcStmt for" $ do
    ((startE',whileE',incE',ann',bodyS',t'),rs,ws) <- withDecClassVars $ do
        startE' <- tcStmtBlock l "for statement" $ tcForInitializer startE
        whileE' <- tcStmtBlock l "for statement guard" $ mapM (tcGuard) whileE
        incE' <- withExprC ReadWriteExpr $ tcStmtBlock l "for statement increment" $ mapM (tcExpr Nothing) incE
        ann' <- mapM tcLoopAnn ann
        (bodyS',t') <- tcLocal l "tcStmt for body" $ tcLoopBodyStmt ret l bodyS
        return (startE',whileE',incE',ann',bodyS',t')
    debugTc $ do
        ppl <- ppr l
        pprs <- pp rs
        ppws <- pp ws
        locals <- State.gets (Map.keys . localVars)
        pplocals <- pp locals
        liftIO $ putStrLn $ "whileT " ++ ppl ++ ": " ++ show pprs ++ "  :  " ++ show ppws ++ "\n" ++ show pplocals
    return (ForStatement (Typed l $ WhileT rs ws) startE' whileE' incE' ann' bodyS',t')