From the usurping king's blazing contemplation of heaven and hell, to the prince's own cackling meditation on mortality, Shakespeare uses melancholic monologues to breathtaking effect.
I think it builds an increasingly clearer story in terms of where the problems lie in the brain when people go into the 'black dog' melancholic depression.