effet-0.4.0.0: An Effect System based on Type Classes

Control.Effect.Map.Strict

Description

Strict interpretations of the Map' effect.

If you don't require disambiguation of multiple map effects (i.e., you only have one map effect in your monadic context), you usually need the untagged interpretations.

Synopsis

# Interpreter Implementation

data StrictMap k v m a Source #

The strict interpreter of the map effect. This type implements the Map' type class in a strict manner.

When interpreting the effect, you usually don't interact with this type directly, but instead use one of its corresponding interpretation functions.

#### Instances

Instances details

clear :: Monad m => StrictMap k v m () Source #

Deletes all key-value pairs from the map.

lookup :: (Monad m, Ord k) => k -> StrictMap k v m (Maybe v) Source #

Searches for a value that corresponds to a given key. Returns Nothing if the key cannot be found.

update :: (Monad m, Ord k) => k -> Maybe v -> StrictMap k v m () Source #

Updates the value that corresponds to a given key. Passing Nothing as the updated value removes the key-value pair from the map.

# Tagged Interpretations

Arguments

 :: forall tag k v m a. Monad m => (Map' tag k v Via StrictMap k v) m a The program whose map effect should be handled. -> m a The program with its map effect handled.

Runs the map effect, initialized with an empty map.

# Untagged Interpretations

runMap :: Monad m => (Map k v Via StrictMap k v) m a -> m a Source #

The untagged version of runMap'.