- newtype WitnessDict w = MkWitnessDict [Any w]
- emptyWitnessDict :: WitnessDict w
- witnessDictLookup :: SimpleWitness w => w a -> WitnessDict w -> Maybe a
- witnessDictModify :: SimpleWitness w => w a -> (a -> a) -> WitnessDict w -> WitnessDict w
- witnessDictReplace :: SimpleWitness w => w a -> a -> WitnessDict w -> WitnessDict w
- witnessDictAdd :: w a -> a -> WitnessDict w -> WitnessDict w
- witnessDictRemove :: SimpleWitness w => w a -> WitnessDict w -> WitnessDict w
- witnessDictFromList :: SimpleWitness w => [Any w] -> WitnessDict w
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.
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