1{-# LANGUAGE MultiWayIf #-}
2module MultiWayIf where
3
4foo = if | test1 -> e1
5         | test2 witharg -> e2
6         | otherwise -> def
7
8bar = if { | test1 -> if { | test2 -> e1
9                           | test3 -> e2 }
10           | test4 -> e3
11         }
12
13-- taken from GHC's test suite
14x  = 10
15x1 = if | x < 10 -> "< 10" | otherwise -> ""
16x2 = if | x < 10 -> "< 10"
17        | otherwise -> ""
18x3 = if | x < 10 -> "< 10"
19        | otherwise -> ""
20x4 = if | True -> "yes"
21x5 = if | True -> if | False -> 1 | True -> 2
22
23x6 = if | x < 10 -> if | True -> "yes"
24                       | False -> "no"
25        | otherwise -> "maybe"
26
27x7 = (if | True -> 0)
28
29-- issue #98
30spam = if | () <- () -> ()
31