diff options
| author | peb <unknown> | 2005-02-18 18:21:06 +0000 |
|---|---|---|
| committer | peb <unknown> | 2005-02-18 18:21:06 +0000 |
| commit | 9568d7a844ba6a1872a8e8f6ef002860057e62ab (patch) | |
| tree | 9e25c6ed62e48101a2782d5fb8dcba68462dc613 /src/GF/Data/Map.hs | |
| parent | 1c4f025320900897ae3acdab6982f7d595b98dd1 (diff) | |
"Committed_by_peb"
Diffstat (limited to 'src/GF/Data/Map.hs')
| -rw-r--r-- | src/GF/Data/Map.hs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/GF/Data/Map.hs b/src/GF/Data/Map.hs index 107a2f6c9..1130db2ac 100644 --- a/src/GF/Data/Map.hs +++ b/src/GF/Data/Map.hs @@ -5,24 +5,23 @@ -- Stability : Stable -- Portability : Haskell 98 -- --- > CVS $Date $ --- > CVS $Author $ --- > CVS $Revision $ +-- > CVS $Date: 2005/02/18 19:21:15 $ +-- > CVS $Author: peb $ +-- > CVS $Revision: 1.5 $ -- -- (Description of the module) ----------------------------------------------------------------------------- -module Map - ( +module Map ( Map, empty, isEmpty, - (!), -- lookup operator. - (!+), -- lookupMany operator. - (|->), -- insert operator. - (|->+), -- insertMany operator. - (<+>), -- union operator. - flatten -- + (!), + (!+), + (|->), + (|->+), + (<+>), + flatten ) where import RedBlack @@ -38,20 +37,25 @@ infixl 4 <+> empty :: Map key el empty = emptyTree +-- | lookup operator. (!) :: Ord key => Map key el -> key -> Maybe el fm ! e = lookupTree e fm +-- | lookupMany operator. (!+) :: Ord key => Map key el -> [key] -> [Maybe el] fm !+ [] = [] fm !+ (e:es) = (lookupTree e fm): (fm !+ es) +-- | insert operator. (|->) :: Ord key => (key,el) -> Map key el -> Map key el (x,y) |-> fm = insertTree (x,y) fm +-- | insertMany operator. (|->+) :: Ord key => [(key,el)] -> Map key el -> Map key el [] |->+ fm = fm ((x,y):xs) |->+ fm = xs |->+ (insertTree (x,y) fm) +-- | union operator. (<+>) :: Ord key => Map key el -> Map key el -> Map key el (<+>) fm1 fm2 = xs |->+ fm2 where xs = flatten fm1 |
