ic-mops 0.8.5 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/package.json +3 -1
  2. package/.mops/base@0.7.4/LICENSE +0 -208
  3. package/.mops/base@0.7.4/README.md +0 -64
  4. package/.mops/base@0.7.4/mops.toml +0 -5
  5. package/.mops/base@0.7.4/src/Array.mo +0 -686
  6. package/.mops/base@0.7.4/src/AssocList.mo +0 -203
  7. package/.mops/base@0.7.4/src/Blob.mo +0 -55
  8. package/.mops/base@0.7.4/src/Bool.mo +0 -44
  9. package/.mops/base@0.7.4/src/Buffer.mo +0 -1937
  10. package/.mops/base@0.7.4/src/CertifiedData.mo +0 -29
  11. package/.mops/base@0.7.4/src/Char.mo +0 -67
  12. package/.mops/base@0.7.4/src/Debug.mo +0 -15
  13. package/.mops/base@0.7.4/src/Deque.mo +0 -75
  14. package/.mops/base@0.7.4/src/Error.mo +0 -41
  15. package/.mops/base@0.7.4/src/ExperimentalCycles.mo +0 -51
  16. package/.mops/base@0.7.4/src/ExperimentalInternetComputer.mo +0 -36
  17. package/.mops/base@0.7.4/src/ExperimentalStableMemory.mo +0 -121
  18. package/.mops/base@0.7.4/src/Float.mo +0 -150
  19. package/.mops/base@0.7.4/src/Func.mo +0 -38
  20. package/.mops/base@0.7.4/src/Hash.mo +0 -83
  21. package/.mops/base@0.7.4/src/HashMap.mo +0 -229
  22. package/.mops/base@0.7.4/src/Heap.mo +0 -113
  23. package/.mops/base@0.7.4/src/Int.mo +0 -150
  24. package/.mops/base@0.7.4/src/Int16.mo +0 -159
  25. package/.mops/base@0.7.4/src/Int32.mo +0 -160
  26. package/.mops/base@0.7.4/src/Int64.mo +0 -161
  27. package/.mops/base@0.7.4/src/Int8.mo +0 -160
  28. package/.mops/base@0.7.4/src/Iter.mo +0 -220
  29. package/.mops/base@0.7.4/src/IterType.mo +0 -7
  30. package/.mops/base@0.7.4/src/List.mo +0 -433
  31. package/.mops/base@0.7.4/src/Nat.mo +0 -75
  32. package/.mops/base@0.7.4/src/Nat16.mo +0 -146
  33. package/.mops/base@0.7.4/src/Nat32.mo +0 -146
  34. package/.mops/base@0.7.4/src/Nat64.mo +0 -146
  35. package/.mops/base@0.7.4/src/Nat8.mo +0 -146
  36. package/.mops/base@0.7.4/src/None.mo +0 -19
  37. package/.mops/base@0.7.4/src/Option.mo +0 -160
  38. package/.mops/base@0.7.4/src/Order.mo +0 -46
  39. package/.mops/base@0.7.4/src/Prelude.mo +0 -33
  40. package/.mops/base@0.7.4/src/Principal.mo +0 -58
  41. package/.mops/base@0.7.4/src/RBTree.mo +0 -218
  42. package/.mops/base@0.7.4/src/Random.mo +0 -188
  43. package/.mops/base@0.7.4/src/Result.mo +0 -210
  44. package/.mops/base@0.7.4/src/Stack.mo +0 -40
  45. package/.mops/base@0.7.4/src/Text.mo +0 -615
  46. package/.mops/base@0.7.4/src/Time.mo +0 -37
  47. package/.mops/base@0.7.4/src/Trie.mo +0 -1200
  48. package/.mops/base@0.7.4/src/TrieMap.mo +0 -180
  49. package/.mops/base@0.7.4/src/TrieSet.mo +0 -97
  50. package/.mops/base@0.8.3/LICENSE +0 -208
  51. package/.mops/base@0.8.3/README.md +0 -64
  52. package/.mops/base@0.8.3/mops.toml +0 -6
  53. package/.mops/base@0.8.3/src/Array.mo +0 -717
  54. package/.mops/base@0.8.3/src/AssocList.mo +0 -404
  55. package/.mops/base@0.8.3/src/Blob.mo +0 -212
  56. package/.mops/base@0.8.3/src/Bool.mo +0 -44
  57. package/.mops/base@0.8.3/src/Buffer.mo +0 -2660
  58. package/.mops/base@0.8.3/src/CertifiedData.mo +0 -53
  59. package/.mops/base@0.8.3/src/Char.mo +0 -65
  60. package/.mops/base@0.8.3/src/Debug.mo +0 -56
  61. package/.mops/base@0.8.3/src/Deque.mo +0 -243
  62. package/.mops/base@0.8.3/src/Error.mo +0 -68
  63. package/.mops/base@0.8.3/src/ExperimentalCycles.mo +0 -151
  64. package/.mops/base@0.8.3/src/ExperimentalInternetComputer.mo +0 -60
  65. package/.mops/base@0.8.3/src/ExperimentalStableMemory.mo +0 -348
  66. package/.mops/base@0.8.3/src/Float.mo +0 -843
  67. package/.mops/base@0.8.3/src/Func.mo +0 -46
  68. package/.mops/base@0.8.3/src/Hash.mo +0 -82
  69. package/.mops/base@0.8.3/src/HashMap.mo +0 -457
  70. package/.mops/base@0.8.3/src/Heap.mo +0 -233
  71. package/.mops/base@0.8.3/src/Int.mo +0 -365
  72. package/.mops/base@0.8.3/src/Int16.mo +0 -521
  73. package/.mops/base@0.8.3/src/Int32.mo +0 -522
  74. package/.mops/base@0.8.3/src/Int64.mo +0 -522
  75. package/.mops/base@0.8.3/src/Int8.mo +0 -522
  76. package/.mops/base@0.8.3/src/Iter.mo +0 -227
  77. package/.mops/base@0.8.3/src/IterType.mo +0 -7
  78. package/.mops/base@0.8.3/src/List.mo +0 -930
  79. package/.mops/base@0.8.3/src/Nat.mo +0 -305
  80. package/.mops/base@0.8.3/src/Nat16.mo +0 -144
  81. package/.mops/base@0.8.3/src/Nat32.mo +0 -144
  82. package/.mops/base@0.8.3/src/Nat64.mo +0 -144
  83. package/.mops/base@0.8.3/src/Nat8.mo +0 -144
  84. package/.mops/base@0.8.3/src/None.mo +0 -19
  85. package/.mops/base@0.8.3/src/Option.mo +0 -154
  86. package/.mops/base@0.8.3/src/Order.mo +0 -46
  87. package/.mops/base@0.8.3/src/Prelude.mo +0 -33
  88. package/.mops/base@0.8.3/src/Principal.mo +0 -249
  89. package/.mops/base@0.8.3/src/RBTree.mo +0 -681
  90. package/.mops/base@0.8.3/src/Random.mo +0 -270
  91. package/.mops/base@0.8.3/src/Result.mo +0 -209
  92. package/.mops/base@0.8.3/src/Stack.mo +0 -93
  93. package/.mops/base@0.8.3/src/Text.mo +0 -761
  94. package/.mops/base@0.8.3/src/Time.mo +0 -36
  95. package/.mops/base@0.8.3/src/Timer.mo +0 -62
  96. package/.mops/base@0.8.3/src/Trie.mo +0 -1603
  97. package/.mops/base@0.8.3/src/TrieMap.mo +0 -392
  98. package/.mops/base@0.8.3/src/TrieSet.mo +0 -148
  99. package/network.txt +0 -1
@@ -1,203 +0,0 @@
1
- /// Lists of key-value entries ("associations").
2
- ///
3
- /// Implements the same operations as library `Trie`, but uses a
4
- /// linked-list of entries and no hashing.
5
-
6
- import List "List";
7
-
8
- module {
9
-
10
- /// polymorphic association linked lists between keys and values
11
- public type AssocList<K, V> = List.List<(K, V)>;
12
-
13
- /// Find the value associated with a given key, or null if absent.
14
- public func find<K, V>(
15
- al : AssocList<K, V>,
16
- k : K,
17
- k_eq : (K, K) -> Bool
18
- ) : ?V {
19
- func rec(al : AssocList<K, V>) : ?V {
20
- label profile_assocList_find_rec : (?V)
21
- switch (al) {
22
- case (null) { label profile_assocList_find_end_fail : (?V) { null } };
23
- case (?((hd_k, hd_v), tl)) {
24
- if (k_eq(k, hd_k)) {
25
- label profile_assocList_find_end_success : (?V) {
26
- ?hd_v
27
- }
28
- } else {
29
- rec(tl)
30
- }
31
- };
32
- }
33
- };
34
- label profile_assocList_find_begin : (?V) {
35
- rec(al)
36
- }
37
- };
38
-
39
- /// replace the value associated with a given key, or add it, if missing.
40
- /// returns old value, or null, if no prior value existed.
41
- public func replace<K, V>(
42
- al : AssocList<K, V>,
43
- k : K,
44
- k_eq : (K, K) -> Bool,
45
- ov : ?V
46
- )
47
- : (AssocList<K, V>, ?V) {
48
- func rec(al : AssocList<K, V>) : (AssocList<K, V>, ?V) {
49
- switch (al) {
50
- case (null) {
51
- switch ov {
52
- case (null) { (null, null) };
53
- case (?v) { (?((k, v), null), null) };
54
- }
55
- };
56
- case (?((hd_k, hd_v), tl)) {
57
- if (k_eq(k, hd_k)) {
58
- // if value is null, remove the key; otherwise, replace key's old value
59
- // return old value
60
- switch ov {
61
- case (null) { (tl, ?hd_v) };
62
- case (?v) { (?((hd_k, v), tl), ?hd_v) };
63
- }
64
- } else {
65
- let (tl2, old_v) = rec(tl);
66
- (?((hd_k, hd_v), tl2), old_v)
67
- }
68
- };
69
- }
70
- };
71
- rec(al)
72
- };
73
-
74
- /// The entries of the final list consist of those pairs of
75
- /// the left list whose keys are not present in the right list; the
76
- /// "extra" values of the right list are irrelevant.
77
- public func diff<K, V, W>(
78
- al1 : AssocList<K, V>,
79
- al2 : AssocList<K, W>,
80
- keq : (K, K) -> Bool
81
- ) : AssocList<K, V> {
82
- func rec(al1 : AssocList<K, V>) : AssocList<K, V> {
83
- switch al1 {
84
- case (null) { null };
85
- case (?((k, v1), tl)) {
86
- switch (find<K, W>(al2, k, keq)) {
87
- case (null) { ?((k, v1), rec(tl)) };
88
- case (?v2) { rec(tl)};
89
- }
90
- };
91
- }
92
- };
93
- rec(al1)
94
- };
95
-
96
- /// Transform and combine the entries of two association lists.
97
- public func mapAppend<K, V, W, X>(
98
- al1 : AssocList<K, V>,
99
- al2 : AssocList<K, W>,
100
- vbin : (?V, ?W) -> X
101
- ) : AssocList<K, X> =
102
- label profile_assocList_mapAppend : AssocList<K, X> {
103
- func rec(al1 : AssocList<K, V>, al2 : AssocList<K, W>) : AssocList<K, X> =
104
- label profile_assocList_mapAppend_rec : AssocList<K,X> {
105
- switch (al1, al2) {
106
- case (null, null) { null };
107
- case (?((k, v), al1_), _ ) { ?((k, vbin(?v, null)), rec(al1_, al2 )) };
108
- case (null, ?((k, v), al2_)) { ?((k, vbin(null, ?v)), rec(null, al2_)) };
109
- }
110
- };
111
- rec(al1, al2)
112
- };
113
-
114
- /// Specialized version of `disj`, optimized for disjoint sub-spaces of keyspace (no matching keys).
115
- public func disjDisjoint<K, V, W, X>(
116
- al1 : AssocList<K, V>,
117
- al2 : AssocList<K, W>,
118
- vbin : (?V, ?W) -> X)
119
- : AssocList<K, X> = label profile_assocList_disjDisjoint : AssocList<K,X> {
120
- mapAppend<K, V, W, X>(al1, al2, vbin)
121
- };
122
-
123
- /// This operation generalizes the notion of "set union" to finite maps.
124
- /// Produces a "disjunctive image" of the two lists, where the values of
125
- /// matching keys are combined with the given binary operator.
126
- ///
127
- /// For unmatched entries, the operator is still applied to
128
- /// create the value in the image. To accomodate these various
129
- /// situations, the operator accepts optional values, but is never
130
- /// applied to (null, null).
131
- public func disj<K, V, W, X>(
132
- al1 : AssocList<K, V>,
133
- al2 : AssocList<K, W>,
134
- keq : (K, K) -> Bool,
135
- vbin :(?V, ?W) -> X
136
- ) : AssocList<K, X> {
137
- func rec1(al1Rec : AssocList<K, V>) : AssocList<K, X> {
138
- switch al1Rec {
139
- case (null) {
140
- func rec2(al2 : AssocList<K, W>) : AssocList<K, X> {
141
- switch al2 {
142
- case (null) { null };
143
- case (?((k, v2), tl)) {
144
- switch (find<K, V>(al1, k, keq)) {
145
- case (null) { ?((k, vbin(null, ?v2)), rec2(tl)) };
146
- case (?v1) { ?((k, vbin(?v1, ?v2)), rec2(tl)) };
147
- }
148
- };
149
- }
150
- };
151
- rec2(al2)
152
- };
153
- case (?((k, v1), tl)) {
154
- switch (find<K, W>(al2, k, keq)) {
155
- case (null) { ?((k, vbin(?v1, null)), rec1(tl)) };
156
- case (?v2) { /* handled above */ rec1(tl) };
157
- }
158
- };
159
- }
160
- };
161
- rec1(al1)
162
- };
163
-
164
- /// This operation generalizes the notion of "set intersection" to
165
- /// finite maps. Produces a "conjuctive image" of the two lists, where
166
- /// the values of matching keys are combined with the given binary
167
- /// operator, and unmatched entries are not present in the output.
168
- public func join<K, V, W, X>(
169
- al1 : AssocList<K, V>,
170
- al2 : AssocList<K, W>,
171
- keq : (K, K) -> Bool,
172
- vbin : (V, W) -> X
173
- ) : AssocList<K, X> {
174
- func rec(al1 : AssocList<K, V>) : AssocList<K, X> {
175
- switch al1 {
176
- case (null) { null };
177
- case (?((k, v1), tl)) {
178
- switch (find<K, W>(al2, k, keq)) {
179
- case (null) { rec(tl) };
180
- case (?v2) { ?((k, vbin(v1, v2)), rec(tl)) };
181
- }
182
- };
183
- }
184
- };
185
- rec(al1)
186
- };
187
-
188
- /// Fold the entries based on the recursive list structure.
189
- public func fold<K, V, X>(
190
- al : AssocList<K, V>,
191
- nil : X,
192
- cons : (K, V, X) -> X
193
- ) : X {
194
- func rec(al : AssocList<K, V>) : X {
195
- switch al {
196
- case null { nil };
197
- case (?((k, v), t)) { cons(k, v, rec(t)) };
198
- }
199
- };
200
- rec(al)
201
- };
202
-
203
- }
@@ -1,55 +0,0 @@
1
- /// Binary blobs
2
-
3
- import Prim "mo:⛔";
4
- module {
5
-
6
- /// An immutable, possibly empty sequence of bytes.
7
- /// Given `b : Blob`:
8
- ///
9
- /// * `b.size() : Nat` returns the number of bytes in the blob;
10
- /// * `b.vals() : Iter.Iter<Nat8>` returns an iterator to enumerate the bytes of the blob.
11
- ///
12
- /// (Direct indexing of Blobs is not yet supported.)
13
- public type Blob = Prim.Types.Blob;
14
-
15
- /// Returns a (non-cryptographic) hash of 'b'
16
- public let hash : (b : Blob) -> Nat32 = Prim.hashBlob;
17
-
18
- /// Returns `x == y`.
19
- public func equal(x : Blob, y : Blob) : Bool { x == y };
20
-
21
- /// Returns `x != y`.
22
- public func notEqual(x : Blob, y : Blob) : Bool { x != y };
23
-
24
- /// Returns `x < y`.
25
- public func less(x : Blob, y : Blob) : Bool { x < y };
26
-
27
- /// Returns `x <= y`.
28
- public func lessOrEqual(x : Blob, y : Blob) : Bool { x <= y };
29
-
30
- /// Returns `x > y`.
31
- public func greater(x : Blob, y : Blob) : Bool { x > y };
32
-
33
- /// Returns `x >= y`.
34
- public func greaterOrEqual(x : Blob, y : Blob) : Bool { x >= y };
35
-
36
- /// Returns the order of `x` and `y`.
37
- public func compare(x : Blob, y : Blob) : { #less; #equal; #greater } {
38
- if (x < y) { #less }
39
- else if (x == y) { #equal }
40
- else { #greater }
41
- };
42
-
43
- /// Creates a blob from an array of bytes, by copying each element.
44
- public let fromArray : [Nat8] -> Blob = Prim.arrayToBlob;
45
-
46
- /// Creates a blob from a mutable array of bytes, by copying each element.
47
- public let fromArrayMut : [var Nat8] -> Blob = Prim.arrayMutToBlob;
48
-
49
- /// Creates an array of bytes from a blob, by copying each element.
50
- public let toArray : Blob -> [Nat8] = Prim.blobToArray;
51
-
52
- /// Creates a mutable array of bytes from a blob, by copying each element.
53
- public let toArrayMut : Blob -> [var Nat8] = Prim.blobToArrayMut;
54
-
55
- }
@@ -1,44 +0,0 @@
1
- /// Boolean type and operations.
2
- ///
3
- /// While boolean operators `_ and _` and `_ or _` are short-circuiting,
4
- /// avoiding computation of the right argument when possible, the functions
5
- /// `logand(_, _)` and `logor(_, _)` are *strict* and will always evaluate *both*
6
- /// of their arguments.
7
-
8
- import Prim "mo:⛔";
9
- module {
10
-
11
- /// Booleans with constants `true` and `false`.
12
- public type Bool = Prim.Types.Bool;
13
-
14
- /// Conversion.
15
- public func toText(x : Bool) : Text {
16
- if x { "true" } else { "false" }
17
- };
18
-
19
- /// Returns `x and y`.
20
- public func logand(x : Bool, y : Bool) : Bool { x and y };
21
-
22
- /// Returns `x or y`.
23
- public func logor(x : Bool, y : Bool) : Bool { x or y };
24
-
25
- /// Returns exclusive or of `x` and `y`, `x != y`.
26
- public func logxor(x : Bool, y : Bool) : Bool {
27
- x != y
28
- };
29
-
30
- /// Returns `not x`.
31
- public func lognot(x : Bool) : Bool { not x };
32
-
33
- /// Returns `x == y`.
34
- public func equal(x : Bool, y : Bool) : Bool { x == y };
35
-
36
- /// Returns `x != y`.
37
- public func notEqual(x : Bool, y : Bool) : Bool { x != y };
38
-
39
- /// Returns the order of `x` and `y`, where `false < true`.
40
- public func compare(x : Bool, y : Bool) : {#less; #equal; #greater } {
41
- if (x == y) { #equal } else if (x) { #greater } else { #less }
42
- };
43
-
44
- }