Let us suppose that we have a list xs (possibly a very big one), and we want to check that all its elements are the same.
xs
I came up wi
While not very efficient (it will traverse the whole list even if the first two elements don't match), here's a cheeky solution:
import Data.List (group) allTheSame :: (Eq a) => [a] -> Bool allTheSame = (== 1) . length . group
Just for fun.