witness-0.2: values that witness types

Data.Witness.WitnessDict

Synopsis

Documentation

newtype WitnessDict w 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

MkWitnessDict [Any w] 

emptyWitnessDict :: WitnessDict wSource

An empty dictionary.

witnessDictLookup :: SimpleWitness w => w a -> WitnessDict w -> Maybe aSource

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

witnessDictModify :: SimpleWitness w => w a -> (a -> a) -> WitnessDict w -> WitnessDict wSource

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

witnessDictReplace :: SimpleWitness w => w a -> a -> WitnessDict w -> WitnessDict wSource

Replace the first value in the dictionary that matches the witness

witnessDictAdd :: w a -> a -> WitnessDict w -> WitnessDict wSource

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

witnessDictRemove :: SimpleWitness w => w a -> WitnessDict w -> WitnessDict wSource

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

witnessDictFromList :: SimpleWitness w => [Any w] -> WitnessDict wSource

Create a dictionary from a list of witness/value pairs