# Haskell MultiWayIf extension: When is it considered useful syntactic sugar? [closed]

The new MultiWayIf extension (available with GHC 7.6) allows guard syntax in an if:

{-# LANGUAGE MultiWayIf #-}
fn :: Int -> String
fn x y = if | x == 1    -> "a"
| y <  2    -> "b"
| otherwise -> "c"


But I don't find it better than the old way:

fn :: Int -> String
fn x y | x == 1    = "a"
| y <  2    = "b"
| otherwise = "c"


Has it sense in other cases?

## closed as off-topic by Jamal♦Apr 26 '18 at 23:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.

• I am not sure if this question is suited for Code Review, maybe it should get migrated to SO. – Flow Apr 8 '13 at 10:00
• Flow, I put in codereview because is probably more subjective that a question in SO. It, IMHO, is a "Best practices and design pattern usage" question – Zhen Apr 8 '13 at 10:06
• Good point, seems reasonable. – Flow Apr 8 '13 at 10:09

Unsurprisingly, it's mainly useful when the if is not the top-level expression. Say:
forM_ [1..100] $\i -> putStrLn$ if | i mod 15 == 0  -> "FizzBuzz"
| i mod 3 == 0   -> "Fizz"
| i mod 5 == 0   -> "Buzz"

I happen across similar cases quite often - up to this point this required either deep if trees or mis-using case in some way.