@sweet-monads/interfaces
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -5,4 +5,10 @@ import type { Applicative } from "./applicative"; | ||
export interface AsyncApplicative<I> extends AsyncFunctor<I>, Applicative<I> { | ||
asyncApply<A, B>(this: AsyncApplicative<(a: A) => Promise<B>>, arg: AsyncApplicative<Promise<A> | A>): Promise<AsyncApplicative<B>>; | ||
asyncApply<A, B>(this: AsyncApplicative<Promise<A> | A>, fn: AsyncApplicative<(a: A) => Promise<B>>): Promise<AsyncApplicative<B>>; | ||
} | ||
asyncApply<A, B>( | ||
this: AsyncApplicative<(a: A) => Promise<B>>, | ||
arg: AsyncApplicative<Promise<A> | A> | ||
): Promise<AsyncApplicative<B>>; | ||
asyncApply<A, B>( | ||
this: AsyncApplicative<Promise<A> | A>, | ||
fn: AsyncApplicative<(a: A) => Promise<B>> | ||
): Promise<AsyncApplicative<B>>; | ||
} |
@@ -6,2 +6,2 @@ import type { Monad } from "./monad"; | ||
asyncChain<B>(f: (a: T) => Promise<AsyncMonad<B>>): Promise<AsyncMonad<B>>; | ||
} | ||
} |
@@ -10,1 +10,2 @@ export type { Functor } from "./functor"; | ||
export type { Applicative, ApplicativeConstructor } from "./applicative"; | ||
export type { Container } from "./container"; |
{ | ||
"name": "@sweet-monads/interfaces", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Monad interfaces", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,5 +24,5 @@ # @sweet-monads/interfaces | ||
class Container<T> implements Functor<T> { | ||
map<A>(fn: (i: T) => A): Container<A> { | ||
return new Container<A>(); | ||
class MyClass<T> implements Functor<T> { | ||
map<A>(fn: (i: T) => A): MyClass<A> { | ||
return new MyClass<A>(); | ||
} | ||
@@ -387,4 +387,19 @@ } | ||
### Container | ||
Is a value wrapper, that allows to get value (if state of the container is valid), or throws error if not. | ||
Methods: | ||
##### `Container#unwrap` | ||
```typescript | ||
const lucky = Math.random() > 0.5 ? just(":)") : none(); | ||
// Will either return ":)" or throw an error | ||
lucky.unwrap(); | ||
``` | ||
## License | ||
MIT (c) Artem Kobzar see LICENSE file. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15496
14
64
404