Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- newtype WitnessDict w = MkWitnessDict [Any w]
- emptyWitnessDict :: WitnessDict w
- witnessDictLookup :: TestEquality w => w a -> WitnessDict w -> Maybe a
- witnessDictModify :: TestEquality w => w a -> (a -> a) -> WitnessDict w -> WitnessDict w
- witnessDictReplace :: TestEquality w => w a -> a -> WitnessDict w -> WitnessDict w
- witnessDictAdd :: w a -> a -> WitnessDict w -> WitnessDict w
- witnessDictRemove :: TestEquality w => w a -> WitnessDict w -> WitnessDict w
- witnessDictFromList :: [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 w Source #
An empty dictionary.
witnessDictLookup :: TestEquality w => w a -> WitnessDict w -> Maybe a Source #
Look up the first value in the dictionary that matches the given witness.
witnessDictModify :: TestEquality w => w a -> (a -> a) -> WitnessDict w -> WitnessDict w Source #
Modify the first value in the dictionary that matches a particular witness.
witnessDictReplace :: TestEquality w => w a -> a -> WitnessDict w -> WitnessDict w Source #
Replace the first value in the dictionary that matches the witness
witnessDictAdd :: w a -> a -> WitnessDict w -> WitnessDict w Source #
Add a witness and value as the first entry in the dictionary.
witnessDictRemove :: TestEquality w => w a -> WitnessDict w -> WitnessDict w Source #
Remove the first entry in the dictionary that matches the given witness.
witnessDictFromList :: [Any w] -> WitnessDict w Source #
Create a dictionary from a list of witness/value pairs