@@ -10,90 +10,90 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1010
1111### Added
1212- ** ` tap ` helper function** : Executes side-effects in functional pipelines without altering data flow.
13- - Generic utility that works with any type (monads, primitives, objects, arrays).
14- - Useful for debugging, logging, metrics, and error tracking.
15- - Example:
16- ``` ts
17- pipe (
18- just (42 ),
19- tap (x => console .log (' Value:' , x )),
20- map (x => x * 2 )
21- );
22- ```
13+ - Generic utility that works with any type (monads, primitives, objects, arrays).
14+ - Useful for debugging, logging, metrics, and error tracking.
15+ - Example:
16+ ``` ts
17+ pipe (
18+ just (42 ),
19+ tap (x => console .log (' Value:' , x )),
20+ map (x => x * 2 )
21+ );
22+ ```
2323
2424- ** ` inspect ` helper function ** : Logs values with optional labels for debugging.
25- - Specialized version of ` tap ` that automatically uses ` console.log ` .
26- - Convenient for quick debugging with optional label prefixes.
27- - Example:
28- ``` ts
29- pipe (
30- just (42 ),
31- inspect (' After init' ), // Logs: "After init: Just(42)"
32- map (x => x * 2 ),
33- inspect (' Final result' )
34- );
35- ```
25+ - Specialized version of `tap` that automatically uses `console.log`.
26+ - Convenient for quick debugging with optional label prefixes.
27+ - Example:
28+ ```ts
29+ pipe(
30+ just (42),
31+ inspect(' After init' ), // Logs: "After init: Just(42)"
32+ map(x = > x * 2 ),
33+ inspect(' Final result' )
34+ );
35+ ```
3636
3737- ** ` all ` combinator for ` Maybe ` , ` Result ` , and ` Either ` ** : Combines an array of monads into a single monad containing an array of values .
38- - ` Maybe ` : Returns ` Just ` with all values if all are ` Just ` , or ` Nothing ` if any is ` Nothing ` .
39- - ` Result ` /` Either ` : Collects ** all** errors if any fail.
40- - ** Heterogeneous tuple support** : Preserves different types in arrays using advanced TypeScript type inference.
41- - Example:
42- ``` ts
43- all ([just (1 ), just (2 ), just (3 )]).unwrapOr ([]); // [1, 2, 3]
44- all ([ok (1 ), err (' e1' ), err (' e2' )]); // Err(['e1', 'e2'])
45- all ([just (42 ), just (" hello" ), just (true )]); // Just<[number, string, boolean]>
46- ```
38+ - ` Maybe ` : Returns ` Just ` with all values if all are ` Just ` , or ` Nothing ` if any is ` Nothing ` .
39+ - ` Result ` / ` Either ` : Collects ** all ** errors if any fail .
40+ - ** Heterogeneous tuple support ** : Preserves different types in arrays using advanced TypeScript type inference .
41+ - Example:
42+ ```ts
43+ all([just(1), just(2), just(3)]).unwrapOr([]); // [1, 2, 3]
44+ all ([ok (1 ), err (' e1' ), err (' e2' )]); // Err(['e1', 'e2'])
45+ all ([just (42 ), just (" hello" ), just (true )]); // Just<[number, string, boolean]>
46+ ```
4747
4848- ** ` sequence ` combinator for ` Result ` and ` Either ` ** : Combines an array of monads with fail - fast behavior .
49- - Stops at the ** first** error instead of collecting all errors.
50- - Returns single error type instead of array.
51- - ** Heterogeneous tuple support** : Preserves different types in arrays.
52- - Example:
53- ``` ts
54- sequence ([ok (1 ), err (' e1' ), err (' e2' )]); // Err('e1') - stops at first!
55- ```
49+ - Stops at the ** first ** error instead of collecting all errors .
50+ - Returns single error type instead of array.
51+ - **Heterogeneous tuple support**: Preserves different types in arrays.
52+ - Example:
53+ ```ts
54+ sequence([ok(1), err('e1'), err('e2')]); // Err('e1') - stops at first!
55+ ```
5656
5757- ** ` partition ` function for `Result` and `Either`** : Separates an array of monads into successes and failures.
58- - Returns a plain object with two arrays (not a monad).
59- - Always processes all items.
60- - ** Heterogeneous tuple support** : Preserves different types in returned arrays.
61- - Example:
62- ``` ts
63- partition ([ok (1 ), err (' e1' ), ok (2 ), err (' e2' )]);
64- // { oks: [1, 2], errs: ['e1', 'e2'] }
65- ```
58+ - Returns a plain object with two arrays (not a monad ).
59+ - Always processes all items.
60+ - ** Heterogeneous tuple support** : Preserves different types in returned arrays.
61+ - Example:
62+ ```ts
63+ partition([ok (1 ), err (' e1' ), ok (2 ), err (' e2' )]);
64+ // { oks: [1, 2], errs: ['e1', 'e2'] }
65+ ```
6666
6767- ** Common Patterns documentation ** : Added comprehensive documentation section with practical recipes for :
68- - Validation pipelines with multiple checks
69- - Form validation with error collection
70- - Concurrent operations handling
71- - Async error handling patterns
72- - Data transformation pipelines
68+ - Validation pipelines with multiple checks
69+ - Form validation with error collection
70+ - Concurrent operations handling
71+ - Async error handling patterns
72+ - Data transformation pipelines
7373
7474-- -
7575
7676## [[1.1 .0 ]](https :// github.com/richecr/holo-fn/releases/tag/v1.1.0) - 2025-11-30
7777
7878### Added
7979- ** ` filter ` method for ` Maybe ` ** : Validates values with a predicate , converting ` Just ` to ` Nothing ` when the predicate fails .
80- - Added ` filter(predicate: (value: T) => boolean): Maybe<T> ` method to ` Maybe ` interface.
81- - Added curried ` filter ` function for use with ` pipe ` .
82- - Example:
83- ``` ts
84- just (25 ).filter (x => x >= 18 ).unwrapOr (0 ); // 25
85- just (15 ).filter (x => x >= 18 ).unwrapOr (0 ); // 0
86- ```
80+ - Added ` filter(predicate: (value: T) => boolean): Maybe<T> ` method to ` Maybe ` interface .
81+ - Added curried ` filter ` function for use with `pipe`.
82+ - Example:
83+ ```ts
84+ just(25).filter(x = > x >= 18 ).unwrapOr(0); // 25
85+ just (15 ).filter (x => x >= 18 ).unwrapOr (0 ); // 0
86+ ` ` `
8787
8888- ** ` validate ` method for ` Result ` and ` Either ` **: Validates values with custom error messages.
89- - Added ` validate(predicate: (value: T) => boolean, error: E): Result<T, E> ` to ` Result ` .
90- - Added ` validate(predicate: (value: R) => boolean, leftValue: L): Either<L, R> ` to ` Either ` .
91- - Added curried ` validate ` functions for use with ` pipe ` .
92- - Example:
93- ``` ts
94- ok (25 ).validate (x => x >= 18 , ' Must be 18+' ).unwrapOr (0 ); // 25
95- ok (15 ).validate (x => x >= 18 , ' Must be 18+' ).isErr (); // true
96- ```
89+ - Added ` validate (predicate : (value : T ) => boolean , error : E ): Result <T , E >` to ` Result ` .
90+ - Added ` validate (predicate : (value : R ) => boolean , leftValue : L ): Either <L , R >` to ` Either ` .
91+ - Added curried ` validate ` functions for use with ` pipe ` .
92+ - Example:
93+ ` ` ` ts
94+ ok (25 ).validate (x => x >= 18 , ' Must be 18+' ).unwrapOr (0 ); // 25
95+ ok (15 ).validate (x => x >= 18 , ' Must be 18+' ).isErr (); // true
96+ ` ` `
9797
9898---
9999
@@ -102,30 +102,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
102102### Added
103103- First stable release of ` holo - fn ` with core monads: ` Maybe ` , ` Either ` , and ` Result ` .
104104- ` Maybe ` monad:
105- - ` Just ` , ` Nothing ` , and helper functions like ` fromNullable ` .
106- - Added methods like ` map ` , ` chain ` , ` unwrapOr ` , ` match ` , and ` equals ` .
105+ - ` Just ` , ` Nothing ` , and helper functions like ` fromNullable ` .
106+ - Added methods like ` map ` , ` chain ` , ` unwrapOr ` , ` match ` , and ` equals ` .
107107- ` Either ` monad:
108- - ` Left ` , 'Right', and helper functions like ` tryCatch ` , ` fromPromise ` , ` fromAsync ` .
109- - Added methods like ` map ` , ` chain ` , ` unwrapOr ` , ` match ` , and ` equals ` .
108+ - ` Left ` , 'Right', and helper functions like ` tryCatch ` , ` fromPromise ` , ` fromAsync ` .
109+ - Added methods like ` map ` , ` chain ` , ` unwrapOr ` , ` match ` , and ` equals ` .
110110- ` Result ` monad:
111- - ` Ok ` , ` Err ` , and helper functions like ` fromThrowable ` , ` fromPromise ` , ` fromAsync ` .
112- - Added methods like ` map ` , ` chain ` , ` unwrapOr ` , ` match ` , and ` equals ` .
111+ - ` Ok ` , ` Err ` , and helper functions like ` fromThrowable ` , ` fromPromise ` , ` fromAsync ` .
112+ - Added methods like ` map ` , ` chain ` , ` unwrapOr ` , ` match ` , and ` equals ` .
113113- Introduced ` curried functions ` for ` map ` , ` chain ` , ` unwrapOr ` , and ` match ` for each monad:
114- - ` map ` , ` chain ` , ` unwrapOr ` , and ` match ` for ` Either ` , ` Maybe ` and ` Result ` .
114+ - ` map ` , ` chain ` , ` unwrapOr ` , and ` match ` for ` Either ` , ` Maybe ` and ` Result ` .
115115- ` Export restructuring ` :
116- - Now, monads are imported from their specific files, instead of a global import.
117- - Example:
118- ``` ts
119- import { M , E , R } from " holo-fn" ;
120- import { fromNullable } from ' holo-fn/maybe' ;
121- import { tryCatch } from ' holo-fn/either' ;
122- import { fromThrowable } from ' holo-fn/result' ;
123- ```
116+ - Now, monads are imported from their specific files, instead of a global import.
117+ - Example:
118+ ` ` ` ts
119+ import { M , E , R } from " holo-fn" ;
120+ import { fromNullable } from ' holo-fn/maybe' ;
121+ import { tryCatch } from ' holo-fn/either' ;
122+ import { fromThrowable } from ' holo-fn/result' ;
123+ ` ` `
124124
125125### Changed
126126- ` Migration to Bun ` : The library is now compatible with ` Bun ` runtime, offering better performance and faster execution.
127127- Reorganized the imports for better modularization and performance.
128- - Now, to use specific monads and functions, you must import from their respective files.
128+ - Now, to use specific monads and functions, you must import from their respective files.
129129
130130### Fixed
131131- Fixed ` bug ` related to circular imports.
@@ -137,15 +137,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
137137
138138### Added
139139- New helpers functions:
140- - Maybe:
141- - just(value: T): Maybe<T >: Creates a ` Just ` value representing the presence of a value.
142- - nothing<T = never>(): Maybe<T >: Creates a ` Nothing ` value representing the absence of a value.
143- - Either:
144- - left<L, R = never>(value: L): Either<L, R>: Creates a ` Left ` value representing a failure or error.
145- - right<L, R>(value: R): Either<L, R>: Creates a ` Right ` value representing a success.
146- - Result:
147- - ok<T, E>(value: T): Result<T, E>: Creates an ` Ok ` value representing the success of an operation with a value.
148- - err<T, E>(error: E): Result<T, E>: Creates an ` Err ` value representing a failure of an operation with an error.
140+ - Maybe:
141+ - just(value: T): Maybe<T>: Creates a ` Just ` value representing the presence of a value.
142+ - nothing<T = never>(): Maybe<T>: Creates a ` Nothing ` value representing the absence of a value.
143+ - Either:
144+ - left<L, R = never>(value: L): Either<L, R>: Creates a ` Left ` value representing a failure or error.
145+ - right<L, R>(value: R): Either<L, R>: Creates a ` Right ` value representing a success.
146+ - Result:
147+ - ok<T, E>(value: T): Result<T, E>: Creates an ` Ok ` value representing the success of an operation with a value.
148+ - err<T, E>(error: E): Result<T, E>: Creates an ` Err ` value representing a failure of an operation with an error.
149149
150150---
151151
@@ -154,9 +154,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
154154### Added
155155- Introduced the ` equals ` method for **Maybe**, **Either**, and **Result** types to compare instances of these types based on their internal values.
156156- Added **curried functions** for ` equals ` to allow for easier composition and usage:
157- - ` equalsM ` for ** Maybe** .
158- - ` equalsE ` for ** Either** .
159- - ` equalsR ` for ** Result** .
157+ - ` equalsM ` for **Maybe**.
158+ - ` equalsE ` for **Either**.
159+ - ` equalsR ` for **Result**.
160160- New helper functions for easy comparison between monadic values.
161161
162162### Changed
@@ -173,8 +173,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
173173- ` Either ` monad: ` Left ` , ` Right ` , ` tryCatch ` , ` fromPromise ` , ` fromAsync ` .
174174- ` Result ` monad: ` Ok ` , ` Err ` , ` fromThrowable ` , ` fromPromise ` , ` fromAsync ` .
175175- Added **curried handlers** for ` map ` , ` chain ` , ` unwrapOr ` , and ` match ` for better composition and functional pipelines:
176- - ` mapE ` , ` chainE ` , ` unwrapOrE ` , and ` matchE ` for ` Either ` .
177- - ` mapM ` , ` chainM ` , ` unwrapOrM ` , and ` matchM ` for ` Maybe ` .
178- - ` mapR ` , ` chainR ` , ` unwrapOrR ` , and ` matchR ` for ` Result ` .
176+ - ` mapE ` , ` chainE ` , ` unwrapOrE ` , and ` matchE ` for ` Either ` .
177+ - ` mapM ` , ` chainM ` , ` unwrapOrM ` , and ` matchM ` for ` Maybe ` .
178+ - ` mapR ` , ` chainR ` , ` unwrapOrR ` , and ` matchR ` for ` Result ` .
179179
180180---
0 commit comments