"A Scanner Darkly" (1977) is a bleak mixture of science fiction and police procedural novels. In its story, an undercover narcotics police detective begins to lose touch with reality. This is because he becomes a victim of the drug he should have fought against. This drug is called "SubstanceD". It permanently changes the mind of the people who take it. Substance D is instantly addictive. It starts with a pleasant euphoria. This feeling is quickly replaced with increasing confusion, hallucinations and eventually total psychosis. It was adapted to movie by Richard Linklater.