Good sleepers can do anything they want in bed. But those with insomnia are advised to use their beds only for sleeping and sex. No watching television, reading, knitting or what-have-you. The bed should be associated with sleep. |link|
Presumably there's a Pavlovian mechanism to explain how having sex in bed works to associate the bed with sleep. But why wouldn't something similar happen with knitting?