Skip to content

Commit

Permalink
feat: manually pull 2.0 changes from local fossil copy
Browse files Browse the repository at this point in the history
This is technically may commits squashed into one. I am moving away from fossil
to a simple self-hosted git server and jujutsu as the standard commit tool. I'll
also keep the github remote up to date going forward. This should be a complete,
test passing commit.
  • Loading branch information
baetheus committed Oct 9, 2023
1 parent d424e8c commit 8a16e1f
Show file tree
Hide file tree
Showing 71 changed files with 3,994 additions and 1,256 deletions.
Binary file removed .fslckout
Binary file not shown.
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,52 +43,51 @@ structures and more general algebraic structures.
| Type | Algebraic Data Type | Algebraic Structure | Native | Other Names |
| ------------------------------------ | ------------------- | ------------------- | ------ | ------------------------------------- |
| [Applicable](./applicable.ts) | || | Applicative |
| [ReadonlyArray](./array.ts) || || Array |
| [Async](./async.ts) || | | Task |
| [AsyncEither](./async_either.ts) || | | TaskEither |
| [AsyncIterable](./async_iterable.ts) || || |
| [Bimappable](./bimappable.ts) | || | Bifunctor, Covariant Bifunctor |
| [Boolean](./boolean.ts) || || |
| [Combinable](./combinable.ts) | || | Semigroup |
| [Comparable](./comparable.ts) | || | Setoid, Eq |
| [Composable](./composable.ts) | || | Category |
| [Decoder](./decoder.ts) || | | |
| [Either](./either.ts) || | | |
| [Failable](./failable.ts) | || | Validation |
| [Filterable](./filterable.ts) | || | |
| [Flatmappable](./flatmappable.ts) | || | Monad |
| [Foldable](./foldable.ts) | || | Reducible |
| [Initializable](./initializable.ts) | || | Monoid |
| [Mappable](./mappable.ts) | || | Functor, Covariant Functor |
| [Premappable](./premappable.ts) | || | Contravariant, Contravariant Functor |
| [Schemable](./schemable.ts) | || | |
| [Showable](./showable.ts) | || | Show |
| [Sortable](./sortable.ts) | || | Ord |
| [Traversable](./traversable.ts) | || | |
| [Wrappable](./wrappable.ts) | || | Pointed |
| [ReadonlyArray](./array.ts) || || Array |
| [Async](./async.ts) || | | Task |
| [AsyncEither](./async_either.ts) || | | TaskEither |
| [AsyncIterable](./async_iterable.ts) || || |
| [Boolean](./boolean.ts) || || |
| [Decoder](./decoder.ts) || | | |
| [Either](./either.ts) || | | |
| [Fn](./fn.ts) || || Reader |
| [FnEither](./fn_either.ts) || | | ReaderEither |
| [Free](./free.ts) || | | FreeSemigroup |
| [Identity](./identity.ts) || | | Trivial |
| [Initializable](./initializable.ts) | || | Monoid |
| [Iterable](./iterable.ts) || || |
| [JsonSchema](./json_schema.ts) || | | |
| [ReadonlyMap](./map.ts) || || Map |
| [Mappable](./mappable.ts) | || | Functor, Covariant Functor |
| [Newtype](./newtype.ts) | | | | Brand, Branded Type |
| [Nilable](./nilable.ts) || | | |
| [Number](./number.ts) || || |
| [Optic](./optic.ts) || | | Iso, Lens, Optional, Prism, Traversal |
| [Option](./option.ts) || | | Maybe |
| [Pair](./pair.ts) || | | Separated |
| [Predicate](./predicate.ts) || | | |
| [Premappable](./premappable.ts) | || | Contravariant, Contravariant Functor |
| [Promise](./promise.ts) || || |
| [Reducible](./reducible.ts) | || | Foldable |
| [Refinement](./refinement.ts) || | | |
| [Schemable](./schemable.ts) | || | |
| [ReadonlySet](./set.ts) || || Set |
| [Showable](./showable.ts) | || | Show |
| [Sortable](./sortable.ts) | || | Ord |
| [State](./state.ts) || | | |
| [String](./string.ts) || || |
| [Sync](./sync.ts) || | | IO |
| [SyncEither](./sync_either.ts) || | | IOEither |
| [These](./these.ts) || | | |
| [Traversable](./traversable.ts) | || | |
| [Tree](./tree.ts) || | | |
| [Wrappable](./wrappable.ts) | || | Pointed |

## Major Versions

Expand Down
90 changes: 84 additions & 6 deletions async_either.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@

import type { Kind, Out } from "./kind.ts";
import type { Applicable } from "./applicable.ts";
import type { Async } from "./async.ts";
import type { Bimappable } from "./bimappable.ts";
import type { Combinable } from "./combinable.ts";
import type { Either } from "./either.ts";
import type { Failable } from "./failable.ts";
import type { Flatmappable } from "./flatmappable.ts";
import type { Async } from "./async.ts";
import type { Initializable } from "./initializable.ts";
import type { Mappable } from "./mappable.ts";
import type { Wrappable } from "./wrappable.ts";

import * as E from "./either.ts";
import * as A from "./async.ts";
import * as P from "./promise.ts";
import { createBind, createTap } from "./flatmappable.ts";
import { createBindTo } from "./mappable.ts";
import { handleThrow, pipe } from "./fn.ts";
import { resolve } from "./promise.ts";

Expand Down Expand Up @@ -369,13 +375,30 @@ export function match<L = unknown, R = unknown, B = never>(
/**
* @since 2.0.0
*/
export function getCombinableAsyncEither<A, B>(CA: Combinable<A>, CB: Combinable<B>): Combinable<AsyncEither<B, A>> {
const combinableEither = E.getRightInitializable

export function getCombinableAsyncEither<A, B>(
CA: Combinable<A>,
CB: Combinable<B>,
): Combinable<AsyncEither<B, A>> {
const { combine } = E.getCombinableEither(CA, CB);
return {
combine: second => first => async () =>
combine: (second) => (first) => async () =>
combine(await second())(await first()),
};
}

}
/**
* @since 2.0.0
*/
export function getInitializableAsyncEither<A, B>(
CA: Initializable<A>,
CB: Initializable<B>,
): Initializable<AsyncEither<B, A>> {
const { init, combine } = E.getInitializableEither(CA, CB);
return {
init: () => () => resolve(init()),
combine: (second) => (first) => async () =>
combine(await second())(await first()),
};
}

/**
Expand Down Expand Up @@ -415,3 +438,58 @@ export const FlatmappableAsyncEitherSequential: Flatmappable<KindAsyncEither> =
map,
flatmap,
};

/**
* @since 2.0.0
*/
export const FailableAsyncEitherParallel: Failable<KindAsyncEither> = {
wrap,
apply,
map,
flatmap,
alt,
fail,
recover,
};

/**
* @since 2.0.0
*/
export const FailableAsyncEitherSequential: Failable<KindAsyncEither> = {
wrap,
apply: applySequential,
map,
flatmap,
alt,
fail,
recover,
};

/**
* @since 2.0.0
*/
export const MappableAsyncEither: Mappable<KindAsyncEither> = {
map,
};

/**
* @since 2.0.0
*/
export const WrappableAsyncEither: Wrappable<KindAsyncEither> = {
wrap,
};

/**
* @since 2.0.0
*/
export const tap = createTap(FlatmappableAsyncEitherParallel);

/**
* @since 2.0.0
*/
export const bind = createBind(FlatmappableAsyncEitherParallel);

/**
* @since 2.0.0
*/
export const bindTo = createBindTo(FlatmappableAsyncEitherParallel);
Loading

0 comments on commit 8a16e1f

Please sign in to comment.