
On Tue, 22 Nov 2011 14:46:37 -0800 Lee Short
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?
That's not my actual code, I was just using it as a simplified example and didn't put a lot of thought into it. My actual code is if delete /= "" then if exists then deleteFromTable req t key else return () else if exists then updateTable req t key else insertTable req t I'd love to hear comments on how to make that more idiomatic, if there's a way.