This repository was archived by the owner on Oct 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +137
-1
lines changed Expand file tree Collapse file tree 3 files changed +137
-1
lines changed Original file line number Diff line number Diff line change 196
196
values :: forall a. StrMap a -> [a]
197
197
198
198
199
+ ## Module Data.StrMap.ST
200
+
201
+ ### Types
202
+
203
+ data STStrMap :: * -> * -> *
204
+
205
+
206
+ ### Values
207
+
208
+ delete :: forall a h r. STStrMap h a -> String -> Eff (st :: ST h | r) (STStrMap h a)
209
+
210
+ freeze :: forall a h r. STStrMap h a -> Eff (st :: ST h | r) (SM.StrMap a)
211
+
212
+ isEmpty :: forall a h r. STStrMap h a -> Eff (st :: ST h | r) Boolean
213
+
214
+ new :: forall a h r. Eff (st :: ST h | r) (STStrMap h a)
215
+
216
+ peek :: forall a h r. STStrMap h a -> String -> Eff (st :: ST h | r) (Maybe a)
217
+
218
+ poke :: forall a h r. STStrMap h a -> String -> a -> Eff (st :: ST h | r) a
219
+
220
+ size :: forall a h r. STStrMap h a -> Eff (st :: ST h | r) Number
221
+
222
+ thaw :: forall a h r. SM.StrMap a -> Eff (st :: ST h | r) (STStrMap h a)
223
+
224
+
225
+ ## Module Data.StrMap.ST.Unsafe
226
+
227
+ ### Values
228
+
229
+ unsafePeek :: forall a h r. STStrMap h a -> String -> Eff (st :: ST h | r) a
230
+
231
+
199
232
## Module Data.StrMap.Unsafe
200
233
201
234
### Values
202
235
203
- unsafeIndex :: forall a. StrMap a -> String -> a
236
+ unsafeIndex :: forall a. StrMap a -> String -> a
Original file line number Diff line number Diff line change
1
+ module Data.StrMap.ST
2
+ ( STStrMap ()
3
+ , new
4
+ , freeze
5
+ , thaw
6
+ , isEmpty
7
+ , peek
8
+ , size
9
+ , poke
10
+ , delete
11
+ ) where
12
+
13
+ import Control.Monad.Eff
14
+ import Control.Monad.ST
15
+ import Data.Maybe
16
+
17
+ import qualified Data.StrMap as SM
18
+
19
+ foreign import data STStrMap :: * -> * -> *
20
+
21
+ foreign import _new " " "
22
+ function _new() {
23
+ return {};
24
+ }" " " :: forall a h r . Eff (st :: ST h | r ) (STStrMap h a )
25
+
26
+ new :: forall a h r . Eff (st :: ST h | r ) (STStrMap h a )
27
+ new = _new
28
+
29
+ foreign import _copy " " "
30
+ function _copy(m) {
31
+ return function () {
32
+ var r = {};
33
+ for (var k in m)
34
+ r[k] = m[k];
35
+ return r;
36
+ };
37
+ }" " " :: forall a b h r . a -> Eff (st :: ST h | r ) b
38
+
39
+ thaw :: forall a h r . SM.StrMap a -> Eff (st :: ST h | r ) (STStrMap h a )
40
+ thaw = _copy
41
+
42
+ freeze :: forall a h r . STStrMap h a -> Eff (st :: ST h | r ) (SM.StrMap a )
43
+ freeze = _copy
44
+
45
+ foreign import _unST " " "
46
+ function _unST(m) {
47
+ return m;
48
+ }" " " :: forall a h . STStrMap h a -> SM.StrMap a
49
+
50
+ isEmpty :: forall a h r . STStrMap h a -> Eff (st :: ST h | r ) Boolean
51
+ isEmpty m = return (SM .isEmpty (_unST m))
52
+
53
+ peek :: forall a h r . STStrMap h a -> String -> Eff (st :: ST h | r ) (Maybe a )
54
+ peek m k = return (SM .lookup k (_unST m))
55
+
56
+ size :: forall a h r . STStrMap h a -> Eff (st :: ST h | r ) Number
57
+ size m = return (SM .size (_unST m))
58
+
59
+ foreign import poke " " "
60
+ function poke(m) {
61
+ return function (k) {
62
+ return function (v) {
63
+ return function () {
64
+ return m[k] = v;
65
+ };
66
+ };
67
+ };
68
+ }" " " :: forall a h r . STStrMap h a -> String -> a -> Eff (st :: ST h | r ) a
69
+
70
+ foreign import _delete " " "
71
+ function _delete(m) {
72
+ return function (k) {
73
+ return function () {
74
+ delete m[k];
75
+ return m;
76
+ };
77
+ };
78
+ }" " " :: forall a h r . STStrMap h a -> String -> Eff (st :: ST h | r ) (STStrMap h a )
79
+
80
+ delete :: forall a h r . STStrMap h a -> String -> Eff (st :: ST h | r ) (STStrMap h a )
81
+ delete = _delete
82
+
83
+ foreign import run " " "
84
+ function run(f) {
85
+ return f;
86
+ }" " " :: forall a r . (forall h . Eff (st :: ST h | r ) (STStrMap h a )) -> Eff r (SM.StrMap a )
Original file line number Diff line number Diff line change
1
+ module Data.StrMap.ST.Unsafe
2
+ ( unsafePeek
3
+ ) where
4
+
5
+ import Control.Monad.Eff
6
+ import Control.Monad.ST
7
+ import Data.StrMap.Unsafe
8
+ import Data.StrMap.ST
9
+
10
+ foreign import unsafePeek " " "
11
+ function unsafePeek(m) {
12
+ return function (k) {
13
+ return function () {
14
+ return m[k];
15
+ }
16
+ }
17
+ }" " " :: forall a h r . STStrMap h a -> String -> Eff (st :: ST h | r ) a
You can’t perform that action at this time.
0 commit comments