Here is one way to do it:
allTheSame xs =
case Set.toList(Set.fromList xs) of
[] -> True -- or False, your choice
x::[] -> True
_ -> False
If you convert a list into a set, and the set back to a list, you will get a list with only one element for a list of identical elements
here is another approach
allTheSame2 xs =
let
check x rest =
case rest of
[] -> True
y::ys -> x == y && check x ys
in
case xs of
[] -> True -- or False
y::ys -> check y ys
and another approach
allTheSame3 xs =
let
f x acc =
if List.member x acc then acc else x::acc
in
List.length (List.foldl f [] xs) <= 1