witness-0.3.0.1: values that witness types

Safe HaskellNone
LanguageHaskell98

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 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 :: TestEquality w => [Any w] -> WitnessDict w Source

Create a dictionary from a list of witness/value pairs