planet-mitchell-0.0.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

Unique

Synopsis

Documentation

data Unique #

An abstract unique object. Objects of type Unique may be compared for equality and ordering and hashed into Int.

>>> :{
do x <- newUnique
   print (x == x)
   y <- newUnique
   print (x == y)
:}
True
False
Instances
Eq Unique 
Instance details

Defined in Data.Unique

Methods

(==) :: Unique -> Unique -> Bool #

(/=) :: Unique -> Unique -> Bool #

Ord Unique 
Instance details

Defined in Data.Unique

Hashable Unique 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Unique -> Int #

hash :: Unique -> Int #

NFData Unique

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Unique -> () #

newUnique :: IO Unique #

Creates a new object of type Unique. The value returned will not compare equal to any other value of type Unique returned by previous calls to newUnique. There is no limit on the number of times newUnique may be called.

hashUnique :: Unique -> Int #

Hashes a Unique into an Int. Two Uniques may hash to the same value, although in practice this is unlikely. The Int returned makes a good hash key.