Haskell if does exactly what you want.
if x == y then a else b
As Lee mentioned, there is a bool function in Data.Bool that does the same. In addition, due to the gentleness of Haskell, bool someLongComputation something True does not run long calculations.
source share