hash-cons-0.2.0.0: Opportunistic hash-consing data structure
Safe HaskellNone
LanguageHaskell2010

Data.HashCons.Internal

Synopsis

Documentation

data HashCons a Source #

HashCons with a precomputed hash and an IORef to the value.

WARNING: Do not use this type to wrap types whose Eq or Ord instances allow distinguishable values to compare as equal; this will result in nondeterminism or even visible mutation of semantically-immutable values at runtime.

Constructors

HashConsC 

Fields

Instances

Instances details
(Read a, Hashable a) => Read (HashCons a) Source #

Read instance that parses HashCons from the format "hashCons x"

Instance details

Defined in Data.HashCons.Internal

Show a => Show (HashCons a) Source #

Show instance that displays HashCons in the format "hashCons x"

Instance details

Defined in Data.HashCons.Internal

Methods

showsPrec :: Int -> HashCons a -> ShowS #

show :: HashCons a -> String #

showList :: [HashCons a] -> ShowS #

Eq a => Eq (HashCons a) Source # 
Instance details

Defined in Data.HashCons.Internal

Methods

(==) :: HashCons a -> HashCons a -> Bool #

(/=) :: HashCons a -> HashCons a -> Bool #

Ord a => Ord (HashCons a) Source #

NOTE: This instance orders by hash first, and only secondarily by the Ord instance of a, to improve performance.

Instance details

Defined in Data.HashCons.Internal

Methods

compare :: HashCons a -> HashCons a -> Ordering #

(<) :: HashCons a -> HashCons a -> Bool #

(<=) :: HashCons a -> HashCons a -> Bool #

(>) :: HashCons a -> HashCons a -> Bool #

(>=) :: HashCons a -> HashCons a -> Bool #

max :: HashCons a -> HashCons a -> HashCons a #

min :: HashCons a -> HashCons a -> HashCons a #

Eq a => Hashable (HashCons a) Source # 
Instance details

Defined in Data.HashCons.Internal

Methods

hashWithSalt :: Int -> HashCons a -> Int #

hash :: HashCons a -> Int #

pattern HashCons :: Hashable a => a -> HashCons a Source #

hashCons :: Hashable a => a -> HashCons a Source #

Create a new HashCons.

unHashCons :: HashCons a -> a Source #

Extract the value from a HashCons.

compareAndSubstitute :: Eq r => (a -> a -> r) -> r -> IORef a -> IORef a -> r Source #