[Haskell-beginners] hlint and DoIfThenElse

Felipe Almeida Lessa felipe.lessa at gmail.com
Wed Nov 23 00:04:36 CET 2011


On Tue, Nov 22, 2011 at 8:58 PM, Mike Meyer <mwm at mired.org> wrote:
> 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?

Minor nitpick since we are on 'begginers' list: you need parenthesis
there, so either

  return ("" == results)

or

  return $ "" == results

otherwise it would get parsed as '(return "") == results'.


Also, note that instead of doing "" ==, you could use 'null', so

  return (null results)


HTH,

-- 
Felipe.



More information about the Beginners mailing list