Haskell Language Eq


Example

All basic datatypes (like Int, String, Eq a => [a]) from Prelude except for functions and IO have instances of Eq. If a type instantiates Eq it means that we know how to compare two values for value or structural equality.

> 3 == 2 
False
> 3 == 3
True

Required methods

  • (==) :: Eq a => a -> a -> Boolean or (/=) :: Eq a => a -> a -> Boolean (if only one is implemented, the other defaults to the negation of the defined one)

Defines

  • (==) :: Eq a => a -> a -> Boolean
  • (/=) :: Eq a => a -> a -> Boolean

Direct superclasses

None

Notable subclasses