@grain/stdlib 0.5.2 → 0.5.4

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 (54) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/array.gr +61 -1
  3. package/array.md +113 -0
  4. package/bigint.md +30 -30
  5. package/buffer.gr +24 -22
  6. package/char.gr +2 -2
  7. package/float32.md +3 -3
  8. package/float64.md +3 -3
  9. package/immutablemap.gr +493 -0
  10. package/immutablemap.md +479 -0
  11. package/immutablepriorityqueue.gr +360 -0
  12. package/immutablepriorityqueue.md +291 -0
  13. package/immutableset.gr +498 -0
  14. package/immutableset.md +449 -0
  15. package/list.gr +75 -2
  16. package/list.md +110 -0
  17. package/map.gr +1 -2
  18. package/marshal.gr +1058 -0
  19. package/marshal.md +76 -0
  20. package/number.gr +689 -23
  21. package/number.md +362 -27
  22. package/package.json +1 -1
  23. package/pervasives.gr +16 -5
  24. package/pervasives.md +28 -0
  25. package/priorityqueue.gr +261 -0
  26. package/priorityqueue.md +309 -0
  27. package/queue.gr +14 -1
  28. package/queue.md +16 -1
  29. package/regex.gr +90 -67
  30. package/runtime/bigint.gr +4 -4
  31. package/runtime/compare.gr +179 -0
  32. package/runtime/compare.md +6 -0
  33. package/runtime/equal.gr +3 -3
  34. package/runtime/exception.gr +9 -5
  35. package/runtime/exception.md +8 -2
  36. package/runtime/gc.gr +2 -1
  37. package/runtime/malloc.gr +1 -3
  38. package/runtime/numberUtils.gr +11 -11
  39. package/runtime/numbers.gr +423 -100
  40. package/runtime/numbers.md +50 -0
  41. package/runtime/string.gr +4 -2
  42. package/set.gr +26 -27
  43. package/stack.gr +12 -0
  44. package/stack.md +15 -0
  45. package/string.gr +409 -53
  46. package/string.md +164 -1
  47. package/sys/file.gr +4 -4
  48. package/sys/file.md +3 -3
  49. package/sys/process.gr +3 -3
  50. package/sys/process.md +3 -3
  51. package/sys/random.gr +2 -2
  52. package/sys/random.md +2 -2
  53. package/sys/time.gr +2 -2
  54. package/sys/time.md +2 -2
package/marshal.md ADDED
@@ -0,0 +1,76 @@
1
+ ---
2
+ title: Marshal
3
+ ---
4
+
5
+ Utilities for serializing and deserializing Grain data.
6
+
7
+ <details disabled>
8
+ <summary tabindex="-1">Added in <code>0.5.3</code></summary>
9
+ No other changes yet.
10
+ </details>
11
+
12
+ ```grain
13
+ import Marshal from "marshal"
14
+ ```
15
+
16
+ ## Values
17
+
18
+ Functions for marshaling and unmarshaling data.
19
+
20
+ ### Marshal.**marshal**
21
+
22
+ <details disabled>
23
+ <summary tabindex="-1">Added in <code>0.5.3</code></summary>
24
+ No other changes yet.
25
+ </details>
26
+
27
+ ```grain
28
+ marshal : a -> Bytes
29
+ ```
30
+
31
+ Serialize a value into a byte-based representation suitable for transmission
32
+ across a network or disk storage. The byte-based representation can be
33
+ deserialized at a later time to restore the value.
34
+
35
+ Parameters:
36
+
37
+ |param|type|description|
38
+ |-----|----|-----------|
39
+ |`value`|`a`|The value to serialize|
40
+
41
+ Returns:
42
+
43
+ |type|description|
44
+ |----|-----------|
45
+ |`Bytes`|A byte-based representation of the value|
46
+
47
+ ### Marshal.**unmarshal**
48
+
49
+ <details disabled>
50
+ <summary tabindex="-1">Added in <code>0.5.3</code></summary>
51
+ No other changes yet.
52
+ </details>
53
+
54
+ ```grain
55
+ unmarshal : Bytes -> Result<a, String>
56
+ ```
57
+
58
+ Deserialize the byte-based representation of a value back into an in-memory
59
+ value. This operation is not type-safe, and it is recommended that a type
60
+ annotation is used to declare the type of the unmarshaled value. While
61
+ attempts to unmarshal bad data will fail, this operation is still generally
62
+ unsafe and great care should be taken to ensure that the data being
63
+ unmarshaled corresponds to the expected type.
64
+
65
+ Parameters:
66
+
67
+ |param|type|description|
68
+ |-----|----|-----------|
69
+ |`bytes`|`Bytes`|The data to deserialize|
70
+
71
+ Returns:
72
+
73
+ |type|description|
74
+ |----|-----------|
75
+ |`Result<a, String>`|An in-memory value|
76
+