[Haskell-beginners] hlint and DoIfThenElse
Mike Meyer
mwm at mired.org
Tue Nov 22 23:58:58 CET 2011
On Tue, 22 Nov 2011 14:46:37 -0800
Lee Short <blackcat at pro-ns.net> wrote:
> hlint gives me a parse error on a clause using DoIfThenElse, even if
> I have the language pragma. I don't see any hlint options to get
> around that, are there any?
>
> Is it considered good style to write code like this?
>
> if "" == results
> then return True
> else return False
>
> The obvious way rewrite below just seems clunky to me (though I can
> see how others might prefer it to the code above).
>
> return $ if "" == results
> then True
> else False
You've just pressed one of my language-independent style hot
buttons. Why on earth are you using an if/then/else here? What's wrong
with the straightforward:
return "" == results
The expression results in a boolean, and it's even the one you want to
return. So why not return it?
<mike
More information about the Beginners
mailing list