Data.Unique (original) (raw)

Unique objects

data Unique Source

An abstract unique object. Objects of type [Unique](Data-Unique.html#t:Unique) may be compared for equality and ordering and hashed into [Int](Data-Int.html#t:Int).

Instances

| Eq Unique | | | -------------------------------------------------------------------------------------- | | | Ord Unique | | | Typeable Unique | |

newUnique :: IO UniqueSource

Creates a new object of type [Unique](Data-Unique.html#t:Unique). The value returned will not compare equal to any other value of type [Unique](Data-Unique.html#t:Unique) returned by previous calls to [newUnique](Data-Unique.html#v:newUnique). There is no limit on the number of times [newUnique](Data-Unique.html#v:newUnique) may be called.

hashUnique :: Unique -> IntSource

Hashes a [Unique](Data-Unique.html#t:Unique) into an [Int](Data-Int.html#t:Int). Two [Unique](Data-Unique.html#t:Unique)s may hash to the same value, although in practice this is unlikely. The [Int](Data-Int.html#t:Int) returned makes a good hash key.