Module

Effect.StableName

Package
purescript-stablename
Repository
alexknvl/purescript-stablename

#StableName Source

data StableName :: Type -> Type

An abstract name for an object, that supports equality and hashing.

Stable names have the following property:

  • If @sn1 :: StableName@ and @sn2 :: StableName@ and @sn1 == sn2@ then @sn1@ and @sn2@ were created by calls to @makeStableName@ on 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.

Instances

#makeStableName Source

makeStableName :: forall a. a -> Effect (StableName a)

Makes a 'StableName' for an arbitrary object.

#eqStableName Source

eqStableName :: forall b a. StableName a -> StableName b -> Boolean

Equality on 'StableName' that does not require that the types of the arguments match.

#hashStableName Source

hashStableName :: forall a. StableName a -> Int

Convert a 'StableName' to an 'Int'. The 'Int' returned is not necessarily unique; several 'StableName's may map to the same 'Int' (in practice however, the chances of this are small, so the result of 'hashStableName' makes a good hash key).