| MissingH-1.1.0.3: Large utility library | Source code | Contents | Index

Data.Map.Utils

Portability | portable
Stability | provisional
Maintainer | John Goerzen <jgoerzen@complete.org>

Contents

Basic Utilities
Conversions

Description
This module provides various helpful utilities for dealing with Data.Maps. Written by John Goerzen, jgoerzen@complete.org
Synopsis

flipM :: (Ord key, Ord val) => Map key val -> Map val [key]
flippedLookupM :: (Ord val, Ord key) => val -> Map key val -> [key]
forceLookupM :: (Show key, Ord key) => String -> key -> Map key elt -> elt
strToM :: (Read a, Read b, Ord a) => String -> Map a b
strFromM :: (Show a, Show b, Ord a) => Map a b -> String

Basic Utilities

flipM :: (Ord key, Ord val) => Map key val -> Map val [key] | Source

Flips a Map. See `flipAL` for more on the similar function for lists.

flippedLookupM :: (Ord val, Ord key) => val -> Map key val -> [key] | Source

Returns a list of all keys in the Map whose value matches the parameter. If the value does not occur in the Map, the empty list is returned.

forceLookupM :: (Show key, Ord key) => String -> key -> Map key elt -> elt | Source

Performs a lookup, and raises an exception (with an error message prepended with the given string) if the key could not be found.
Conversions

strToM :: (Read a, Read b, Ord a) => String -> Map a b | Source

Converts a String into a String, String Map. See `strToAL` for more on the similar function for association lists.

This implementation is simple:

    strToM = Data.Map.fromList . strToAL

This function is designed to work with Map String String objects, but may work with other key/value combinations if they have simple representations.

strFromM :: (Show a, Show b, Ord a) => Map a b -> String | Source

Converts a String, String Map into a string representation. See `strFromAL` for more on the similar function for association lists. This implementation is simple:

    strFromM = strFromAL . Data.Map.toList

This function is designed to work with Map String String objects, but may also work with other objects with simple representations.

Produced by Haddock version 2.4.2