| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Development.IDE.Graph.Classes
Documentation
Conversion of values to readable Strings.
Derived instances of Show have the following properties, which
are compatible with derived instances of Read:
- The result of
showis a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. - If the constructor is defined to be an infix operator, then
showsPrecwill produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
xis less thand(associativity is ignored). Thus, ifdis0then the result is never surrounded in parentheses; ifdis11it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
showwill produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Show is equivalent to
instance (Show a) => Show (Tree a) where
showsPrec d (Leaf m) = showParen (d > app_prec) $
showString "Leaf " . showsPrec (app_prec+1) m
where app_prec = 10
showsPrec d (u :^: v) = showParen (d > up_prec) $
showsPrec (up_prec+1) u .
showString " :^: " .
showsPrec (up_prec+1) v
where up_prec = 5Note that right-associativity of :^: is ignored. For example,
produces the stringshow(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
Methods
Arguments
| :: Int | the operator precedence of the enclosing
context (a number from |
| -> a | the value to be converted to a |
| -> ShowS |
Convert a value to a readable String.
showsPrec should satisfy the law
showsPrec d x r ++ s == showsPrec d x (r ++ s)
Derived instances of Read and Show satisfy the following:
That is, readsPrec parses the string produced by
showsPrec, and delivers the value that showsPrec started with.
Instances
The class Typeable allows a concrete representation of a type to
be calculated.
Minimal complete definition
typeRep#
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, instances are
encouraged to follow these properties:
Instances
| Eq Key | |
| Eq DotNetTime | |
Defined in Data.Aeson.Types.Internal | |
| Eq JSONPathElement | |
Defined in Data.Aeson.Types.Internal Methods (==) :: JSONPathElement -> JSONPathElement -> Bool # (/=) :: JSONPathElement -> JSONPathElement -> Bool # | |
| Eq SumEncoding | |
Defined in Data.Aeson.Types.Internal | |
| Eq Value | |
| Eq AsyncCancelled | |
Defined in Control.Concurrent.Async.Internal Methods (==) :: AsyncCancelled -> AsyncCancelled -> Bool # (/=) :: AsyncCancelled -> AsyncCancelled -> Bool # | |
| Eq ByteArray | Since: base-4.17.0.0 |
| Eq All | Since: base-2.1 |
| Eq Any | Since: base-2.1 |
| Eq SomeTypeRep | |
Defined in Data.Typeable.Internal | |
| Eq Version | Since: base-2.1 |
| Eq Void | Since: base-4.8.0.0 |
| Eq BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync | |
| Eq ThreadId | Since: base-4.2.0.0 |
| Eq ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync | |
| Eq ErrorCall | Since: base-4.7.0.0 |
| Eq ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods (==) :: ArithException -> ArithException -> Bool # (/=) :: ArithException -> ArithException -> Bool # | |
| Eq Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics Methods (==) :: Associativity -> Associativity -> Bool # (/=) :: Associativity -> Associativity -> Bool # | |
| Eq DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
| Eq Fixity | Since: base-4.6.0.0 |
| Eq SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
| Eq SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
| Eq MaskingState | Since: base-4.3.0.0 |
Defined in GHC.IO | |
| Eq ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods (==) :: ArrayException -> ArrayException -> Bool # (/=) :: ArrayException -> ArrayException -> Bool # | |
| Eq AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods (==) :: AsyncException -> AsyncException -> Bool # (/=) :: AsyncException -> AsyncException -> Bool # | |
| Eq ExitCode | |
| Eq IOErrorType | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception | |
| Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception | |
| Eq Int16 | Since: base-2.1 |
| Eq Int32 | Since: base-2.1 |
| Eq Int64 | Since: base-2.1 |
| Eq Int8 | Since: base-2.1 |
| Eq IoSubSystem | |
Defined in GHC.RTS.Flags | |
| Eq SrcLoc | Since: base-4.9.0.0 |
| Eq SomeChar | |
| Eq SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits | |
| Eq GeneralCategory | Since: base-2.1 |
Defined in GHC.Unicode Methods (==) :: GeneralCategory -> GeneralCategory -> Bool # (/=) :: GeneralCategory -> GeneralCategory -> Bool # | |
| Eq Word16 | Since: base-2.1 |
| Eq Word32 | Since: base-2.1 |
| Eq Word64 | Since: base-2.1 |
| Eq Word8 | Since: base-2.1 |
| Eq ByteString | |
Defined in Data.ByteString.Internal.Type | |
| Eq ByteString | |
Defined in Data.ByteString.Lazy.Internal | |
| Eq ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods (==) :: ShortByteString -> ShortByteString -> Bool # (/=) :: ShortByteString -> ShortByteString -> Bool # | |
| Eq Clock | |
| Eq TimeSpec | |
| Eq IntSet | |
| Eq Timeout | |
| Eq OsChar | Byte equality of the internal representation. |
| Eq OsString | Byte equality of the internal representation. |
| Eq PosixChar | |
| Eq PosixString | |
Defined in System.OsString.Internal.Types | |
| Eq WindowsChar | |
Defined in System.OsString.Internal.Types | |
| Eq WindowsString | |
Defined in System.OsString.Internal.Types Methods (==) :: WindowsString -> WindowsString -> Bool # (/=) :: WindowsString -> WindowsString -> Bool # | |
| Eq BigNat | |
| Eq ForeignSrcLang | |
Defined in GHC.ForeignSrcLang.Type Methods (==) :: ForeignSrcLang -> ForeignSrcLang -> Bool # (/=) :: ForeignSrcLang -> ForeignSrcLang -> Bool # | |
| Eq Extension | |
| Eq Module | |
| Eq Ordering | |
| Eq TrName | |
| Eq TyCon | |
| Eq Key Source # | |
| Eq KeySet Source # | |
| Eq KeyValue Source # | |
| Eq ResultDeps Source # | |
Defined in Development.IDE.Graph.Internal.Types | |
| Eq RunChanged Source # | |
Defined in Development.IDE.Graph.Internal.Types | |
| Eq RunMode Source # | |
| Eq Step Source # | |
| Eq Flot | |
| Eq URI | |
| Eq URIAuth | |
| Eq Mode | |
| Eq Style | |
| Eq TextDetails | |
Defined in Text.PrettyPrint.Annotated.HughesPJ | |
| Eq Doc | |
| Eq StdGen | |
| Eq Scientific | Scientific numbers can be safely compared for equality. No magnitude |
Defined in Data.Scientific | |
| Eq AnnLookup | |
| Eq AnnTarget | |
| Eq Bang | |
| Eq Body | |
| Eq Bytes | |
| Eq Callconv | |
| Eq Clause | |
| Eq Con | |
| Eq Dec | |
| Eq DecidedStrictness | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
| Eq DerivClause | |
Defined in Language.Haskell.TH.Syntax | |
| Eq DerivStrategy | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: DerivStrategy -> DerivStrategy -> Bool # (/=) :: DerivStrategy -> DerivStrategy -> Bool # | |
| Eq DocLoc | |
| Eq Exp | |
| Eq FamilyResultSig | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: FamilyResultSig -> FamilyResultSig -> Bool # (/=) :: FamilyResultSig -> FamilyResultSig -> Bool # | |
| Eq Fixity | |
| Eq FixityDirection | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: FixityDirection -> FixityDirection -> Bool # (/=) :: FixityDirection -> FixityDirection -> Bool # | |
| Eq Foreign | |
| Eq FunDep | |
| Eq Guard | |
| Eq Info | |
| Eq InjectivityAnn | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: InjectivityAnn -> InjectivityAnn -> Bool # (/=) :: InjectivityAnn -> InjectivityAnn -> Bool # | |
| Eq Inline | |
| Eq Lit | |
| Eq Loc | |
| Eq Match | |
| Eq ModName | |
| Eq Module | |
| Eq ModuleInfo | |
Defined in Language.Haskell.TH.Syntax | |
| Eq Name | |
| Eq NameFlavour | |
Defined in Language.Haskell.TH.Syntax | |
| Eq NameSpace | |
| Eq OccName | |
| Eq Overlap | |
| Eq Pat | |
| Eq PatSynArgs | |
Defined in Language.Haskell.TH.Syntax | |
| Eq PatSynDir | |
| Eq Phases | |
| Eq PkgName | |
| Eq Pragma | |
| Eq Range | |
| Eq Role | |
| Eq RuleBndr | |
| Eq RuleMatch | |
| Eq Safety | |
| Eq SourceStrictness | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
| Eq SourceUnpackedness | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
| Eq Specificity | |
Defined in Language.Haskell.TH.Syntax | |
| Eq Stmt | |
| Eq TyLit | |
| Eq TySynEqn | |
| Eq Type | |
| Eq TypeFamilyHead | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (/=) :: TypeFamilyHead -> TypeFamilyHead -> Bool # | |
| Eq B | |
| Eq ShortText | |
| Eq UTCTime | |
| Eq LocalTime | |
| Eq ConcException | |
Defined in UnliftIO.Internals.Async Methods (==) :: ConcException -> ConcException -> Bool # (/=) :: ConcException -> ConcException -> Bool # | |
| Eq UUID | |
| Eq UnpackedUUID | |
| Eq Integer | |
| Eq Natural | |
| Eq () | |
| Eq Bool | |
| Eq Char | |
| Eq Double | Note that due to the presence of
Also note that
|
| Eq Float | Note that due to the presence of
Also note that
|
| Eq Int | |
| Eq Word | |
| Eq (Encoding' a) | |
| Eq v => Eq (KeyMap v) | |
| Eq a => Eq (IResult a) | |
| Eq a => Eq (Result a) | |
| Eq (Async a) | |
| Eq a => Eq (ZipList a) | Since: base-4.7.0.0 |
| Eq (Chan a) | Since: base-4.4.0.0 |
| Eq (MutableByteArray s) | Since: base-4.17.0.0 |
Defined in Data.Array.Byte Methods (==) :: MutableByteArray s -> MutableByteArray s -> Bool # (/=) :: MutableByteArray s -> MutableByteArray s -> Bool # | |
| Eq a => Eq (Complex a) | Since: base-2.1 |
| Eq a => Eq (Identity a) | Since: base-4.8.0.0 |
| Eq a => Eq (First a) | Since: base-2.1 |
| Eq a => Eq (Last a) | Since: base-2.1 |
| Eq a => Eq (First a) | Since: base-4.9.0.0 |
| Eq a => Eq (Last 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 m => Eq (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods (==) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # | |
| Eq a => Eq (Dual a) | Since: base-2.1 |
| Eq a => Eq (Product a) | Since: base-2.1 |
| Eq a => Eq (Sum a) | Since: base-2.1 |
| Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0 |
| Eq (TVar a) | Since: base-4.8.0.0 |
| Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr | |
| Eq p => Eq (Par1 p) | Since: base-4.7.0.0 |
| Eq (IORef a) | Pointer equality. Since: base-4.0.0.0 |
| Eq (MVar a) | Since: base-4.1.0.0 |
| Eq a => Eq (Ratio a) | Since: base-2.1 |
| Eq a => Eq (IntMap a) | |
| Eq a => Eq (Seq a) | |
| Eq a => Eq (ViewL a) | |
| Eq a => Eq (ViewR a) | |
| Eq a => Eq (Intersection a) | |
Defined in Data.Set.Internal Methods (==) :: Intersection a -> Intersection a -> Bool # (/=) :: Intersection a -> Intersection a -> Bool # | |
| Eq a => Eq (Set a) | |
| Eq a => Eq (Tree a) | |
| Eq1 f => Eq (Fix f) | |
| (Functor f, Eq1 f) => Eq (Mu f) | |
| (Functor f, Eq1 f) => Eq (Nu f) | |
| Eq a => Eq (DNonEmpty a) | |
| Eq a => Eq (DList a) | |
| Eq a => Eq (Change a) | |
| Eq a => Eq (Hashed a) | Uses precomputed hash to detect inequality faster |
| Eq a => Eq (KeyMap a) Source # | |
| Eq a => Eq (AnnotDetails a) | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods (==) :: AnnotDetails a -> AnnotDetails a -> Bool # (/=) :: AnnotDetails a -> AnnotDetails a -> Bool # | |
| Eq (Doc a) | |
| Eq a => Eq (Span a) | |
| Eq a => Eq (Array a) | |
| (Eq a, Prim a) => Eq (PrimArray a) | Since: primitive-0.6.4.0 |
| Eq a => Eq (SmallArray a) | |
Defined in Data.Primitive.SmallArray | |
| Eq g => Eq (StateGen g) | |
| Eq g => Eq (AtomicGen g) | |
| Eq g => Eq (IOGen g) | |
| Eq g => Eq (STGen g) | |
| Eq g => Eq (TGen g) | |
| Eq (TBQueue a) | |
| Eq (TChan a) | |
| Eq (TMVar a) | |
| Eq (TQueue a) | |
| Eq a => Eq (Maybe a) | |
| Eq flag => Eq (TyVarBndr flag) | |
| Eq a => Eq (HashSet a) | Note that, in the presence of hash collisions, equal
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals. |
| Eq a => Eq (Vector a) | |
| (Prim a, Eq a) => Eq (Vector a) | |
| (Storable a, Eq a) => Eq (Vector a) | |
| Eq a => Eq (Maybe a) | Since: base-2.1 |
| Eq a => Eq (a) | |
| Eq a => Eq [a] | |
| (Eq a, Eq b) => Eq (Either a b) | Since: base-2.1 |
| Eq (Proxy s) | Since: base-4.7.0.0 |
| Eq a => Eq (Arg a b) | Since: base-4.9.0.0 |
| Eq (TypeRep a) | Since: base-2.1 |
| Eq (U1 p) | Since: base-4.9.0.0 |
| Eq (V1 p) | Since: base-4.9.0.0 |
| Eq (STRef s a) | Pointer equality. Since: base-2.1 |
| (Eq k, Eq a) => Eq (Map k a) | |
| Eq (m (Maybe (a, ListT m a))) => Eq (ListT m a) | |
| Eq (MutableArray s a) | |
Defined in Data.Primitive.Array Methods (==) :: MutableArray s a -> MutableArray s a -> Bool # (/=) :: MutableArray s a -> MutableArray s a -> Bool # | |
| Eq (MutablePrimArray s a) | |
Defined in Data.Primitive.PrimArray Methods (==) :: MutablePrimArray s a -> MutablePrimArray s a -> Bool # (/=) :: MutablePrimArray s a -> MutablePrimArray s a -> Bool # | |
| Eq (SmallMutableArray s a) | |
Defined in Data.Primitive.SmallArray Methods (==) :: SmallMutableArray s a -> SmallMutableArray s a -> Bool # (/=) :: SmallMutableArray s a -> SmallMutableArray s a -> Bool # | |
| (Eq a, PrimUnlifted a, unlifted_a ~ Unlifted a) => Eq (UnliftedArray_ unlifted_a a) | |
Defined in Data.Primitive.Unlifted.Array.ST Methods (==) :: UnliftedArray_ unlifted_a a -> UnliftedArray_ unlifted_a a -> Bool # (/=) :: UnliftedArray_ unlifted_a a -> UnliftedArray_ unlifted_a a -> Bool # | |
| Ix i => Eq (TArray i e) | |
| (Eq a, Eq b) => Eq (Product2 a b) | |
| (Eq a, Eq b) => Eq (Either a b) | |
| (Eq a, Eq b) => Eq (These a b) | |
| (Eq a, Eq b) => Eq (Pair a b) | |
| (Eq a, Eq b) => Eq (These a b) | |
| (Eq1 f, Eq a) => Eq (Lift f a) | |
| (Eq1 m, Eq a) => Eq (MaybeT m a) | |
| (Eq k, Eq v) => Eq (HashMap k v) | Note that, in the presence of hash collisions, equal
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals. |
| (Eq k, Eq v) => Eq (Leaf k v) | |
| (Eq a, Eq b) => Eq (a, b) | |
| Eq a => Eq (Const a b) | Since: base-4.9.0.0 |
| Eq (f a) => Eq (Ap f a) | Since: base-4.12.0.0 |
| Eq (f a) => Eq (Alt f a) | Since: base-4.8.0.0 |
| Eq (a :~: b) | Since: base-4.7.0.0 |
| Eq (OrderingI a b) | |
| (Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a) | Since: base-4.18.0.0 |
Defined in GHC.Generics Methods (==) :: Generically1 f a -> Generically1 f a -> Bool # (/=) :: Generically1 f a -> Generically1 f a -> Bool # | |
| Eq (f p) => Eq (Rec1 f p) | Since: base-4.7.0.0 |
| Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 |
| Eq (URec Char p) | Since: base-4.9.0.0 |
| Eq (URec Double p) | Since: base-4.9.0.0 |
| Eq (URec Float p) | |
| Eq (URec Int p) | Since: base-4.9.0.0 |
| Eq (URec Word p) | Since: base-4.9.0.0 |
| Eq (p a a) => Eq (Join p a) | |
| unlifted_a ~ Unlifted a => Eq (MutableUnliftedArray_ unlifted_a s a) | |
Defined in Data.Primitive.Unlifted.Array.ST Methods (==) :: MutableUnliftedArray_ unlifted_a s a -> MutableUnliftedArray_ unlifted_a s a -> Bool # (/=) :: MutableUnliftedArray_ unlifted_a s a -> MutableUnliftedArray_ unlifted_a s a -> Bool # | |
| Eq b => Eq (Tagged s b) | |
| (Eq (f a), Eq (g a), Eq a) => Eq (These1 f g a) | |
| (Eq1 f, Eq a) => Eq (Backwards f a) | |
| (Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) | |
| (Eq1 f, Eq a) => Eq (IdentityT f a) | |
| (Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) | |
| (Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) | |
| Eq a => Eq (Constant a b) | |
| (Eq1 f, Eq a) => Eq (Reverse f a) | |
| (Eq a, Eq b, Eq c) => Eq (a, b, c) | |
| (Eq (f a), Eq (g a)) => Eq (Product f g a) | Since: base-4.18.0.0 |
| (Eq (f a), Eq (g a)) => Eq (Sum f g a) | Since: base-4.18.0.0 |
| Eq (a :~~: b) | Since: base-4.10.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 c => Eq (K1 i c p) | Since: base-4.7.0.0 |
| (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
| Eq (f (g a)) => Eq (Compose f g a) | Since: base-4.18.0.0 |
| Eq (f (g p)) => Eq ((f :.: g) p) | Since: base-4.7.0.0 |
| Eq (f p) => Eq (M1 i c f p) | Since: base-4.7.0.0 |
| Eq (f a) => Eq (Clown f a b) | |
| Eq (p b a) => Eq (Flip p a b) | |
| Eq (g b) => Eq (Joker g a b) | |
| Eq (p a b) => Eq (WrappedBifunctor p a b) | |
Defined in Data.Bifunctor.Wrapped Methods (==) :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool # (/=) :: WrappedBifunctor p a b -> WrappedBifunctor p a b -> Bool # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
| (Eq (f a b), Eq (g a b)) => Eq (Product f g a b) | |
| (Eq (p a b), Eq (q a b)) => Eq (Sum p q a b) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) | |
| Eq (f (p a b)) => Eq (Tannen f p a b) | |
| (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 (p (f a) (g b)) => Eq (Biff p f g a b) | |
| (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) | |
class Eq a => Hashable a where #
The class of types that can be converted to a hash value.
Minimal implementation: hashWithSalt.
Note: the hash is not guaranteed to be stable across library versions, operating systems or architectures. For stable hashing use named hashes: SHA256, CRC32 etc.
If you are looking for Hashable instance in time package,
check time-compat
Minimal complete definition
Nothing
Methods
hashWithSalt :: Int -> a -> Int infixl 0 #
Return a hash value for the argument, using the given salt.
The general contract of hashWithSalt is:
- If two values are equal according to the
==method, then applying thehashWithSaltmethod on each of the two values must produce the same integer result if the same salt is used in each case. - It is not required that if two values are unequal
according to the
==method, then applying thehashWithSaltmethod on each of the two values must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal values may improve the performance of hashing-based data structures. - This method can be used to compute different hash values for
the same input by providing a different salt in each
application of the method. This implies that any instance
that defines
hashWithSaltmust make use of the salt in its implementation. hashWithSaltmay return negativeIntvalues.
Like hashWithSalt, but no salt is used. The default
implementation uses hashWithSalt with some default salt.
Instances might want to implement this method to provide a more
efficient implementation than the default implementation.
Instances
A class of types that can be fully evaluated.
Since: deepseq-1.1.0.0
Minimal complete definition
Nothing
Methods
rnf should reduce its argument to normal form (that is, fully
evaluate all sub-components), and then return ().
Generic NFData deriving
Starting with GHC 7.2, you can automatically derive instances
for types possessing a Generic instance.
Note: Generic1 can be auto-derived starting with GHC 7.4
{-# LANGUAGE DeriveGeneric #-}
import GHC.Generics (Generic, Generic1)
import Control.DeepSeq
data Foo a = Foo a String
deriving (Eq, Generic, Generic1)
instance NFData a => NFData (Foo a)
instance NFData1 Foo
data Colour = Red | Green | Blue
deriving Generic
instance NFData ColourStarting with GHC 7.10, the example above can be written more
concisely by enabling the new DeriveAnyClass extension:
{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}
import GHC.Generics (Generic)
import Control.DeepSeq
data Foo a = Foo a String
deriving (Eq, Generic, Generic1, NFData, NFData1)
data Colour = Red | Green | Blue
deriving (Generic, NFData)
Compatibility with previous deepseq versions
Prior to version 1.4.0.0, the default implementation of the rnf
method was defined as
rnfa =seqa ()
However, starting with deepseq-1.4.0.0, the default
implementation is based on DefaultSignatures allowing for
more accurate auto-derived NFData instances. If you need the
previously used exact default rnf method implementation
semantics, use
instance NFData Colour where rnf x = seq x ()
or alternatively
instance NFData Colour where rnf = rwhnf
or
{-# LANGUAGE BangPatterns #-}
instance NFData Colour where rnf !_ = ()