Data.Unique.Really

vault-0.3.0.6: a persistent store for values of arbitrary types

Safe Haskell | Safe
Language | Haskell98

Data.Unique.Really

Description

An abstract interface to a unique symbol generator.

Synopsis

- data Unique
- newUnique :: IO Unique
- hashUnique :: Unique -> Int

# Documentation

data Unique #

An abstract unique value. Values of type `Unique` may be compared for equality and hashed into Int.

Note: Unlike the symbols from Data.Unique, the symbols from this module do not become equal after reloads in the GHC interpreter!

Instances

Eq Unique # |
Methods (==) :: Unique -> Unique -> Bool # (/=) :: Unique -> Unique -> Bool #
Hashable Unique # |
Methods hashWithSalt :: Int -> Unique -> Int # hash :: Unique -> Int #

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 you may call this function.

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.