Skip to content

Commit

Permalink
fix: Fix parameter order of zipWith
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuroXina committed Aug 14, 2022
1 parent 7083ffb commit e2a1c60
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ export const unzip = <T, U>(opt: Option<[T, U]>): [Option<T>, Option<U>] => {
return [none(), none()];
};
export const zipWith =
<T>(optA: Option<T>) =>
<U>(optB: Option<U>) =>
<R, F extends (t: T, u: U) => R>(fn: F): Option<R> => {
<T, U, R>(fn: (t: T, u: U) => R) =>
(optA: Option<T>) =>
(optB: Option<U>): Option<R> => {
if (isSome(optA) && isSome(optB)) {
return some(fn(optA[1], optB[1]));
}
Expand Down Expand Up @@ -179,6 +179,11 @@ export const optResToResOpt = <E, T>(optRes: Option<Result<E, T>>): Result<E, Op
return err(optRes[1][1]);
};

/*
okOr
okOrElse
*/

export const flatMap = andThen;

declare module "./hkt" {
Expand Down

0 comments on commit e2a1c60

Please sign in to comment.