An abstract name for an object, that supports equality and hashing.
Stable names have the following property:
If
sn1 :: StableNameandsn2 :: StableNameandsn1 == sn2thensn1andsn2were created by calls tomakeStableNameon the same object.
The reverse is not necessarily true: if two stable names are not equal, then the objects they name may still be equal. Note in particular that makeStableName may return a different StableName after an object is evaluated.
Stable Names are similar to Stable Pointers (Foreign.StablePtr), but differ in the following ways:
There is no
freeStableNameoperation, unlike Foreign.StablePtrs. Stable names are reclaimed by the runtime system when they are no longer needed.There is no
deRefStableNameoperation. You can't get back from a stable name to the original Haskell object. The reason for this is that the existence of a stable name for an object does not guarantee the existence of the object itself; it can still be garbage collected.
Instances4NFData1, Eq, NFData, Hashable
NFData1 StableNameDefined in deepseq-1.5.0.0 · Control.DeepSeqEq (StableName a)Defined in ghc-internal-9.1003.0 · GHC.Internal.StableNameNFData (StableName a)Defined in deepseq-1.5.0.0 · Control.DeepSeqHashable (StableName a)Defined in hashable-1.4.7.0 · Data.Hashable.Class