identifiers-0.4.1.0: Numeric identifiers for values.

Safe HaskellNone
LanguageHaskell2010

Data.Identifiers.ListLike

Contents

Synopsis

Documentation

data Identifiers i n u Source #

Instances

(Eq n, Eq i, Eq u) => Eq (Identifiers i n u) Source # 

Methods

(==) :: Identifiers i n u -> Identifiers i n u -> Bool #

(/=) :: Identifiers i n u -> Identifiers i n u -> Bool #

Show n => Show (Identifiers i n u) Source # 

Methods

showsPrec :: Int -> Identifiers i n u -> ShowS #

show :: Identifiers i n u -> String #

showList :: [Identifiers i n u] -> ShowS #

(Binary n, ListLike n u, Integral i, Eq u) => Binary (Identifiers i n u) Source # 

Methods

put :: Identifiers i n u -> Put #

get :: Get (Identifiers i n u) #

putList :: [Identifiers i n u] -> Put #

(Serialize n, ListLike n u, Integral i, Eq u) => Serialize (Identifiers i n u) Source # 

Methods

put :: Putter (Identifiers i n u) #

get :: Get (Identifiers i n u) #

(NFData i, NFData n, NFData u) => NFData (Identifiers i n u) Source # 

Methods

rnf :: Identifiers i n u -> () #

Construction

empty :: Identifiers i n u Source #

The empty Identifiers

fromList :: (ListLike n u, Eq u, Integral i) => [n] -> Identifiers i n u Source #

New Identifiers from list

Insertion

insert :: (ListLike n u, Eq u, Integral i) => Identifiers i n u -> n -> Identifiers i n u Source #

Insert item into set (given it a new id)

insertMany :: (ListLike n u, Eq u, Integral i) => Identifiers i n u -> [n] -> Identifiers i n u Source #

Insert many items into set

Info

Extraction

toList :: Identifiers i n u -> [n] Source #

New List from Identifiers

Lookups

lookupId :: (Eq u, ListLike n u) => Identifiers i n u -> n -> Maybe i Source #

Find id for given key

lookupKey :: Integral i => Identifiers i n u -> i -> Maybe n Source #

Find key for given id

lookupKeys :: Integral i => Identifiers i n u -> [i] -> [n] Source #

Given many ids, return many keys

unsafeLookupId :: (ListLike n u, Eq u) => Identifiers i n u -> n -> i Source #

unsafeLookupKey :: Integral i => Identifiers i n u -> i -> n Source #

(!) :: Integral i => Identifiers i n u -> i -> n Source #

Properties

prop_hasId :: String -> Bool Source #

Items inserted are given ids

prop_stableId :: String -> Bool Source #

Inserted items have stable ids

prop_keyRetrieval :: [String] -> Bool Source #

Given id can be used to fetch inserted item

prop_keyRetrievalUnsafe :: [String] -> Bool Source #

Given id can be used to fetch inserted item

prop_idempotent :: String -> Bool Source #

Inserting something more than once does not change the set