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

Safe Haskell | None
Language | Haskell2010

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

Instances details

Interned IntSet Source # |

Instance details

Defined in Data.Interned.IntSet

Associated Types

data Description IntSet Source #

type Uninterned IntSet Source #

Methods

describe :: Uninterned IntSet -> Description IntSet Source #

identify :: Id -> Uninterned IntSet -> IntSet Source #

seedIdentity :: p IntSet -> Id Source #

cacheWidth :: p IntSet -> Int Source #

modifyAdvice :: IO IntSet -> IO IntSet Source #

cache :: Cache IntSet Source #

Interned InternedByteString Source # |

Instance details

Defined in Data.Interned.Internal.ByteString

Associated Types

data Description InternedByteString Source #

type Uninterned InternedByteString Source #

Methods

describe :: Uninterned InternedByteString -> Description InternedByteString Source #

identify :: Id -> Uninterned InternedByteString -> InternedByteString Source #

seedIdentity :: p InternedByteString -> Id Source #

cacheWidth :: p InternedByteString -> Int Source #

modifyAdvice :: IO InternedByteString -> IO InternedByteString Source #

cache :: Cache InternedByteString Source #

Interned InternedString Source # |

Instance details

Defined in Data.Interned.Internal.String

Associated Types

data Description InternedString Source #

type Uninterned InternedString Source #

Methods

describe :: Uninterned InternedString -> Description InternedString Source #

identify :: Id -> Uninterned InternedString -> InternedString Source #

seedIdentity :: p InternedString -> Id Source #

cacheWidth :: p InternedString -> Int Source #

modifyAdvice :: IO InternedString -> IO InternedString Source #

cache :: Cache InternedString Source #

Interned InternedText Source # |

Instance details

Defined in Data.Interned.Internal.Text

Associated Types

data Description InternedText Source #

type Uninterned InternedText Source #

Methods

describe :: Uninterned InternedText -> Description InternedText Source #

identify :: Id -> Uninterned InternedText -> InternedText Source #

seedIdentity :: p InternedText -> Id Source #

cacheWidth :: p InternedText -> Int Source #

modifyAdvice :: IO InternedText -> IO InternedText Source #

cache :: Cache InternedText Source #

class Interned t => Uninternable t where Source #

Methods

unintern :: t -> Uninterned t Source #

#### Instances

Instances details

Uninternable IntSet Source # |
Instance details Defined in Data.Interned.IntSet Methods unintern :: IntSet -> Uninterned IntSet Source #
Uninternable InternedByteString Source # |
Instance details Defined in Data.Interned.Internal.ByteString Methods unintern :: InternedByteString -> Uninterned InternedByteString Source #
Uninternable InternedString Source # |
Instance details Defined in Data.Interned.Internal.String Methods unintern :: InternedString -> Uninterned InternedString Source #
Uninternable InternedText Source # |
Instance details Defined in Data.Interned.Internal.Text Methods unintern :: InternedText -> Uninterned 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 #