intern-0.9.1.4: Efficient hash-consing for arbitrary data types

Safe Haskell | None
Language | Haskell98

Data.Interned.Internal

# Documentation

class (Eq (Description t), Hashable (Description t)) => Interned t where Source

Minimal complete definition

describe, identify, cache

Associated Types

data Description t Source

type Uninterned t Source

Methods

describe :: Uninterned t -> Description t Source

identify :: Id -> Uninterned t -> t Source

seedIdentity :: p t -> Id Source

cacheWidth :: p t -> Int Source

modifyAdvice :: IO t -> IO t Source

cache :: Cache t Source

Instances

Interned IntSet Source |
Interned InternedByteString Source |
Interned InternedString Source |
Interned InternedText Source |

class Interned t => Uninternable t where Source

Methods

unintern :: t -> Uninterned t Source

Instances

Uninternable IntSet Source |
Uninternable InternedByteString Source |
Uninternable InternedString Source |
Uninternable InternedText Source |

mkCache :: Interned t => Cache t Source

newtype Cache t Source

Constructors

Cache |

Fields

getCache :: Array Int (IORef (CacheState t))

data CacheState t Source

Constructors

CacheState |

Fields

fresh :: !Id
content :: !(HashMap (Description t) t)

cacheSize :: Cache t -> IO Int Source

type Id = Int Source

intern :: Interned t => Uninterned t -> t Source

recover :: Interned t => Description t -> IO (Maybe t) Source