case expression of pattern -> result pattern -> result pattern -> result ...
这在表达式中作模式匹配很方便,由于模式匹配本质上就是 case 表达式的语法糖,所以这两段也是等价的:
describeList :: [a] -> String describeList xs = "The list is " ++ case xs of [] -> "empty." [x] -> "a singleton list." xs -> "a longer list."
describeList :: [a] -> String describeList xs = "The list is " ++ what xs where what [] = "empty." what [x] = "a singleton list." what xs = "a longer list."