full x = case
x of [y] case y of
[z] -> 1
[] -> 2
_ case False -> 3
head x of
[1] -> 3
[y] case
y > 0 -> 4
True -> 5
_ case x of _ -> 6
Geoffrey
We're using case for both actual case and pattern guards, and allowing
branches at every level. That was a purposefully convoluted example, but
translated into haskell, it means:
full x = case x of
[y]
| [z] <- y -> 1
| [] <- y -> 2
| _ <- y, False -> 3
_ -> case head x of
[1] -> 3
[y]
| y > 0 -> 4
| True -> 5
_ | _ <- x -> 6
To me, the only slightly strange part is the "else" syntax (line starting
"head x of"), but I think it looks fine in normal use:
case
x of 4 -> 0
y of 6 -> 1
z of 8 -> 2
_ -> 3