[Haskell] factoring `if'