In the western, liberal tradition, freedom is king, and that includes the freedom to be unhappy. If someone wants to engage in self-harming acts such as drunkenness, for example, one cannot judge them negatively so long as they consent to it and do no harm to others.

This type of thinking would have been alien to Immanuel Kant (1724-1804), the German philosopher, who is sometimes portrayed as a joyless moralist but was, in fact, deeply concerned with human happiness, according to Dr Alice Pinheiro Walla, a lecturer at Trinity College Dublin. Under Kant’s moral framework, you have a duty to preserve your life and health, as these are bound up with other moral duties. Performing acts that are incompatible with your self-esteem is prohibited by the moral law.

Kant illustrated the point with the example of the “gout sufferer”, who, he says, has a moral duty to avoid harming herself by sticking to the correct diet, even if she gets short-term pleasure from bingeing on rich foods. (Kant himself suffered from gout, which strikes when excessive uric acid builds up in the body.)

Pinheiro Walla, who is working on a book about Kant and happiness, explains how the German philosopher can teach us to be content. Although happiness is “indeterminate” in Kant’s eyes, morality is constant, and fixing upon it can give your life a real purpose. In Kant’s own words: “To secure one’s own happiness is one’s duty; for lack of contentment with one’s condition, in the trouble of many worries and amidst unsatisfied needs, could easily become a great temptation to transgress one’s duties.”

What is Kant trying to get across with the example of the gout sufferer?

“Kant talks about this person who is sick and suffers from gout, and he realises ‘If I try to be healthy and observe all the restraints on my diet, and cut down on my pleasures, things will not really improve in terms of pleasure for me’. So he realises, in terms of a balance of pleasures, it makes sense to indulge in what he can and suffer afterwards.

“Kant concludes that it is, in fact, rational for the gout sufferer to think like that because his conception of empirical, practical rationality is actually hedonistic. So morality comes into the picture to compensate that.

Listen: How Kant can teach us to be happy

“Kant thinks that as long as we have an interest in our overall wellbeing, our happiness, we are motivated to pursue it. But when this motivation is gone – perhaps because we are too depressed or because, like the gout sufferer, happiness does not promise any more what it used to promise in term of expected satisfaction – then morality has to kick in and remind you that you cannot reduce yourself just to enjoyment.”

This seems to quite a pessimistic view of human nature, doesn’t it, where morality is required to stop us from harming ourselves?

“A central idea of Kant’s moral theory is the idea that the capacity for morality raises us above animality. It opens up a way of life and a way of valuing ourselves that gives us this special status.

“There is this famous quote by Oscar Wilde, ‘We are all in the gutter but some of us are looking at the stars’. That reminds me a lot of Kant because he thinks looking at the stars is like thinking of the moral law in us.

“Why can we look at the stars when we are in the gutter? Because we have that rational vocation, because we are more than just our instincts.”

But what would Kant say to someone who proclaims to be happy in the gutter?

“Okay, while we have this talk about dignity, we also have Kant’s conception of happiness as something which cannot be prescribed from outside. So people have a right to form their own conception of happiness . . . Now formulating this conception of happiness would be an imaginative exercise, and you go through your life testing these conceptions. This is what Kant means when he says happiness is indeterminate.

“So perhaps someone who likes the gutter more than being above the gutter would in a sense have a right to it, if that is part of her conception of happiness. Drawing the line is very difficult. We would have to say she has destroyed her capacity for rationality – she has reduced herself to mere animality – and that would be a violation of a duty of the self. But just a choice of lifestyle: that would not violate a duty per se.”

What can Kant teach us about happiness?

“He can teach us that happiness is a difficult exercise because we don’t know what would make us happy. We have to guess. It would require omniscience to know what would make you happy, first of all because we don’t have direct access to yourself – so you actually have to interpret your needs – and this is hard.

“Second, our choices have consequences outside our control. It can be that my having chosen an academic career could have lots of consequences I couldn’t foresee and will impact on my happiness. Perhaps I am unhappy in my department, or perhaps this causes me to neglect some important relationship and so on.

“I think morality counteracts this in a very helpful way because it seems like the more we try to be happy, the less we achieve it. And it seems morality brings a certainty into life that the pursuit of happiness cannot provide. This is the certainty to know that if you do the right thing it is the right thing no matter the consequences. That creates something that is stable, that is valuable, that is within your power, no matter what.”