if
s in Haskell aren't terribly pretty, but that's not really the reason they're used so seldom. It's more because there's usually a more elegant syntactic alternative! In your example, I would consider
let ( lblTabX, lblTabY, lblTabPosition, lblTabWidth, lblTabHeight, lblTabMargin )
| isAtBottom =( 5, 3, bottom, lblPageX-60, 20, Margin 0 3 )
| otherwise =( 3, 60, top, 20, pageHeight - 80, Margin 3 0 )
Alternatively, you might define an already partially evaluated operator locally:
let bottomCase/|/topCase | isAtBottom = bottomCase
| otherwise = topCase
lblTabY = 3 /|/ 60
lblTabPosition = Position left $ bottom /|/ top
lblTabWidth = (lblPageX - 60) /|/ 20
lblTabHeight = 20 /|/ (pageHeight - 80)
lblTabMargin = Margin 0 3 /|/ Margin 3 0
You definitely do not want to do the check on isAtBottom
multiple times, redundant code is always bad, regardless of which syntax you use.
But when you do just need a single decision based on a simple boolean value, I would stick to the standard if
rather than defining custom operators.