Ethereum developers certainly considered the idea of using mining power to do useful work - i.e., run contracts - rather than "waste" it with meaningless hashes. I'm interested in knowing what have been learned from that idea, and why it was ultimately discarded.
Mining is an infrastructure feature. Contracts are one layer above this infrastructure, and as such are oblivious to mining.
Mining is not meant to do meaningless hashes for the sake of it. This frantic hashing, proof-of-work, is here to reach consensus and make difficult the modification of past blocks.
mining and running a contract are different operations for different purposes that occur in different time.
the mining process (POW) is needed to secure the network, the waste of calculation ( as you see it) is the proof needed in the network to reach the consensus but the miners are rewarded. It is a good idea to exploit the mining process in a useful operation, but if we want to do so we need an autonomous operation that give us the proof within a certain time which could not be falsified indicating that the miner is telling the truth (
The Byzantine Generals Problem ). we use "bruteforce" hashing operation because we are sure that nobody could cheat (because we could check the given result "hash" by a mathematical process) and give us the result without mining.
so if we change proof of work by something like proof of execution where the miners execute codes instead hashing we have many problem here :
1-how to check if the result is true and the miner has really executed the contract
2-if there is no contract to execute, what to do?
3-how to increase the difficulty?
4-the contract didn't have the same difficulty level
and so forth
However there is many proof of * like proof of Stake where we don't need to make such costly calculation.