from typing import Iterable
from typing import Hashable
from typing import Mapping


def all_equal(x: Iterable[Hashable]) -> bool:
    """
    Checks if all elements in `x` are equal. Returns `False` if `x` is empty.

    Defined to improve readability.

    Examples:
        >>> all_equal((1, 1, 1, 1))
        True
        >>> all_equal((1, 1, 1, 2))
        False
    """
    if isinstance(x, Mapping):
        raise TypeError('all_equal does not support Mappings')
    return len(set(x)) == 1