What could possibly be wrong with aiming to be happy? Cheerful people are kinder, more productive, and more likely to be successful, after all. And as we all know life is just sweeter when you're feeling good.

But everything has a dark side, and according to a ton of research, that includes happiness. While trying to be happy is hardly the worst goal to chase, if your aim is to be cheerful all the time, you're not only going to fall short, but you're also going to make yourself incredibly anxious trying.

Plus, as UC Berkeley's Greater Good Science Center recently pointed out, a growing number of studies also show that in specific situations, too much good cheer is actually counterproductive (beyond the obvious like going through the grieving process). Here are five times a little bit of grumpiness is actually good for you.

1. When you need to reason critically

If you're going to be spending the day picking apart logical arguments and reasoning your way through difficult problems, you might want to skip the cute cat videos and other mood boosters, research suggests. We're actually better at critical reasoning when we're feeling less than joyful.

Why? "Happiness is a kind of safety signal, indicating that there is no current need for problem solving.... Unhappy people will think more deeply about their social environment (in an effort to solve their problems), whereas happy people can contentedly coast on cruise control, not bothering to think very deeply," writes Greater Good's Kira M. Newman, quoting a 1994 study on the topic.

2. When you need to judge people fairly

Happiness might feel good, but it turns out it also makes us more susceptible to bias and stereotypes, according to a ton of interesting research you can read about in the post. But the bottom line, Newman concludes, is that "people who are in a good mood are sometimes more likely to jump to conclusions about others--and less likely to consciously correct for any stereotypical notions they harbor."

3. When you might be taken advantage of

The research for this one is less clear cut, but if you're facing a potentially tough negotiation or other situation where you need to keep your wits about you, spot lies, and counter manipulation, stony-faced determination is probably better than smiles.

"In a 2008 study, nearly 120 students were induced to feel amused, neutral, or sad (by watching a comedy video, a nature documentary, or a film clip about cancer). Then, they watched interrogation videos where other students lied or told the truth about stealing a movie ticket. Overall, the negative-mood group was better at detecting deception than the neutral or positive groups, correctly identifying the liars more often," Newman writes of some of the relevant research.

4. When you might be tempted to be unethical

Happiness might make people feel good, but it doesn't always make them behave in good ways. Both studies that induced positive and negative emotions and then tracked cheating on tasks, and research that asked people about their mood and their moral reasoning suggest that feeling cheery makes people more prone to be lax about ethics.

5. When you want to empathize with others

This is perhaps the most obvious of the situations outlined by Newman, but as you'd expect, chasing happiness makes it much more difficult to empathize appropriately with others' suffering.

The effect of this can be missed connections for the perpetually cheery and annoyance for those in need of a little understanding. "When I share my anxiety or sadness with a hyper-positive friend of mine, he usually insists that the situation doesn't merit despair, or reassures me that everything will turn out okay--neither of which make me feel better (or understood)," complains Newman. Maybe you've experienced something similar.

So what's the bottom line of all this research? Should you abandon happiness as a life goal? Obviously not entirely, but as this science suggests, you'll probably be better at achieving mental well-being if you moderate your expectations and accept that constant joy is neither attainable nor desirable.

Evolution didn't equip us with negative emotions to torture us. They're often a useful signal or a helpful byproduct of an appropriate state of mind for a given situation.