| |||||||||
| |||||||||
| |||||||||
Description | |||||||||
This module provides various helpful utilities for dealing with FiniteMaps. Written by John Goerzen, jgoerzen@complete.org In addition to the functions exported, this module also makes a FiniteMap showable. | |||||||||
Synopsis | |||||||||
| |||||||||
Basic Utilities | |||||||||
flipFM :: (Ord key, Ord val) => FiniteMap key val -> FiniteMap val [key] | |||||||||
Flips a finite map. See flipAL for more on the similar function for lists. | |||||||||
flippedLookupFM :: (Ord val, Ord key) => FiniteMap key val -> val -> [key] | |||||||||
Returns a list of all keys in the finite map whose value matches the parameter. If the value does not occur in the finite map, the empty list is returned. | |||||||||
forceLookupFM :: (Show key, Ord key) => String -> FiniteMap key elt -> key -> elt | |||||||||
Performs a lookup, and raises an exception (with an error message prepended with the given string) if the key could not be found. | |||||||||
Conversions | |||||||||
strToFM :: (Read a, Read b, Ord a) => String -> FiniteMap a b | |||||||||
Converts a String into a String, String FiniteMap. See strToAL for more on the similar function for association lists. This implementation is simple: strToFM = listToFM . strToAL This function is designed to work with FiniteMap String String objects, but may work with other key/value combinations if they have simple representations. | |||||||||
strFromFM :: (Show a, Show b, Ord a) => FiniteMap a b -> String | |||||||||
Converts a String, String FiniteMap into a string representation. See strFromAL for more on the similar function for association lists. This implementation is simple: strFromFM = strFromAL . fmToList This function is designed to work with FiniteMap String String objects, but may also work with other objects with simple representations. | |||||||||
Produced by Haddock version 0.6 |