|
2 | 2 | #if !defined(TESTING) && defined(__GLASGOW_HASKELL__) |
3 | 3 | {-# LANGUAGE Safe #-} |
4 | 4 | #endif |
5 | | -#ifdef __GLASGOW_HASKELL__ |
6 | | -{-# LANGUAGE DataKinds #-} |
7 | | -{-# LANGUAGE FlexibleContexts #-} |
8 | | -{-# LANGUAGE MonoLocalBinds #-} |
9 | | -#endif |
10 | 5 |
|
11 | 6 | #include "containers.h" |
12 | 7 |
|
|
19 | 14 | |
20 | 15 | -- Portability : portable |
21 | 16 | -- |
22 | | --- An efficient implementation of maps from integer keys to values |
23 | | --- (dictionaries). |
| 17 | +-- The @'IntMap' v@ type represents a finite map (sometimes called a dictionary) |
| 18 | +-- from key of type @Int@ to values of type @v@. |
24 | 19 | -- |
25 | | --- This module re-exports the value lazy "Data.IntMap.Lazy" API, plus |
26 | | --- several deprecated value strict functions. Please note that these functions |
27 | | --- have different strictness properties than those in "Data.IntMap.Strict": |
28 | | --- they only evaluate the result of the combining function. For example, the |
29 | | --- default value to 'insertWith'' is only evaluated if the combining function |
30 | | --- is called and uses it. |
| 20 | +-- This module re-exports the value lazy "Data.IntMap.Lazy" API. |
31 | 21 | -- |
32 | | --- These modules are intended to be imported qualified, to avoid name |
| 22 | +-- This module is intended to be imported qualified, to avoid name |
33 | 23 | -- clashes with Prelude functions, e.g. |
34 | 24 | -- |
35 | 25 | -- > import Data.IntMap (IntMap) |
36 | 26 | -- > import qualified Data.IntMap as IntMap |
37 | 27 | -- |
38 | 28 | -- The implementation is based on /big-endian patricia trees/. This data |
39 | 29 | -- structure performs especially well on binary operations like 'union' |
40 | | --- and 'intersection'. However, my benchmarks show that it is also |
| 30 | +-- and 'intersection'. Additionally, benchmarks show that it is also |
41 | 31 | -- (much) faster on insertions and deletions when compared to a generic |
42 | 32 | -- size-balanced map implementation (see "Data.Map"). |
43 | 33 | -- |
|
80 | 70 |
|
81 | 71 | module Data.IntMap |
82 | 72 | ( module Data.IntMap.Lazy |
83 | | -#ifdef __GLASGOW_HASKELL__ |
84 | | --- For GHC, we disable these, pending removal. For anything else, |
85 | | --- we just don't define them at all. |
86 | | - , insertWith' |
87 | | - , insertWithKey' |
88 | | - , fold |
89 | | - , foldWithKey |
90 | | -#endif |
91 | 73 | ) where |
92 | 74 |
|
93 | 75 | import Data.IntMap.Lazy |
94 | | - |
95 | | -#ifdef __GLASGOW_HASKELL__ |
96 | | -import Utils.Containers.Internal.TypeError |
97 | | - |
98 | | --- | This function is being removed and is no longer usable. |
99 | | --- Use 'Data.IntMap.Strict.insertWith' |
100 | | -insertWith' :: Whoops "Data.IntMap.insertWith' is gone. Use Data.IntMap.Strict.insertWith." |
101 | | - => (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a |
102 | | -insertWith' _ _ _ _ = undefined |
103 | | - |
104 | | --- | This function is being removed and is no longer usable. |
105 | | --- Use 'Data.IntMap.Strict.insertWithKey'. |
106 | | -insertWithKey' :: Whoops "Data.IntMap.insertWithKey' is gone. Use Data.IntMap.Strict.insertWithKey." |
107 | | - => (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a |
108 | | -insertWithKey' _ _ _ _ = undefined |
109 | | - |
110 | | --- | This function is being removed and is no longer usable. |
111 | | --- Use 'Data.IntMap.Lazy.foldr'. |
112 | | -fold :: Whoops "Data.IntMap.fold' is gone. Use Data.IntMap.foldr or Prelude.foldr." |
113 | | - => (a -> b -> b) -> b -> IntMap a -> b |
114 | | -fold _ _ _ = undefined |
115 | | - |
116 | | --- | This function is being removed and is no longer usable. |
117 | | --- Use 'foldrWithKey'. |
118 | | -foldWithKey :: Whoops "Data.IntMap.foldWithKey is gone. Use foldrWithKey." |
119 | | - => (Key -> a -> b -> b) -> b -> IntMap a -> b |
120 | | -foldWithKey _ _ _ = undefined |
121 | | -#endif |
0 commit comments