Haskell Hierarchical Libraries (collections package)ContentsIndex
Data.Trie.String.Push
Portabilityportable
Stabilityprovisional
Maintainerhttp://homepages.nildram.co.uk/~ahey/em.png
Contents
Simple Pushes.
General Pushes.
Description
Pushing utilities for StringMap.
Synopsis
push :: String -> a -> StringMap a -> StringMap a
pushWith :: (a -> a -> a) -> String -> a -> StringMap a -> StringMap a
pushWith' :: (a -> a -> a) -> String -> a -> StringMap a -> StringMap a
genPush :: (a -> a) -> String -> a -> StringMap a -> StringMap a
genPush' :: (a -> a) -> String -> a -> StringMap a -> StringMap a
Simple Pushes.
push :: String -> a -> StringMap a -> StringMap a
Search a StringMap for the supplied String and (if found) overwrite the existing value associated with that String with the new value supplied. Otherwise add the String and new value as a new association pair. Note that this function does not force evaluation of new value. If you want this you must do it in your own code.
pushWith :: (a -> a -> a) -> String -> a -> StringMap a -> StringMap a

Push the new String value association into the StringMap, using the supplied combining function to lazily combine any existing value associated with the string with the new value. In such cases the application order is..

 combined = f new old

This function does not force evaluation of the new value. See pushWith' for a stricter version.

pushWith' :: (a -> a -> a) -> String -> a -> StringMap a -> StringMap a
This is the strict version of pushWith. If the search succeeds the combining function is applied strictly. If it fails evaluation of the new value is forced (but not otherwise because it is discarded if the search succeeds).
General Pushes.
genPush :: (a -> a) -> String -> a -> StringMap a -> StringMap a
Search a StringMap for the supplied string and (if found) lazily update the associated value with the supplied function. If the supplied string does not already have an associated value then the supplied new value is added. Note that this function does not force evaluation of either updated or new values. See genPush' for a stricter version.
genPush' :: (a -> a) -> String -> a -> StringMap a -> StringMap a
This is the strict version of genPush. It applies the update function strictly if the StringMap already has a value associated with the supplied string. It also forces evaluation of the new value if the search fails, but not otherwise (because it is discarded if the search succeeds).
Produced by Haddock version 0.7