witness-0.6.2: values that witness types
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Type.Witness.Specific.WitnessMap.For

Synopsis

Documentation

newtype WitnessMapFor f 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

MkWitnessMapFor 

Fields

Instances

Instances details
Monoid (WitnessMapFor f w) Source # 
Instance details

Defined in Data.Type.Witness.Specific.WitnessMap.For

Semigroup (WitnessMapFor f w) Source # 
Instance details

Defined in Data.Type.Witness.Specific.WitnessMap.For

emptyWitnessMapFor :: WitnessMapFor f w Source #

An empty dictionary.

witnessMapForLookup :: TestEquality w => w a -> WitnessMapFor f w -> Maybe (f a) Source #

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

witnessMapForModify :: TestEquality w => w a -> (f a -> f a) -> WitnessMapFor f w -> WitnessMapFor f w Source #

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

witnessMapForReplace :: TestEquality w => w a -> f a -> WitnessMapFor f w -> WitnessMapFor f w Source #

Replace the first value in the dictionary that matches the witness

witnessMapForAdd :: w a -> f a -> WitnessMapFor f w -> WitnessMapFor f w Source #

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

witnessMapForSingle :: w a -> f a -> WitnessMapFor f w Source #

A dictionary for a single witness and value

witnessMapForFold :: Monoid m => WitnessMapFor f w -> (forall a. w a -> f a -> m) -> m Source #

witnessMapForRemove :: TestEquality w => w a -> WitnessMapFor f w -> WitnessMapFor f w Source #

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

witnessMapForFromList :: [SomeFor f w] -> WitnessMapFor f w Source #

Create a dictionary from a list of witness/value pairs

witnessMapForMapM :: Applicative m => (forall a. f a -> m (g a)) -> WitnessMapFor f w -> m (WitnessMapFor g w) Source #