haskpy.typeclasses.hashable.Hashable

Hashable

class Hashable[source]

Bases: Eq

Hashable typeclass

Minimal complete definition:

__hash__

Similary as in PureScript, Hashable is a subclass of Eq.

__annotations__ = {}
__eq__(other)

Equality comparison: Eq a => a -> a -> bool

Can be used as == operator.

The default implementation uses __ne__.

__hash__()[source]

Mark method non-existing

This is a workaround for Python forcefully creating some methods. One cannot create objects that don’t have __eq__, __ge__, __gt__ and many other methods. They are there and it’s not possible to delete them. With this wrapper you can override those methods so that they won’t show up in __dir__ listing and if accessed in any way, AttributeError is raised. Note that it just hides the methods, one can still access them as object.__getattribute__(obj, "__eq__").

__ne__(other)

Inequality comparison: Eq a => a -> a -> bool

Can be used as != operator.

The default implementation uses __eq__.