According to Lacan, Hamlet was unable to mourn his dead father because his mother prematurely married his uncle and replaced the symbolic father. The mother, therefore, replaced the lost object with a new one before Hamlet could withdraw his desire and direct it elsewhere. The original lost object is the phallus and what Lacan is suggesting is that Hamlet is unable to mourn the loss of the phallus that will inaugurate the movement of his own desire. In this situation, Freud suggested that mourning turns into melancholia. In melancholia, the act of mourning is narcissisticly turned back upon the self and the subject identifies his/her own ego with the lost object. Melancholia, therefore, has the effect of blocking the natural process of mourning and freezing the subject in time.
Hamlet simply cannot choose between his own desire and the desire of the Other.... Hamlet confuses and distorts his own desire. This confusion can also be seen through Hamlet's relationship with Ophelia. Lacan reads Ophelia as the object of desire - the objet petit a, or object cause of Hamlet's desire.
"...his (Lacan's) point is that what happens in melancholia is not that you lose the object; you have the object but you lose the desire for the object: you lose the object cause of desire. Everything is here, you lose the desire for it."- Slajov Zizek