witness-0.2: values that witness types

Data.Witness.WitnessFDict

Synopsis

Documentation

newtype WitnessFDict w f Source

A dictionary that is heterogenous up to its simple witness type w. Witnesses are the keys of the dictionary, and the values they witness are the values of the dictionary.

Constructors

MkWitnessFDict [AnyF w f] 

emptyWitnessFDict :: WitnessFDict w fSource

An empty dictionary.

witnessFDictLookup :: SimpleWitness w => w a -> WitnessFDict w f -> Maybe (f a)Source

Look up the first value in the dictionary that matches the given witness.

witnessFDictModify :: SimpleWitness w => w a -> (f a -> f a) -> WitnessFDict w f -> WitnessFDict w fSource

Modify the first value in the dictionary that matches a particular witness.

witnessFDictReplace :: SimpleWitness w => w a -> f a -> WitnessFDict w f -> WitnessFDict w fSource

Replace the first value in the dictionary that matches the witness

witnessFDictAdd :: w a -> f a -> WitnessFDict w f -> WitnessFDict w fSource

Add a witness and value as the first entry in the dictionary.

witnessFDictRemove :: SimpleWitness w => w a -> WitnessFDict w f -> WitnessFDict w fSource

Remove the first entry in the dictionary that matches the given witness.

witnessFDictFromList :: SimpleWitness w => [AnyF w f] -> WitnessFDict w fSource

Create a dictionary from a list of witness/value pairs