I would stress Foucault's departure from Marx as well as his continuity. If you compare the Chapter on the Bloody Legislation of the Fifteenth Century in Marx, he draws rather different conclusions from Foucault's on the importance of institutions of repression. Where Foucault makes the prison the model for the factory, Marx's point is different. He says that less developed society depends on direct coercion because the indirect compulsion of the market is not yet in place. Foucault's argument stresses the continuity between direct coercion, and internalised self-repression. Marx's argument stresses what is historically specific to capitalism, that it does not rest on direct coercion. Foucault makes the prison the model for the factory, Marx shows how the factory displaces the prison.