the :: (Eq a, Show a) => [a] -> a the [] = error "empty list" the (x:xs) | all (==x) xs = x the xs = error ("more than one item: " ++ show xs)