functype 0.40.0 → 0.41.0

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 (46) hide show
  1. package/dist/Brand-BPeggBaO.d.ts +1 -2
  2. package/dist/Brand-Cfr5zy8F.js +1 -2
  3. package/dist/Tuple-C4maYbiO.d.ts +1 -2
  4. package/dist/Tuple-CgX4p79w.js +1 -2
  5. package/dist/cli/index.js +2 -3
  6. package/dist/do/index.d.ts +1 -1
  7. package/dist/do/index.js +1 -1
  8. package/dist/either/index.d.ts +1 -1
  9. package/dist/either/index.js +1 -1
  10. package/dist/fpromise/index.d.ts +1 -1
  11. package/dist/fpromise/index.js +1 -1
  12. package/dist/{index-Bn_yRBx8.d.ts → index-B6Civ4kr.d.ts} +19 -9
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/list/index.d.ts +1 -1
  16. package/dist/list/index.js +1 -1
  17. package/dist/map/index.d.ts +1 -1
  18. package/dist/map/index.js +1 -1
  19. package/dist/option/index.d.ts +1 -1
  20. package/dist/option/index.js +1 -1
  21. package/dist/set/index.d.ts +1 -1
  22. package/dist/set/index.js +1 -1
  23. package/dist/{src-JcsaR9MX.js → src-DpfaJv6K.js} +2 -3
  24. package/dist/try/index.d.ts +1 -1
  25. package/dist/try/index.js +1 -1
  26. package/package.json +35 -38
  27. package/README.processed.md +0 -862
  28. package/dist/Brand-Cfr5zy8F.js.map +0 -1
  29. package/dist/Tuple-CgX4p79w.js.map +0 -1
  30. package/dist/cli/index.js.map +0 -1
  31. package/dist/src-JcsaR9MX.js.map +0 -1
  32. package/readme/BRAND_MIGRATION_GUIDE.md +0 -230
  33. package/readme/BUNDLE_OPTIMIZATION.md +0 -74
  34. package/readme/FPromise-Assessment.md +0 -43
  35. package/readme/HKT.md +0 -110
  36. package/readme/ROADMAP.md +0 -113
  37. package/readme/TASK-TODO.md +0 -33
  38. package/readme/TUPLE-EXAMPLES.md +0 -76
  39. package/readme/TaskMigration.md +0 -129
  40. package/readme/ai-guide.md +0 -406
  41. package/readme/examples.md +0 -2093
  42. package/readme/functype-changes-required.md +0 -189
  43. package/readme/quick-reference.md +0 -514
  44. package/readme/task-error-handling.md +0 -283
  45. package/readme/tasks.md +0 -203
  46. package/readme/type-index.md +0 -238
@@ -1,238 +0,0 @@
1
- # Functype Type Index
2
-
3
- This document provides a comprehensive index of all types and data structures in the Functype library, along with the type classes each implements.
4
-
5
- ## Core Data Structures
6
-
7
- | Data Structure | Description | Import Path |
8
- | ---------------- | ---------------------------------------------------- | -------------------- |
9
- | `Option<T>` | Represents a value that may or may not exist | `functype/option` |
10
- | `Either<L, R>` | Represents a value of one of two possible types | `functype/either` |
11
- | `Try<T>` | Represents a computation that might throw | `functype/try` |
12
- | `List<T>` | Immutable list collection | `functype/list` |
13
- | `Map<K, V>` | Immutable key-value map | `functype/map` |
14
- | `Set<T>` | Immutable set collection | `functype/set` |
15
- | `Tuple<...T>` | Type-safe fixed-length array | `functype/tuple` |
16
- | `FPromise<T, E>` | Enhanced Promise with functional operations | `functype/fpromise` |
17
- | `Task<T, E>` | Represents sync/async operations with error handling | `functype/core/task` |
18
- | `Brand<T, B>` | Nominal typing for TypeScript | `functype/branded` |
19
- | `Identity<T>` | Identity monad | `functype/identity` |
20
- | `Stack<T>` | Immutable stack collection | `functype/stack` |
21
-
22
- ## Type Class Implementations
23
-
24
- The table below shows which type classes each data structure implements.
25
-
26
- | Data Structure | Functor | Foldable | Matchable | Traversable | Serializable | Typeable | Valuable |
27
- | ---------------- | ------- | -------- | --------- | ----------- | ------------ | -------- | -------- |
28
- | `Option<T>` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
29
- | `Either<L, R>` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
30
- | `Try<T>` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
31
- | `List<T>` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
32
- | `Map<K, V>` | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
33
- | `Set<T>` | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
34
- | `Tuple<...T>` | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ |
35
- | `FPromise<T, E>` | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
36
- | `Task<T, E>` | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
37
- | `Identity<T>` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
38
- | `Stack<T>` | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
39
-
40
- ## Type Classes
41
-
42
- | Type Class | Description | Interface |
43
- | ---------------- | --------------------------------------------------- | ----------------------------------------------------------------- |
44
- | `Functor<F>` | Mappable container types | `map<B>(f: (a: A) => B): F<B>` |
45
- | `Foldable<F>` | Types that can be "folded" to a value | `fold<B>(onEmpty: () => B, onValue: (a: A) => B): B` |
46
- | `Matchable<F>` | Types that support pattern matching | `match<B>(patterns: { [key: string]: (...args: any[]) => B }): B` |
47
- | `Traversable<F>` | Types that can be traversed and sequence operations | `traverse<G, B>(f: (a: A) => G<B>): G<F<B>>` |
48
- | `Serializable` | Types that can be serialized | `toJSON(): unknown` |
49
- | `Typeable` | Types with runtime type information | `typeName(): string` |
50
- | `Valuable` | Types with value equality comparison | `equals(other: unknown): boolean` |
51
-
52
- ## Detailed Type Constructors
53
-
54
- ### Option<T>
55
-
56
- ```typescript
57
- type Option<T> = Some<T> | None
58
- ```
59
-
60
- **Variants:**
61
-
62
- - `Some<T>` - Contains a value of type T
63
- - `None` - Represents no value
64
-
65
- ### Either<L, R>
66
-
67
- ```typescript
68
- type Either<L, R> = Left<L, R> | Right<L, R>
69
- ```
70
-
71
- **Variants:**
72
-
73
- - `Left<L, R>` - Contains a value of type L (typically an error)
74
- - `Right<L, R>` - Contains a value of type R (success value)
75
-
76
- ### Try<T>
77
-
78
- ```typescript
79
- type Try<T> = Success<T> | Failure<Error>
80
- ```
81
-
82
- **Variants:**
83
-
84
- - `Success<T>` - Contains a successfully computed value
85
- - `Failure<Error>` - Contains an error from a failed computation
86
-
87
- ### List<T>
88
-
89
- ```typescript
90
- type List<T> = {
91
- /* ... methods ... */
92
- [Symbol.iterator](): Iterator<T>
93
- }
94
- ```
95
-
96
- Immutable list supporting standard collection operations.
97
-
98
- ### Map<K, V>
99
-
100
- ```typescript
101
- type Map<K, V> = {
102
- /* ... methods ... */
103
- [Symbol.iterator](): Iterator<[K, V]>
104
- }
105
- ```
106
-
107
- Immutable key-value map.
108
-
109
- ### Set<T>
110
-
111
- ```typescript
112
- type Set<T> = {
113
- /* ... methods ... */
114
- [Symbol.iterator](): Iterator<T>
115
- }
116
- ```
117
-
118
- Immutable set with no duplicate elements.
119
-
120
- ### FPromise<T, E>
121
-
122
- ```typescript
123
- type FPromise<T, E> = {
124
- /* ... methods ... */
125
- toPromise(): Promise<T>
126
- }
127
- ```
128
-
129
- Enhanced Promise with better error handling.
130
-
131
- ### Task<T, E>
132
-
133
- ```typescript
134
- type Task<T, E> = {
135
- /* ... methods ... */
136
- then(onFulfilled: (value: T) => any): Promise<any>
137
- catch(onRejected: (reason: E) => any): Promise<any>
138
- }
139
- ```
140
-
141
- Represents synchronous and asynchronous operations.
142
-
143
- ### Identity<T>
144
-
145
- ```typescript
146
- type Identity<T> = {
147
- /* ... methods ... */
148
- value: T
149
- }
150
- ```
151
-
152
- Identity monad that simply wraps a value.
153
-
154
- ## Higher-Kinded Types
155
-
156
- Functype provides higher-kinded type emulation through the following interfaces:
157
-
158
- ```typescript
159
- // Base higher-kinded type
160
- interface HKT<URI, A> {
161
- readonly _URI: URI
162
- readonly _A: A
163
- }
164
-
165
- // Type-level functions
166
- interface URItoKind<A> {
167
- readonly Option: Option<A>
168
- readonly Either: Either<unknown, A>
169
- readonly List: List<A>
170
- readonly Try: Try<A>
171
- readonly Identity: Identity<A>
172
- // ... other types ...
173
- }
174
- ```
175
-
176
- This allows for more advanced type operations and generic algorithms across containers.
177
-
178
- ## Type Utils
179
-
180
- | Utility | Description | Import Path |
181
- | ---------------- | ----------------------------------------- | -------------------- |
182
- | `FoldableUtils` | Utilities for working with Foldable types | `functype/foldable` |
183
- | `MatchableUtils` | Utilities for pattern matching | `functype/matchable` |
184
- | `pipe` | Function composition utility | `functype/pipe` |
185
-
186
- ## Common Type Patterns
187
-
188
- ### Option Constructors
189
-
190
- ```typescript
191
- Option(value) // Some(value) if value is non-null, None otherwise
192
- Some(value) // Some(value) - explicitly create Some variant
193
- None() // None - explicitly create None variant
194
- Option.from(value) // Alias for Option(value)
195
- Option.none() // Alias for None()
196
- Option.some(value) // Alias for Some(value)
197
- ```
198
-
199
- ### Either Constructors
200
-
201
- ```typescript
202
- Right<L, R>(value) // Right variant with value
203
- Left<L, R>(error) // Left variant with error
204
- Either.right<L, R>(value) // Alias for Right
205
- Either.left<L, R>(error) // Alias for Left
206
- Either.fromNullable(value, error) // Right if value is non-null, Left with error otherwise
207
- ```
208
-
209
- ### Try Constructors
210
-
211
- ```typescript
212
- Try(() => computation) // Success or Failure depending on if computation throws
213
- Success(value) // Explicitly create Success
214
- Failure(error) // Explicitly create Failure
215
- ```
216
-
217
- ### List Constructors
218
-
219
- ```typescript
220
- List([1, 2, 3]) // Create from array
221
- List.empty<number>() // Empty list with specified type
222
- ```
223
-
224
- ### Type Class Composition
225
-
226
- Example of composing operations using type classes:
227
-
228
- ```typescript
229
- // Define a function that works with any Functor
230
- function double<F extends HKT<any, number>>(functor: Functor<F, number>): F {
231
- return functor.map((x) => x * 2)
232
- }
233
-
234
- // Works with any Functor
235
- double(Option(5)) // Some(10)
236
- double(Either.right(5)) // Right(10)
237
- double(List([1, 2, 3])) // List([2, 4, 6])
238
- ```