| Copyright | (c) The University of Glasgow 2005 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | libraries@haskell.org |
| Stability | stable |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Data.Eq
Description
Equality
Documentation
The Eq class defines equality (== ) and inequality (/= ).
All the basic datatypes exported by the Prelude are instances of Eq ,
and Eq may be derived for any datatype whose constituents are also
instances of Eq .
The Haskell Report defines no laws for Eq . However, == is customarily
expected to implement an equivalence relationship where two values comparing
equal are indistinguishable by "public" functions, with a "public" function
being one not allowing to see implementation details. For example, for a
type representing non-normalised natural numbers modulo 100, a "public"
function doesn't make the difference between 1 and 201. It is expected to
have the following properties:
Instances
Note that due to the presence of NaN, Double 's Eq instance does not
satisfy reflexivity.
>>>0/0 == (0/0 :: Double)False
Also note that Double 's Eq instance does not satisfy substitutivity:
>>>0 == (-0 :: Double)True>>>recip 0 == recip (-0 :: Double)False
Note that due to the presence of NaN, Float 's Eq instance does not
satisfy reflexivity.
>>>0/0 == (0/0 :: Float)False
Also note that Float 's Eq instance does not satisfy substitutivity:
>>>0 == (-0 :: Float)True>>>recip 0 == recip (-0 :: Float)False
Instance details
Defined in Data.Typeable.Internal
Instance details
Defined in GHC.Unicode
Methods
(==) :: GeneralCategory -> GeneralCategory -> Bool #
(/=) :: GeneralCategory -> GeneralCategory -> Bool #
Instance details
Defined in GHC.Fingerprint.Type
Instance details
Defined in Foreign.C.Types
Instance details
Defined in Foreign.C.Types
Instance details
Defined in GHC.TypeLits
Instance details
Defined in GHC.Generics
Methods
(==) :: DecidedStrictness -> DecidedStrictness -> Bool #
(/=) :: DecidedStrictness -> DecidedStrictness -> Bool #
Instance details
Defined in GHC.Generics
Methods
(==) :: SourceStrictness -> SourceStrictness -> Bool #
(/=) :: SourceStrictness -> SourceStrictness -> Bool #
Instance details
Defined in GHC.Generics
Methods
(==) :: SourceUnpackedness -> SourceUnpackedness -> Bool #
(/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool #
Instance details
Defined in GHC.Generics
Methods
(==) :: Associativity -> Associativity -> Bool #
(/=) :: Associativity -> Associativity -> Bool #
Instance details
Defined in GHC.Exception.Type
Methods
(==) :: ArithException -> ArithException -> Bool #
(/=) :: ArithException -> ArithException -> Bool #
Instance details
Defined in GHC.IO.Exception
Instance details
Defined in GHC.IO
Methods
(==) :: MaskingState -> MaskingState -> Bool #
(/=) :: MaskingState -> MaskingState -> Bool #
Instance details
Defined in GHC.IO.Buffer
Instance details
Defined in GHC.IO.Encoding.Types
Methods
(==) :: CodingProgress -> CodingProgress -> Bool #
(/=) :: CodingProgress -> CodingProgress -> Bool #
Instance details
Defined in GHC.IO.Device
Methods
(==) :: IODeviceType -> IODeviceType -> Bool #
(/=) :: IODeviceType -> IODeviceType -> Bool #
Instance details
Defined in GHC.IO.Handle.Types
Instance details
Defined in GHC.IO.Handle.Types
Instance details
Defined in GHC.IO.Exception
Instance details
Defined in GHC.IO.Exception
Methods
(==) :: ArrayException -> ArrayException -> Bool #
(/=) :: ArrayException -> ArrayException -> Bool #
Instance details
Defined in GHC.IO.Exception
Methods
(==) :: AsyncException -> AsyncException -> Bool #
(/=) :: AsyncException -> AsyncException -> Bool #
Instance details
Defined in GHC.Conc.Sync
Methods
(==) :: ThreadStatus -> ThreadStatus -> Bool #
(/=) :: ThreadStatus -> ThreadStatus -> Bool #
Instance details
Defined in GHC.Conc.Sync
Instance details
Defined in GHC.Event.TimerManager
Instance details
Defined in GHC.IO.Handle
Instance details
Defined in GHC.Exts
Methods
(==) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool #
(/=) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool #
Instance details
Defined in GHC.ForeignPtr
Methods
(==) :: ForeignPtr a -> ForeignPtr a -> Bool #
(/=) :: ForeignPtr a -> ForeignPtr a -> Bool #
Instance details
Defined in GHC.StableName
Methods
(==) :: StableName a -> StableName a -> Bool #
(/=) :: StableName a -> StableName a -> Bool #
Instance details
Defined in Data.Semigroup
Methods
(==) :: WrappedMonoid m -> WrappedMonoid m -> Bool #
(/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool #