There were some small steam locomotives switched to electric firing, as a way to use existing infrastructure during wartime coal shortages. It's questionable if it would scale to the levels you'd want to allow a large main-line engine to run at peak performance.
http://www.douglas-self.com/MUSEUM/LOCOLOCO/swisselec/swisse...