What does MultiWayIf extension offer that cannot be done using | guards and vice versa?
For instance, one can write same function as
f x | x == 0 = -1
| otherwise = x
or
f x = if | x == 0 -> -1
| otherwise -> x
I don't see any difference between these two examples beside syntactic sugar used. Are there situations where I should prefer one over another?
Aucun commentaire:
Enregistrer un commentaire