@visisoft/staticland
Advanced tools
Comparing version 0.1.21 to 0.1.22
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.21 visisoft.de | ||
(Build date: 4/15/2021 - 9:42:54 PM) | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.21 visisoft.de | ||
(Build date: 4/15/2021 - 9:42:54 PM) | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.21 visisoft.de | ||
(Build date: 4/15/2021 - 9:42:54 PM) | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.21 visisoft.de | ||
(Build date: 4/15/2021 - 9:42:54 PM) | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.21 visisoft.de | ||
(Build date: 4/15/2021 - 9:42:54 PM) | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.21 visisoft.de | ||
(Build date: 4/15/2021 - 9:42:54 PM) | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
*/ | ||
@@ -853,6 +853,33 @@ 'use strict'; | ||
/** | ||
* StaticLand: sequence.js | ||
* | ||
* Created by Matthias Seemann on 15.04.2021. | ||
* Copyright (c) 2021 Visisoft OHG. All rights reserved. | ||
* see http://www.tomharding.me/2017/05/08/fantas-eel-and-specification-12/ | ||
*/ | ||
// :: Applicative f => ((a → f a), ((a → b → c) → f a → f b → f c) → [f a] → f [a] | ||
const sequence$1 = semmelRamda.curry((of_f, liftA2_f, lfa) => | ||
semmelRamda.reduce( | ||
(acc, x) => liftA2_f(semmelRamda.append, x, acc), | ||
of_f([]), | ||
lfa | ||
) | ||
); | ||
var traverse$1 = semmelRamda.curry((of_f, liftA2_f, effect_to_f, ma) => | ||
sequence$1(of_f, liftA2_f, semmelRamda.map(effect_to_f, ma))); | ||
var list = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
sequence: sequence$1, | ||
traverse: traverse$1 | ||
}); | ||
exports.C = cancelable; | ||
exports.E = either$1; | ||
exports.L = list; | ||
exports.M = maybe$1; | ||
exports.P = promise; | ||
exports.T = transformations; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.21 visisoft.de | ||
(Build date: 4/15/2021 - 9:42:54 PM) | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
@@ -6,3 +6,4 @@ import {BinaryCurriedFn, PlainObjectOf, TernaryCurriedFn} from './common'; | ||
export type Nothing = []; | ||
export type Maybe<T> = Just<T> | Nothing; | ||
//export type Maybe<T> = Just<T> | Nothing; | ||
export interface Maybe<T> extends Array<T>{} | ||
type Applicative<T> = Promise<T>|Either<T>|PlainObjectOf<T>; | ||
@@ -9,0 +10,0 @@ |
@@ -13,3 +13,3 @@ { | ||
"@most/scheduler": "^1.3.0", | ||
"@rollup/plugin-node-resolve": "^11.0.1", | ||
"@rollup/plugin-node-resolve": "^13.0.4", | ||
"@types/ramda": "^0.27.38", | ||
@@ -95,3 +95,3 @@ "abort-controller": "^3.0.0", | ||
"type": "module", | ||
"version": "0.1.21" | ||
"version": "0.1.22" | ||
} |
@@ -8,5 +8,12 @@ import {BinaryCurriedFn} from './common'; | ||
*/ | ||
export function chain<T, U>(factory: (x: T) => Promise<U>, p: Promise<T>) : Promise<U>; | ||
export function chain<T, U>(factory: (x: T) => Promise<U>): (p: Promise<T>) => Promise<U>; | ||
export function chain<T, U>(factory: (x?: T) => Promise<U>, p: Promise<T>) : Promise<U>; | ||
export function chain<T, U>(factory: (x?: T) => Promise<U>): (p: Promise<T>) => Promise<U>; | ||
// chainRej :: (e -> Promise g a) -> Promise e a -> Promise g b | ||
export function chainRej<T>(onError: (e: any) => Promise<T>, p: Promise<T>) : Promise<T>; | ||
export function chainRej<T>(onError: (e: any) => Promise<T>): (p: Promise<T>) => Promise<T>; | ||
export function chainTap<T>(fn: (x?: T) => Promise<any>, p: Promise<T>): Promise<T>; | ||
export function chainTap<T>(fn: (x?: T) => Promise<any>): (p: Promise<T>) => Promise<T>; | ||
export function later<A>(dt: number, a: A): Promise<A>; | ||
@@ -24,4 +31,4 @@ export function later<A>(dt: number): (a: A) => Promise<A>; | ||
*/ | ||
export function map<T, U>(fn: (x: T) => U, p: Promise<T>): Promise<U>; | ||
export function map<T, U>(fn: (x: T) => U): (p: Promise<T>) => Promise<U>; | ||
export function map<T, U>(fn: (x?: T) => U, p: Promise<T>): Promise<U>; | ||
export function map<T, U>(fn: (x?: T) => U): (p: Promise<T>) => Promise<U>; | ||
@@ -32,3 +39,3 @@ /** | ||
*/ | ||
export function tap<T>(fn: (x: T) => any, p: Promise<T>): Promise<T>; | ||
export function tap<T>(fn: (x: T) => any): (p: Promise<T>) => Promise<T>; | ||
export function tap<T>(fn: (x?: T) => any, p: Promise<T>): Promise<T>; | ||
export function tap<T>(fn: (x?: T) => any): (p: Promise<T>) => Promise<T>; |
[![Dependencies](https://img.shields.io/david/semmel/StaticLand.svg?style=flat-square)](https://david-dm.org/semmel/StaticLand) [![NPM Version](https://img.shields.io/npm/v/@visisoft/staticland.svg?style=flat-square)](https://www.npmjs.com/package/@visisoft/staticland) | ||
[@visisoft/staticland](https://semmel.github.io/StaticLand/) | ||
[@visisoft/staticland](https://semmel.github.io/StaticLand/) v{{ config.meta.version }} | ||
==================== | ||
Operations on Algebraic Data Types (ADT) (Either, Maybe, Promise, CancelableComputation) realised with *free static functions*. The static functions do not expect custom-made ADT classes but work on the *native JavaScript types* as `Array`, `Promise` and `Function`. Fairness demands to confess that `Function` carries some data in the closed over variables. | ||
Operations on Algebraic Data Types (ADT) (Either, Maybe, Promise, CancelableComputation) realised with *free static functions*. The static functions do not expect custom-made ADT classes but work on the *native JavaScript types* as `Array`, `Promise` and `Function`. Fairness demands to confess that `Function` carries some data in [closed over](#closed-over) variables. | ||
@@ -104,2 +104,6 @@ Using simple native types means that | ||
###### closed over | ||
A [closure] is the combination of a function and the lexical environment within which that function was declared. | ||
[closure]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures | ||
[sl-ref]: https://github.com/fantasyland/static-land/ | ||
@@ -106,0 +110,0 @@ [ramda-homepage]: https://ramdajs.com |
@@ -6,3 +6,4 @@ import {BinaryCurriedFn, PlainObjectOf, TernaryCurriedFn} from './common'; | ||
export type Nothing = []; | ||
export type Maybe<T> = Just<T> | Nothing; | ||
//export type Maybe<T> = Just<T> | Nothing; | ||
export interface Maybe<T> extends Array<T>{} | ||
type Applicative<T> = Promise<T>|Either<T>|PlainObjectOf<T>; | ||
@@ -9,0 +10,0 @@ |
@@ -8,5 +8,12 @@ import {BinaryCurriedFn} from './common'; | ||
*/ | ||
export function chain<T, U>(factory: (x: T) => Promise<U>, p: Promise<T>) : Promise<U>; | ||
export function chain<T, U>(factory: (x: T) => Promise<U>): (p: Promise<T>) => Promise<U>; | ||
export function chain<T, U>(factory: (x?: T) => Promise<U>, p: Promise<T>) : Promise<U>; | ||
export function chain<T, U>(factory: (x?: T) => Promise<U>): (p: Promise<T>) => Promise<U>; | ||
// chainRej :: (e -> Promise g a) -> Promise e a -> Promise g b | ||
export function chainRej<T>(onError: (e: any) => Promise<T>, p: Promise<T>) : Promise<T>; | ||
export function chainRej<T>(onError: (e: any) => Promise<T>): (p: Promise<T>) => Promise<T>; | ||
export function chainTap<T>(fn: (x?: T) => Promise<any>, p: Promise<T>): Promise<T>; | ||
export function chainTap<T>(fn: (x?: T) => Promise<any>): (p: Promise<T>) => Promise<T>; | ||
export function later<A>(dt: number, a: A): Promise<A>; | ||
@@ -24,4 +31,4 @@ export function later<A>(dt: number): (a: A) => Promise<A>; | ||
*/ | ||
export function map<T, U>(fn: (x: T) => U, p: Promise<T>): Promise<U>; | ||
export function map<T, U>(fn: (x: T) => U): (p: Promise<T>) => Promise<U>; | ||
export function map<T, U>(fn: (x?: T) => U, p: Promise<T>): Promise<U>; | ||
export function map<T, U>(fn: (x?: T) => U): (p: Promise<T>) => Promise<U>; | ||
@@ -32,3 +39,3 @@ /** | ||
*/ | ||
export function tap<T>(fn: (x: T) => any, p: Promise<T>): Promise<T>; | ||
export function tap<T>(fn: (x: T) => any): (p: Promise<T>) => Promise<T>; | ||
export function tap<T>(fn: (x?: T) => any, p: Promise<T>): Promise<T>; | ||
export function tap<T>(fn: (x?: T) => any): (p: Promise<T>) => Promise<T>; |
120771
3056
115