Data.Eq
Copyright | (c) The University of Glasgow 2005 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | [email protected] |
Stability | stable |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Description
Equality
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:
- Reflexivity
-
x == x
=True
- Symmetry
-
x == y
=y == x
- Transitivity
- if
x == y && y == z
=True
, thenx == z
=True
- Substitutivity
- if
x == y
=True
andf
is a "public" function whose return type is an instance ofEq
, thenf x == f y
=True
- Negation
-
x /= y
=not (x == y)
Minimal complete definition: either ==
or /=
.
Instances
Eq Bool | |
Eq Char | |
Eq Double |
Note that due to the presence of >>> 0/0 == (0/0 :: Double) False Also note that >>> 0 == (-0 :: Double) True >>> recip 0 == recip (-0 :: Double) False |
Eq Float |
Note that due to the presence of >>> 0/0 == (0/0 :: Float) False Also note that >>> 0 == (-0 :: Float) True >>> recip 0 == recip (-0 :: Float) False |
Eq Int | |
Eq Int8 | Since: base-2.1 |
Eq Int16 | Since: base-2.1 |
Eq Int32 | Since: base-2.1 |
Eq Int64 | Since: base-2.1 |
Eq Integer | |
Eq Natural | Since: base-4.8.0.0 |
Eq Ordering | |
Eq Word | |
Eq Word8 | Since: base-2.1 |
Eq Word16 | Since: base-2.1 |
Eq Word32 | Since: base-2.1 |
Eq Word64 | Since: base-2.1 |
Eq SomeTypeRep | |
Defined in Data.Typeable.Internal Methods(==) :: SomeTypeRep -> SomeTypeRep -> Bool Source (/=) :: SomeTypeRep -> SomeTypeRep -> Bool Source | |
Eq () | |
Eq TyCon | |
Eq Module | |
Eq TrName | |
Eq BigNat | |
Eq SrcLoc | Since: base-4.9.0.0 |
Eq GeneralCategory | Since: base-2.1 |
Defined in GHC.Unicode Methods(==) :: GeneralCategory -> GeneralCategory -> Bool Source (/=) :: GeneralCategory -> GeneralCategory -> Bool Source | |
Eq Number | Since: base-4.6.0.0 |
Eq Lexeme | Since: base-2.1 |
Eq Fingerprint | Since: base-4.4.0.0 |
Defined in GHC.Fingerprint.Type Methods(==) :: Fingerprint -> Fingerprint -> Bool Source (/=) :: Fingerprint -> Fingerprint -> Bool Source | |
Eq IOMode | Since: base-4.2.0.0 |
Eq IntPtr | |
Eq WordPtr | |
Eq CUIntMax | |
Eq CIntMax | |
Eq CUIntPtr | |
Eq CIntPtr | |
Eq CSUSeconds | |
Defined in Foreign.C.Types Methods(==) :: CSUSeconds -> CSUSeconds -> Bool Source (/=) :: CSUSeconds -> CSUSeconds -> Bool Source | |
Eq CUSeconds | |
Eq CTime | |
Eq CClock | |
Eq CSigAtomic | |
Defined in Foreign.C.Types Methods(==) :: CSigAtomic -> CSigAtomic -> Bool Source (/=) :: CSigAtomic -> CSigAtomic -> Bool Source | |
Eq CWchar | |
Eq CSize | |
Eq CPtrdiff | |
Eq CDouble | |
Eq CFloat | |
Eq CBool | |
Eq CULLong | |
Eq CLLong | |
Eq CULong | |
Eq CLong | |
Eq CUInt | |
Eq CInt | |
Eq CUShort | |
Eq CShort | |
Eq CUChar | |
Eq CSChar | |
Eq CChar | |
Eq SomeNat | Since: base-4.7.0.0 |
Eq SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits Methods(==) :: SomeSymbol -> SomeSymbol -> Bool Source (/=) :: SomeSymbol -> SomeSymbol -> Bool Source | |
Eq DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods(==) :: DecidedStrictness -> DecidedStrictness -> Bool Source (/=) :: DecidedStrictness -> DecidedStrictness -> Bool Source | |
Eq SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods(==) :: SourceStrictness -> SourceStrictness -> Bool Source (/=) :: SourceStrictness -> SourceStrictness -> Bool Source | |
Eq SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods(==) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source | |
Eq Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics Methods(==) :: Associativity -> Associativity -> Bool Source (/=) :: Associativity -> Associativity -> Bool Source | |
Eq Fixity | Since: base-4.6.0.0 |
Eq Any | Since: base-2.1 |
Eq All | Since: base-2.1 |
Eq ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods(==) :: ArithException -> ArithException -> Bool Source (/=) :: ArithException -> ArithException -> Bool Source | |
Eq ErrorCall | Since: base-4.7.0.0 |
Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods(==) :: IOException -> IOException -> Bool Source (/=) :: IOException -> IOException -> Bool Source | |
Eq MaskingState | Since: base-4.3.0.0 |
Defined in GHC.IO Methods(==) :: MaskingState -> MaskingState -> Bool Source (/=) :: MaskingState -> MaskingState -> Bool Source | |
Eq BufferState | Since: base-4.2.0.0 |
Defined in GHC.IO.Buffer Methods(==) :: BufferState -> BufferState -> Bool Source (/=) :: BufferState -> BufferState -> Bool Source | |
Eq CodingProgress | Since: base-4.4.0.0 |
Defined in GHC.IO.Encoding.Types Methods(==) :: CodingProgress -> CodingProgress -> Bool Source (/=) :: CodingProgress -> CodingProgress -> Bool Source | |
Eq SeekMode | Since: base-4.2.0.0 |
Eq IODeviceType | Since: base-4.2.0.0 |
Defined in GHC.IO.Device Methods(==) :: IODeviceType -> IODeviceType -> Bool Source (/=) :: IODeviceType -> IODeviceType -> Bool Source | |
Eq NewlineMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types Methods(==) :: NewlineMode -> NewlineMode -> Bool Source (/=) :: NewlineMode -> NewlineMode -> Bool Source | |
Eq Newline | Since: base-4.2.0.0 |
Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types Methods(==) :: BufferMode -> BufferMode -> Bool Source (/=) :: BufferMode -> BufferMode -> Bool Source | |
Eq Handle | Since: base-4.1.0.0 |
Eq IOErrorType | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception Methods(==) :: IOErrorType -> IOErrorType -> Bool Source (/=) :: IOErrorType -> IOErrorType -> Bool Source | |
Eq ExitCode | |
Eq ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods(==) :: ArrayException -> ArrayException -> Bool Source (/=) :: ArrayException -> ArrayException -> Bool Source | |
Eq AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods(==) :: AsyncException -> AsyncException -> Bool Source (/=) :: AsyncException -> AsyncException -> Bool Source | |
Eq Errno | Since: base-2.1 |
Eq Fd | |
Eq CNfds | |
Eq CSocklen | |
Eq CTimer | |
Eq CKey | |
Eq CId | |
Eq CFsFilCnt | |
Eq CFsBlkCnt | |
Eq CClockId | |
Eq CBlkCnt | |
Eq CBlkSize | |
Eq CRLim | |
Eq CTcflag | |
Eq CSpeed | |
Eq CCc | |
Eq CUid | |
Eq CNlink | |
Eq CGid | |
Eq CSsize | |
Eq CPid | |
Eq COff | |
Eq CMode | |
Eq CIno | |
Eq CDev | |
Eq Lifetime | Since: base-4.8.1.0 |
Eq Event | Since: base-4.4.0.0 |
Eq ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync Methods(==) :: ThreadStatus -> ThreadStatus -> Bool Source (/=) :: ThreadStatus -> ThreadStatus -> Bool Source | |
Eq BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync Methods(==) :: BlockReason -> BlockReason -> Bool Source (/=) :: BlockReason -> BlockReason -> Bool Source | |
Eq ThreadId | Since: base-4.2.0.0 |
Eq TimeoutKey | Since: base-4.7.0.0 |
Defined in GHC.Event.TimerManager Methods(==) :: TimeoutKey -> TimeoutKey -> Bool Source (/=) :: TimeoutKey -> TimeoutKey -> Bool Source | |
Eq FdKey | Since: base-4.4.0.0 |
Eq HandlePosn | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle Methods(==) :: HandlePosn -> HandlePosn -> Bool Source (/=) :: HandlePosn -> HandlePosn -> Bool Source | |
Eq Version | Since: base-2.1 |
Eq ByteOrder | Since: base-4.11.0.0 |
Eq Unique | |
Eq Timeout | |
Eq Fixity | Since: base-4.0.0.0 |
Eq ConstrRep | Since: base-4.0.0.0 |
Eq DataRep | Since: base-4.0.0.0 |
Eq Constr |
Equality of constructors Since: base-4.0.0.0 |
Eq SpecConstrAnnotation | Since: base-4.3.0.0 |
Defined in GHC.Exts Methods(==) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool Source (/=) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool Source | |
Eq Void | Since: base-4.8.0.0 |
Eq a => Eq [a] | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Eq a => Eq (Ratio a) | Since: base-2.1 |
Eq (StablePtr a) | Since: base-2.1 |
Eq (Ptr a) | Since: base-2.1 |
Eq (FunPtr a) | |
Eq p => Eq (Par1 p) | Since: base-4.7.0.0 |
Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0 |
Eq (MVar a) | Since: base-4.1.0.0 |
Eq a => Eq (Down a) | Since: base-4.6.0.0 |
Eq a => Eq (Product a) | Since: base-2.1 |
Eq a => Eq (Sum a) | Since: base-2.1 |
Eq a => Eq (Dual a) | Since: base-2.1 |
Eq a => Eq (Last a) | Since: base-2.1 |
Eq a => Eq (First a) | Since: base-2.1 |
Eq (IORef a) |
Pointer equality. Since: base-4.0.0.0 |
Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr Methods(==) :: ForeignPtr a -> ForeignPtr a -> Bool Source (/=) :: ForeignPtr a -> ForeignPtr a -> Bool Source | |
Eq (TVar a) | Since: base-4.8.0.0 |
Eq a => Eq (Identity a) | Since: base-4.8.0.0 |
Eq a => Eq (ZipList a) | Since: base-4.7.0.0 |
Eq (StableName a) | Since: base-2.1 |
Defined in GHC.StableName Methods(==) :: StableName a -> StableName a -> Bool Source (/=) :: StableName a -> StableName a -> Bool Source | |
Eq (Chan a) | Since: base-4.4.0.0 |
Eq a => Eq (Option a) | Since: base-4.9.0.0 |
Eq m => Eq (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods(==) :: WrappedMonoid m -> WrappedMonoid m -> Bool Source (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool Source | |
Eq a => Eq (Last a) | Since: base-4.9.0.0 |
Eq a => Eq (First a) | Since: base-4.9.0.0 |
Eq a => Eq (Max a) | Since: base-4.9.0.0 |
Eq a => Eq (Min a) | Since: base-4.9.0.0 |
Eq a => Eq (Complex a) | Since: base-2.1 |
(Eq a, Eq b) => Eq (Either a b) | Since: base-2.1 |
Eq (V1 p) | Since: base-4.9.0.0 |
Eq (U1 p) | Since: base-4.9.0.0 |
Eq (TypeRep a) | Since: base-2.1 |
(Eq a, Eq b) => Eq (a, b) | |
Eq (STRef s a) |
Pointer equality. Since: base-2.1 |
(Ix i, Eq e) => Eq (Array i e) | Since: base-2.1 |
Eq (Proxy s) | Since: base-4.7.0.0 |
Eq (IOArray i e) | Since: base-4.1.0.0 |
Eq a => Eq (Arg a b) | Since: base-4.9.0.0 |
Eq (Fixed a) | Since: base-2.1 |
Eq (f p) => Eq (Rec1 f p) | Since: base-4.7.0.0 |
Eq (URec Word p) | Since: base-4.9.0.0 |
Eq (URec Int p) | Since: base-4.9.0.0 |
Eq (URec Float p) | |
Eq (URec Double p) | Since: base-4.9.0.0 |
Eq (URec Char p) | Since: base-4.9.0.0 |
Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 |
(Eq a, Eq b, Eq c) => Eq (a, b, c) | |
Eq (STArray s i e) | Since: base-2.1 |
Eq (a :~: b) | Since: base-4.7.0.0 |
Eq (Coercion a b) | Since: base-4.7.0.0 |
Eq (f a) => Eq (Alt f a) | Since: base-4.8.0.0 |
Eq (f a) => Eq (Ap f a) | Since: base-4.12.0.0 |
Eq a => Eq (Const a b) | Since: base-4.9.0.0 |
Eq c => Eq (K1 i c p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
Eq (a :~~: b) | Since: base-4.10.0.0 |
(Eq1 f, Eq1 g, Eq a) => Eq (Sum f g a) | Since: base-4.9.0.0 |
(Eq1 f, Eq1 g, Eq a) => Eq (Product f g a) | Since: base-4.9.0.0 |
Eq (f p) => Eq (M1 i c f p) | Since: base-4.7.0.0 |
Eq (f (g p)) => Eq ((f :.: g) p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
(Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) | Since: base-4.9.0.0 |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | |
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.10.2/docs/html/libraries/base-4.14.1.0/Data-Eq.html