functype 0.8.83 → 0.8.85

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 (38) hide show
  1. package/dist/{Either-CncND8cm.d.ts → Either-BlY4VB1r.d.ts} +3 -3
  2. package/dist/{chunk-JMCOLAJY.mjs → chunk-JAPOUVPL.mjs} +2 -2
  3. package/dist/chunk-JAPOUVPL.mjs.map +1 -0
  4. package/dist/either/index.d.ts +1 -1
  5. package/dist/either/index.mjs +1 -1
  6. package/dist/fpromise/index.d.ts +1 -1
  7. package/dist/fpromise/index.mjs +1 -1
  8. package/dist/index.d.ts +3 -28
  9. package/dist/index.mjs +1 -1
  10. package/dist/list/index.d.ts +1 -1
  11. package/dist/list/index.mjs +1 -1
  12. package/dist/map/index.d.ts +1 -1
  13. package/dist/map/index.mjs +1 -1
  14. package/dist/option/index.d.ts +1 -1
  15. package/dist/option/index.mjs +1 -1
  16. package/dist/set/index.d.ts +1 -1
  17. package/dist/set/index.mjs +1 -1
  18. package/dist/try/index.d.ts +1 -1
  19. package/dist/try/index.mjs +1 -1
  20. package/package.json +1 -1
  21. package/dist/chunk-JMCOLAJY.mjs.map +0 -1
  22. package/readme/BUNDLE_OPTIMIZATION.md +0 -74
  23. package/readme/FPromise-Assessment.md +0 -43
  24. package/readme/HKT.md +0 -110
  25. package/readme/ROADMAP.md +0 -113
  26. package/readme/TASK-IMPLEMENTATION.md +0 -290
  27. package/readme/TASK-TODO.md +0 -40
  28. package/readme/TASK-UPDATES.md +0 -64
  29. package/readme/TUPLE-EXAMPLES.md +0 -76
  30. package/readme/TaskMigration.md +0 -129
  31. package/readme/ai-guide.md +0 -406
  32. package/readme/examples.md +0 -2093
  33. package/readme/quick-reference.md +0 -514
  34. package/readme/task-cancellation-progress.md +0 -258
  35. package/readme/task-error-handling.md +0 -127
  36. package/readme/task-quick-reference.md +0 -157
  37. package/readme/tasks.md +0 -205
  38. package/readme/type-index.md +0 -238
package/readme/tasks.md DELETED
@@ -1,205 +0,0 @@
1
- # Functype Improvement Ideas
2
-
3
- This document contains a comprehensive list of potential improvement ideas for the Functype library. These ideas represent possible directions for the library but should be evaluated against the core principles of maintaining a lightweight, focused approach as outlined in the README.md and implemented according to the official ROADMAP.md timeline.
4
-
5
- > **Note**: Not all ideas listed here will necessarily be implemented. Each should be evaluated based on:
6
- >
7
- > - Alignment with the "lightweight" philosophy of the library
8
- > - Prioritization in the official ROADMAP.md
9
- > - Value to users vs. complexity added
10
- > - Maintenance burden
11
-
12
- ## Core Functionality Enhancements
13
-
14
- ### Data Structures and Types
15
-
16
- [ ] Implement LazyList/Stream for efficient processing of potentially infinite sequences
17
- [ ] Create Validation data type for applicative validation with error accumulation
18
- [ ] Implement Reader monad for dependency injection patterns
19
- [ ] Add State monad for functional state management
20
- [ ] Create IO monad for pure handling of side effects
21
- [ ] Implement lens/optics abstractions for immutable updates
22
- [x] Add Traversable implementation for all collection types
23
- [ ] Implement Semigroup and Monoid type classes
24
- [ ] Create NonEmptyList type with stronger guarantees than regular List
25
- [x] Implement pipe operation for transforming data structures
26
-
27
- ### Error Handling
28
-
29
- [x] Create standardized error hierarchy for all modules
30
- [x] Implement consistent error context propagation across monadic chains
31
- [x] Add error recovery utilities for all error-producing types
32
- [x] Create error serialization/deserialization utilities for API boundaries
33
- [ ] Implement error aggregation for parallel operations
34
-
35
- ## TypeScript and Type Safety Improvements
36
-
37
- ### Type System Enhancements
38
-
39
- [ ] Remove any usage from higher-kinded type implementations
40
- [x] Expand branded/nominal type system for stronger type safety
41
- [ ] Add more type-level utilities using conditional types and template literals
42
- [ ] Leverage const type parameters for improved type inference
43
- [x] Implement tuple manipulation utilities with type safety
44
- [ ] Create type-safe path accessors for nested object structures
45
- [ ] Add runtime type validation utilities that preserve type information
46
-
47
- ### API Consistency
48
-
49
- [x] Standardize method naming conventions across all modules
50
- [x] Ensure consistent parameter ordering in similar functions
51
- [x] Normalize return types for equivalent operations
52
- [x] Implement consistent pattern for async variants of synchronous methods
53
- [x] Standardize import patterns using @imports throughout the codebase
54
- [x] Create consistent error handling strategy for all modules
55
-
56
- ## Performance Optimizations
57
-
58
- ### Data Structure Efficiency
59
-
60
- [x] Implement structural sharing for immutable collections
61
- [ ] Add memoization utilities for expensive function calls
62
- [x] Optimize recursive operations for large data structures
63
- [x] Implement lazy evaluation for chain operations where possible
64
- [x] Create specialized implementations for common use cases
65
-
66
- ### Bundle Size and Loading
67
-
68
- [x] Analyze and reduce bundle size for core modules
69
- [x] Implement code splitting strategies for large modules
70
- [x] Create lightweight alternatives for performance-critical paths
71
- [x] Add bundle size monitoring to CI/CD pipeline
72
- [x] Optimize tree-shaking with more granular exports
73
-
74
- ## Testing and Quality Assurance
75
-
76
- ### Test Coverage
77
-
78
- [x] Add test coverage metrics and set coverage goals
79
- [x] Implement property-based tests for all data structures
80
- [x] Create exhaustive edge case tests for error handling
81
- [x] Add performance regression tests
82
- [ ] Implement integration tests with popular frameworks and libraries
83
-
84
- ### Code Quality
85
-
86
- [x] Add static analysis tools to CI pipeline
87
- [x] Implement automated code quality checks
88
- [x] Create style guide enforcement tools
89
- [ ] Add complexity metrics monitoring
90
- [ ] Implement automated dependency updates with testing
91
-
92
- ## Documentation and Examples
93
-
94
- ### API Documentation
95
-
96
- [x] Create comprehensive API documentation for all modules
97
- [x] Add usage examples for all public methods
98
- [x] Document performance characteristics and trade-offs
99
- [ ] Create interactive documentation with runnable examples
100
- [ ] Add diagrams for complex concepts and data flows
101
-
102
- ### Guides and Tutorials
103
-
104
- [ ] Create step-by-step migration guides from imperative to functional
105
- [x] Add real-world examples showcasing practical applications
106
- [x] Create beginner-friendly tutorials for functional programming concepts
107
- [x] Implement cookbook-style documentation for common patterns
108
- [ ] Add troubleshooting guides for common issues
109
-
110
- ## Developer Experience
111
-
112
- ### Tooling and Infrastructure
113
-
114
- [x] Create development environment setup scripts
115
- [x] Implement automated release process
116
- [x] Add changelog generation from commit messages
117
- [ ] Create interactive playground for experimenting with the library
118
- [x] Implement benchmarking suite for performance testing
119
-
120
- ### Community and Contribution
121
-
122
- [x] Create detailed contribution guidelines
123
- [x] Implement issue and PR templates
124
- [ ] Add automated issue labeling and triage
125
- [ ] Create community forum or discussion platform
126
- [ ] Implement automated code review tools
127
-
128
- ## Compatibility and Integration
129
-
130
- ### Framework Integration
131
-
132
- [ ] Create React hooks and utilities for Functype integration
133
- [ ] Add Vue composition functions for Functype
134
- [ ] Implement Angular services and utilities
135
- [ ] Create Express/Koa middleware using functional patterns
136
- [ ] Add Next.js integration utilities
137
-
138
- ### Ecosystem Compatibility
139
-
140
- [x] Ensure compatibility with Node.js LTS versions
141
- [x] Maintain browser compatibility across major browsers
142
- [ ] Add support for Deno runtime
143
- [x] Test with various bundlers (webpack, esbuild, Rollup, etc.)
144
- [ ] Create interoperability utilities for other functional libraries
145
-
146
- ## Specific Module Improvements
147
-
148
- ### Option Module
149
-
150
- [x] Add Option.sequence for working with arrays of Options
151
- [x] Implement Option.traverse for mapping and sequencing in one operation
152
- [x] Add Option.fromPredicate for creating Options from boolean conditions
153
- [x] Create Option utilities for working with nullable API responses
154
- [x] Add Option.fromJSON for safely parsing JSON
155
- [x] Implement pipe for transforming Option values
156
-
157
- ### Either Module
158
-
159
- [x] Implement Either.sequence for working with arrays of Eithers
160
- [x] Add Either.traverse for mapping and sequencing in one operation
161
- [x] Create bimap method for mapping both sides of Either
162
- [x] Add Either.fromPredicate with custom error creation
163
- [x] Implement Either utilities for async/await integration
164
- [x] Add pipeEither for type-safe transformations across variants
165
- [x] Implement standard pipe for consistent API with other modules
166
-
167
- ### Task Module
168
-
169
- [x] Add Task.sequence for parallel execution with error handling
170
- [x] Implement Task.traverse for mapping and sequencing in one operation
171
- [x] Create Task.race for racing multiple tasks with timeout support
172
- [x] Add Task retry utilities with exponential backoff
173
- [x] Implement Task.fromNodeCallback for Node.js style callbacks
174
- [x] Implement cancellation support for Task operations
175
- [x] Add progress tracking for long-running Task operations
176
-
177
- ### FPromise Module
178
-
179
- [x] Add timeout support for all FPromise operations
180
- [x] Implement cancellation support for FPromise chains
181
- [x] Create FPromise.allSettled equivalent with typed results
182
- [x] Add FPromise.any with proper typing
183
- [x] Implement progress tracking for long-running operations
184
-
185
- ### Collection Modules
186
-
187
- [x] Implement pipe for List data structure
188
- [x] Implement pipe for Set data structure
189
- [x] Implement pipe for Map data structure
190
- [ ] Add comprehensive conversion utilities between collection types
191
- [ ] Implement more specialized collection operations
192
-
193
- ## Cross-Data Structure Features
194
-
195
- [x] Implement pipe interface for consistent transformation pattern
196
- [x] Create tests demonstrating cross-structure transformations
197
- [x] Add type-safety for transformations across data structures
198
- [x] Document common patterns for functional composition with pipe
199
- [ ] Create additional utility functions for common transformations
200
-
201
- ## Relationship to Official Roadmap
202
-
203
- This document serves as a collection of ideas and potential enhancements for Functype. For the official development plan with prioritized tasks and timeline, please refer to the [ROADMAP.md](ROADMAP.md) file in the project root.
204
-
205
- The official roadmap represents the committed development path, while this document captures a broader set of possibilities that may be considered for future development cycles based on community feedback and evolving requirements.
@@ -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
- ```