Error when trying to write analog and digital signals from different pins (Arduino UNO)
I tested your code and it does indeed behave the way you said. But that is because you have not declared any pins as output.

analogWrite does this for you automatically in the library, however digitalWrite does not. This is because sending a digital pin HIGH when it is INPUT turns on the internal pull-up resistors. These are around 50k. Thus you will only see very dim output on the LED. Add this line to setup:

 pinMode (8, OUTPUT); 


(And preferably pin 9 as well, just in case you decide to change to digital writes later).