functype 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ALLQJFGO.cjs +1 -0
- package/dist/chunk-E4GBAXJ4.js +1 -0
- package/dist/chunk-HJKBTHS6.cjs +1 -0
- package/dist/chunk-IU7MDTQA.cjs +1 -0
- package/dist/chunk-LXNGDVCQ.js +1 -0
- package/dist/chunk-MG5D2OQV.js +1 -0
- package/dist/chunk-OAC7TJZK.js +1 -0
- package/dist/chunk-OO6BXJDP.cjs +1 -0
- package/dist/chunk-PXY4XULG.cjs +1 -0
- package/dist/chunk-TZ5KQ47S.js +1 -0
- package/dist/chunk-UHHZ2CVW.js +1 -0
- package/dist/chunk-WAM77UJL.cjs +1 -0
- package/dist/either/Left.cjs +1 -1
- package/dist/either/Left.d.cts +1 -2
- package/dist/either/Left.d.ts +1 -2
- package/dist/either/Left.js +1 -1
- package/dist/either/Right.cjs +1 -1
- package/dist/either/Right.d.cts +1 -2
- package/dist/either/Right.d.ts +1 -2
- package/dist/either/Right.js +1 -1
- package/dist/either/index.cjs +1 -1
- package/dist/either/index.d.cts +1 -2
- package/dist/either/index.d.ts +1 -2
- package/dist/either/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +104 -1
- package/dist/index.d.ts +104 -1
- package/dist/index.js +1 -0
- package/dist/list/List.cjs +1 -1
- package/dist/list/List.d.cts +2 -20
- package/dist/list/List.d.ts +2 -20
- package/dist/list/List.js +1 -1
- package/dist/list/index.cjs +1 -0
- package/dist/list/index.d.cts +2 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +1 -0
- package/dist/option/None.cjs +1 -0
- package/dist/option/None.d.cts +2 -0
- package/dist/option/None.d.ts +2 -0
- package/dist/option/None.js +1 -0
- package/dist/option/Some.cjs +1 -0
- package/dist/option/Some.d.cts +2 -0
- package/dist/option/Some.d.ts +2 -0
- package/dist/option/Some.js +1 -0
- package/dist/option/index.cjs +1 -0
- package/dist/option/index.d.cts +2 -0
- package/dist/option/index.d.ts +2 -0
- package/dist/option/index.js +1 -0
- package/package.json +1 -1
- package/dist/chunk-4EVP3IRI.cjs +0 -1
- package/dist/chunk-ABUN2GHU.js +0 -1
- package/dist/chunk-CB3ZZ3RL.cjs +0 -1
- package/dist/chunk-CN6MP6AJ.js +0 -1
- package/dist/index-28de5927.d.ts +0 -39
- package/dist/index-402b9aa2.d.ts +0 -39
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPXY4XULGcjs = require('./chunk-PXY4XULG.cjs');var n=e=>new (0, _chunkPXY4XULGcjs.a)(e);exports.a = n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./chunk-VTKL7OQI.js";var n=class r{constructor(t){i(this,"items");this.items=t?[...t]:[]}get length(){return this.items.length}add(t){return new r([...this.items,t])}removeAt(t){if(t<0||t>=this.items.length)return this;let e=[...this.items.slice(0,t),...this.items.slice(t+1)];return new r(e)}get(t){return this.items[t]}toArray(){return this.items}map(t){return new r(this.items.map(t))}flatMap(t){return this.items.reduce((e,s)=>e.concat(t(s)),new r)}reduce(t){let e=this.items.reduce(t,void 0);return new r([e])}foldLeft(t,e){return this.items.reduce(e,t)}foldRight(t,e){return this.items.reduceRight((s,u)=>e(u,s),t)}concat(t){return new r([...this.items,...t.items])}toString(){return`List(${this.items.toString()})`}};export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6VKVA3TKcjs = require('./chunk-6VKVA3TK.cjs');var _chunkWAM77UJLcjs = require('./chunk-WAM77UJL.cjs');var _chunkPXY4XULGcjs = require('./chunk-PXY4XULG.cjs');var u=class e{constructor(t){this.value=t}isLeft(){return!1}isRight(){return!0}map(t){return new e(t(this.value))}flatMap(t){return t(this.value)}reduce(t){return new e(t(void 0,this.value))}foldLeft(t,r){return r(t,this.value)}foldRight(t,r){return r(this.value,t)}toOption(){return _chunkWAM77UJLcjs.b.call(void 0, this.value)}toList(){return new (0, _chunkPXY4XULGcjs.a)([this.value])}};var s=e=>new o(e),l= exports.d =e=>new u(e),v= exports.e =e=>{let t=parseInt(e,10);return isNaN(t)?s(new (0, _chunk6VKVA3TKcjs.a)(`${t}`)):l(t)};var o=class e{constructor(t){this.value=t}isLeft(){return!0}isRight(){return!1}map(t){return new e(this.value)}flatMap(t){return new e(this.value)}reduce(t){return new e(this.value)}foldLeft(t,r){return t}foldRight(t,r){return t}toOption(){return _chunkWAM77UJLcjs.c.call(void 0, )}toList(){return new _chunkPXY4XULGcjs.a}};exports.a = o; exports.b = u; exports.c = s; exports.d = l; exports.e = v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPXY4XULGcjs = require('./chunk-PXY4XULG.cjs');var u=class r{constructor(t){this.value=t}isEmpty(){return!1}get(){return this.value}getOrElse(t){return this.value}orElse(t){return this}map(t){return new r(t(this.value))}flatMap(t){return t(this.value)}reduce(t){return new r(t(void 0,this.value))}foldLeft(t,e){return e(t,this.value)}foldRight(t,e){return e(this.value,t)}toList(){return new (0, _chunkPXY4XULGcjs.a)([this.value])}};exports.a = u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-TZ5KQ47S.js";import{a as o}from"./chunk-OAC7TJZK.js";var r=t=>t?n(t):p(),n=t=>new o(t),p=()=>new e;export{r as a,n as b,p as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n}from"./chunk-ZTL76QDL.js";import{b as U,c as a}from"./chunk-LXNGDVCQ.js";import{a as i}from"./chunk-E4GBAXJ4.js";var u=class e{constructor(t){this.value=t}isLeft(){return!1}isRight(){return!0}map(t){return new e(t(this.value))}flatMap(t){return t(this.value)}reduce(t){return new e(t(void 0,this.value))}foldLeft(t,r){return r(t,this.value)}foldRight(t,r){return r(this.value,t)}toOption(){return U(this.value)}toList(){return new i([this.value])}};var s=e=>new o(e),l=e=>new u(e),v=e=>{let t=parseInt(e,10);return isNaN(t)?s(new n(`${t}`)):l(t)};var o=class e{constructor(t){this.value=t}isLeft(){return!0}isRight(){return!1}map(t){return new e(this.value)}flatMap(t){return new e(this.value)}reduce(t){return new e(this.value)}foldLeft(t,r){return t}foldRight(t,r){return t}toOption(){return a()}toList(){return new i}};export{o as a,u as b,s as c,l as d,v as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-E4GBAXJ4.js";var u=class r{constructor(t){this.value=t}isEmpty(){return!1}get(){return this.value}getOrElse(t){return this.value}orElse(t){return this}map(t){return new r(t(this.value))}flatMap(t){return t(this.value)}reduce(t){return new r(t(void 0,this.value))}foldLeft(t,e){return e(t,this.value)}foldRight(t,e){return e(this.value,t)}toList(){return new a([this.value])}};export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPXY4XULGcjs = require('./chunk-PXY4XULG.cjs');var n=class e{isEmpty(){return!0}get(){throw new Error("Cannot call get() on a None")}getOrElse(t){return t}orElse(t){return t}map(t){return new e}flatMap(t){return new e}reduce(t){return new e}foldLeft(t,o){return t}foldRight(t,o){return t}toList(){return new _chunkPXY4XULGcjs.a}};exports.a = n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGWLTG6GZcjs = require('./chunk-GWLTG6GZ.cjs');var n=class r{constructor(t){_chunkGWLTG6GZcjs.a.call(void 0, this,"items");this.items=t?[...t]:[]}get length(){return this.items.length}add(t){return new r([...this.items,t])}removeAt(t){if(t<0||t>=this.items.length)return this;let e=[...this.items.slice(0,t),...this.items.slice(t+1)];return new r(e)}get(t){return this.items[t]}toArray(){return this.items}map(t){return new r(this.items.map(t))}flatMap(t){return this.items.reduce((e,s)=>e.concat(t(s)),new r)}reduce(t){let e=this.items.reduce(t,void 0);return new r([e])}foldLeft(t,e){return this.items.reduce(e,t)}foldRight(t,e){return this.items.reduceRight((s,u)=>e(u,s),t)}concat(t){return new r([...this.items,...t.items])}toString(){return`List(${this.items.toString()})`}};exports.a = n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk-E4GBAXJ4.js";var n=class e{isEmpty(){return!0}get(){throw new Error("Cannot call get() on a None")}getOrElse(t){return t}orElse(t){return t}map(t){return new e}flatMap(t){return new e}reduce(t){return new e}foldLeft(t,o){return t}foldRight(t,o){return t}toList(){return new r}};export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-E4GBAXJ4.js";var n=e=>new t(e);export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOO6BXJDPcjs = require('./chunk-OO6BXJDP.cjs');var _chunkIU7MDTQAcjs = require('./chunk-IU7MDTQA.cjs');var r=t=>t?n(t):p(),n= exports.b =t=>new (0, _chunkIU7MDTQAcjs.a)(t),p= exports.c =()=>new _chunkOO6BXJDPcjs.a;exports.a = r; exports.b = n; exports.c = p;
|
package/dist/either/Left.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHJKBTHS6cjs = require('../chunk-HJKBTHS6.cjs');require('../chunk-6VKVA3TK.cjs');require('../chunk-WAM77UJL.cjs');require('../chunk-OO6BXJDP.cjs');require('../chunk-IU7MDTQA.cjs');require('../chunk-ALLQJFGO.cjs');require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.Left = _chunkHJKBTHS6cjs.a;
|
package/dist/either/Left.d.cts
CHANGED
package/dist/either/Left.d.ts
CHANGED
package/dist/either/Left.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-MG5D2OQV.js";import"../chunk-ZTL76QDL.js";import"../chunk-LXNGDVCQ.js";import"../chunk-TZ5KQ47S.js";import"../chunk-OAC7TJZK.js";import"../chunk-UHHZ2CVW.js";import"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as Left};
|
package/dist/either/Right.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHJKBTHS6cjs = require('../chunk-HJKBTHS6.cjs');require('../chunk-6VKVA3TK.cjs');require('../chunk-WAM77UJL.cjs');require('../chunk-OO6BXJDP.cjs');require('../chunk-IU7MDTQA.cjs');require('../chunk-ALLQJFGO.cjs');require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.Right = _chunkHJKBTHS6cjs.b;
|
package/dist/either/Right.d.cts
CHANGED
package/dist/either/Right.d.ts
CHANGED
package/dist/either/Right.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{b as a}from"../chunk-MG5D2OQV.js";import"../chunk-ZTL76QDL.js";import"../chunk-LXNGDVCQ.js";import"../chunk-TZ5KQ47S.js";import"../chunk-OAC7TJZK.js";import"../chunk-UHHZ2CVW.js";import"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as Right};
|
package/dist/either/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHJKBTHS6cjs = require('../chunk-HJKBTHS6.cjs');require('../chunk-6VKVA3TK.cjs');require('../chunk-WAM77UJL.cjs');require('../chunk-OO6BXJDP.cjs');require('../chunk-IU7MDTQA.cjs');require('../chunk-ALLQJFGO.cjs');require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.Left = _chunkHJKBTHS6cjs.a; exports.Right = _chunkHJKBTHS6cjs.b; exports.left = _chunkHJKBTHS6cjs.c; exports.parseNumber = _chunkHJKBTHS6cjs.e; exports.right = _chunkHJKBTHS6cjs.d;
|
package/dist/either/index.d.cts
CHANGED
package/dist/either/index.d.ts
CHANGED
package/dist/either/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-MG5D2OQV.js";import"../chunk-ZTL76QDL.js";import"../chunk-LXNGDVCQ.js";import"../chunk-TZ5KQ47S.js";import"../chunk-OAC7TJZK.js";import"../chunk-UHHZ2CVW.js";import"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as Left,b as Right,c as left,e as parseNumber,d as right};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHJKBTHS6cjs = require('./chunk-HJKBTHS6.cjs');require('./chunk-6VKVA3TK.cjs');var _chunkWAM77UJLcjs = require('./chunk-WAM77UJL.cjs');var _chunkOO6BXJDPcjs = require('./chunk-OO6BXJDP.cjs');var _chunkIU7MDTQAcjs = require('./chunk-IU7MDTQA.cjs');var _chunkALLQJFGOcjs = require('./chunk-ALLQJFGO.cjs');var _chunkPXY4XULGcjs = require('./chunk-PXY4XULG.cjs');require('./chunk-GWLTG6GZ.cjs');exports.Left = _chunkHJKBTHS6cjs.a; exports.List = _chunkPXY4XULGcjs.a; exports.None = _chunkOO6BXJDPcjs.a; exports.Right = _chunkHJKBTHS6cjs.b; exports.Some = _chunkIU7MDTQAcjs.a; exports.left = _chunkHJKBTHS6cjs.c; exports.list = _chunkALLQJFGOcjs.a; exports.none = _chunkWAM77UJLcjs.c; exports.option = _chunkWAM77UJLcjs.a; exports.parseNumber = _chunkHJKBTHS6cjs.e; exports.right = _chunkHJKBTHS6cjs.d; exports.some = _chunkWAM77UJLcjs.b;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,106 @@
|
|
|
1
|
+
import { ParseError } from './error/ParseError.cjs';
|
|
2
|
+
|
|
3
|
+
declare class Left<L, R> implements Either<L, R> {
|
|
4
|
+
value: L;
|
|
5
|
+
constructor(value: L);
|
|
6
|
+
isLeft(): this is Left<L, R>;
|
|
7
|
+
isRight(): this is Right<L, R>;
|
|
8
|
+
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
9
|
+
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
10
|
+
reduce<U>(_f: (acc: U, value: R) => U): IFunctor<U>;
|
|
11
|
+
foldLeft<U>(initialValue: U, _f: (acc: U, value: R) => U): U;
|
|
12
|
+
foldRight<U>(initialValue: U, _f: (value: R, acc: U) => U): U;
|
|
13
|
+
toOption(): Option<R>;
|
|
14
|
+
toList(): List<R>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare class Right<L, R> implements Either<L, R> {
|
|
18
|
+
value: R;
|
|
19
|
+
constructor(value: R);
|
|
20
|
+
isLeft(): this is Left<L, R>;
|
|
21
|
+
isRight(): this is Right<L, R>;
|
|
22
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
23
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
24
|
+
reduce<U>(f: (acc: U, value: R) => U): IFunctor<U>;
|
|
25
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: R) => U): U;
|
|
26
|
+
foldRight<U>(initialValue: U, f: (value: R, acc: U) => U): U;
|
|
27
|
+
toOption(): Option<R>;
|
|
28
|
+
toList(): List<R>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface Either<L, R> extends IFunctor<R> {
|
|
32
|
+
value: L | R;
|
|
33
|
+
isLeft(): this is Left<L, R>;
|
|
34
|
+
isRight(): this is Right<L, R>;
|
|
35
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
36
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
37
|
+
toOption(): Option<R>;
|
|
38
|
+
toList(): List<R>;
|
|
39
|
+
}
|
|
40
|
+
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
41
|
+
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
42
|
+
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
43
|
+
|
|
44
|
+
declare class List<T> implements IFunctor<T> {
|
|
45
|
+
private readonly items;
|
|
46
|
+
constructor(items?: T[]);
|
|
47
|
+
get length(): number;
|
|
48
|
+
add(item: T): List<T>;
|
|
49
|
+
removeAt(index: number): List<T>;
|
|
50
|
+
get(index: number): T | undefined;
|
|
51
|
+
toArray(): readonly T[];
|
|
52
|
+
map<U>(f: (value: T) => U): List<U>;
|
|
53
|
+
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
54
|
+
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
55
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
56
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
57
|
+
concat(other: List<T>): List<T>;
|
|
58
|
+
toString(): string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare const list: <T>(items: T[] | undefined) => List<T>;
|
|
62
|
+
|
|
63
|
+
declare class Some<T> implements Option<T> {
|
|
64
|
+
private value;
|
|
65
|
+
constructor(value: T);
|
|
66
|
+
isEmpty(): boolean;
|
|
67
|
+
get(): T;
|
|
68
|
+
getOrElse(defaultValue: T): T;
|
|
69
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
70
|
+
map<U>(f: (value: T) => U): Option<U>;
|
|
71
|
+
flatMap<U>(f: (value: T) => Option<U>): Option<U>;
|
|
72
|
+
reduce<U>(f: (acc: U, value: T) => U): Option<U>;
|
|
73
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
74
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
75
|
+
toList(): List<T>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare class None<T> implements Option<T> {
|
|
79
|
+
isEmpty(): boolean;
|
|
80
|
+
get(): T;
|
|
81
|
+
getOrElse(defaultValue: T): T;
|
|
82
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
83
|
+
map<U>(f: (value: T) => U): Option<U>;
|
|
84
|
+
flatMap<U>(f: (value: T) => Option<U>): Option<U>;
|
|
85
|
+
reduce<U>(f: (acc: U, value: T) => U): Option<U>;
|
|
86
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
87
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
88
|
+
toList(): List<T>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface Option<T> extends IFunctor<T> {
|
|
92
|
+
isEmpty(): boolean;
|
|
93
|
+
get(): T;
|
|
94
|
+
getOrElse(defaultValue: T): T;
|
|
95
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
96
|
+
map<U>(f: (value: T) => U): Option<U>;
|
|
97
|
+
flatMap<U>(f: (value: T) => Option<U>): Option<U>;
|
|
98
|
+
toList(): List<T>;
|
|
99
|
+
}
|
|
100
|
+
declare const option: <T>(value?: T | undefined) => Option<T>;
|
|
101
|
+
declare const some: <T>(value: T) => Option<T>;
|
|
102
|
+
declare const none: <T>() => Option<T>;
|
|
103
|
+
|
|
1
104
|
interface IFunctor<T> {
|
|
2
105
|
map<U>(f: (value: T) => U): IFunctor<U>;
|
|
3
106
|
flatMap<U>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
@@ -6,4 +109,4 @@ interface IFunctor<T> {
|
|
|
6
109
|
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
7
110
|
}
|
|
8
111
|
|
|
9
|
-
export { IFunctor };
|
|
112
|
+
export { Either, IFunctor, Left, List, None, Option, Right, Some, left, list, none, option, parseNumber, right, some };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,106 @@
|
|
|
1
|
+
import { ParseError } from './error/ParseError.js';
|
|
2
|
+
|
|
3
|
+
declare class Left<L, R> implements Either<L, R> {
|
|
4
|
+
value: L;
|
|
5
|
+
constructor(value: L);
|
|
6
|
+
isLeft(): this is Left<L, R>;
|
|
7
|
+
isRight(): this is Right<L, R>;
|
|
8
|
+
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
9
|
+
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
10
|
+
reduce<U>(_f: (acc: U, value: R) => U): IFunctor<U>;
|
|
11
|
+
foldLeft<U>(initialValue: U, _f: (acc: U, value: R) => U): U;
|
|
12
|
+
foldRight<U>(initialValue: U, _f: (value: R, acc: U) => U): U;
|
|
13
|
+
toOption(): Option<R>;
|
|
14
|
+
toList(): List<R>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare class Right<L, R> implements Either<L, R> {
|
|
18
|
+
value: R;
|
|
19
|
+
constructor(value: R);
|
|
20
|
+
isLeft(): this is Left<L, R>;
|
|
21
|
+
isRight(): this is Right<L, R>;
|
|
22
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
23
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
24
|
+
reduce<U>(f: (acc: U, value: R) => U): IFunctor<U>;
|
|
25
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: R) => U): U;
|
|
26
|
+
foldRight<U>(initialValue: U, f: (value: R, acc: U) => U): U;
|
|
27
|
+
toOption(): Option<R>;
|
|
28
|
+
toList(): List<R>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface Either<L, R> extends IFunctor<R> {
|
|
32
|
+
value: L | R;
|
|
33
|
+
isLeft(): this is Left<L, R>;
|
|
34
|
+
isRight(): this is Right<L, R>;
|
|
35
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
36
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
37
|
+
toOption(): Option<R>;
|
|
38
|
+
toList(): List<R>;
|
|
39
|
+
}
|
|
40
|
+
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
41
|
+
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
42
|
+
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
43
|
+
|
|
44
|
+
declare class List<T> implements IFunctor<T> {
|
|
45
|
+
private readonly items;
|
|
46
|
+
constructor(items?: T[]);
|
|
47
|
+
get length(): number;
|
|
48
|
+
add(item: T): List<T>;
|
|
49
|
+
removeAt(index: number): List<T>;
|
|
50
|
+
get(index: number): T | undefined;
|
|
51
|
+
toArray(): readonly T[];
|
|
52
|
+
map<U>(f: (value: T) => U): List<U>;
|
|
53
|
+
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
54
|
+
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
55
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
56
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
57
|
+
concat(other: List<T>): List<T>;
|
|
58
|
+
toString(): string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare const list: <T>(items: T[] | undefined) => List<T>;
|
|
62
|
+
|
|
63
|
+
declare class Some<T> implements Option<T> {
|
|
64
|
+
private value;
|
|
65
|
+
constructor(value: T);
|
|
66
|
+
isEmpty(): boolean;
|
|
67
|
+
get(): T;
|
|
68
|
+
getOrElse(defaultValue: T): T;
|
|
69
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
70
|
+
map<U>(f: (value: T) => U): Option<U>;
|
|
71
|
+
flatMap<U>(f: (value: T) => Option<U>): Option<U>;
|
|
72
|
+
reduce<U>(f: (acc: U, value: T) => U): Option<U>;
|
|
73
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
74
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
75
|
+
toList(): List<T>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare class None<T> implements Option<T> {
|
|
79
|
+
isEmpty(): boolean;
|
|
80
|
+
get(): T;
|
|
81
|
+
getOrElse(defaultValue: T): T;
|
|
82
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
83
|
+
map<U>(f: (value: T) => U): Option<U>;
|
|
84
|
+
flatMap<U>(f: (value: T) => Option<U>): Option<U>;
|
|
85
|
+
reduce<U>(f: (acc: U, value: T) => U): Option<U>;
|
|
86
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
87
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
88
|
+
toList(): List<T>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface Option<T> extends IFunctor<T> {
|
|
92
|
+
isEmpty(): boolean;
|
|
93
|
+
get(): T;
|
|
94
|
+
getOrElse(defaultValue: T): T;
|
|
95
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
96
|
+
map<U>(f: (value: T) => U): Option<U>;
|
|
97
|
+
flatMap<U>(f: (value: T) => Option<U>): Option<U>;
|
|
98
|
+
toList(): List<T>;
|
|
99
|
+
}
|
|
100
|
+
declare const option: <T>(value?: T | undefined) => Option<T>;
|
|
101
|
+
declare const some: <T>(value: T) => Option<T>;
|
|
102
|
+
declare const none: <T>() => Option<T>;
|
|
103
|
+
|
|
1
104
|
interface IFunctor<T> {
|
|
2
105
|
map<U>(f: (value: T) => U): IFunctor<U>;
|
|
3
106
|
flatMap<U>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
@@ -6,4 +109,4 @@ interface IFunctor<T> {
|
|
|
6
109
|
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
7
110
|
}
|
|
8
111
|
|
|
9
|
-
export { IFunctor };
|
|
112
|
+
export { Either, IFunctor, Left, List, None, Option, Right, Some, left, list, none, option, parseNumber, right, some };
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-MG5D2OQV.js";import"./chunk-ZTL76QDL.js";import{a as j,b as k,c as l}from"./chunk-LXNGDVCQ.js";import{a as i}from"./chunk-TZ5KQ47S.js";import{a as h}from"./chunk-OAC7TJZK.js";import{a as g}from"./chunk-UHHZ2CVW.js";import{a as f}from"./chunk-E4GBAXJ4.js";import"./chunk-VTKL7OQI.js";export{a as Left,f as List,i as None,b as Right,h as Some,c as left,g as list,l as none,j as option,e as parseNumber,d as right,k as some};
|
package/dist/list/List.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPXY4XULGcjs = require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.List = _chunkPXY4XULGcjs.a;
|
package/dist/list/List.d.cts
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare class List<T> implements IFunctor<T> {
|
|
4
|
-
private readonly items;
|
|
5
|
-
constructor(items?: T[]);
|
|
6
|
-
get length(): number;
|
|
7
|
-
add(item: T): List<T>;
|
|
8
|
-
removeAt(index: number): List<T>;
|
|
9
|
-
get(index: number): T | undefined;
|
|
10
|
-
toArray(): readonly T[];
|
|
11
|
-
map<U>(f: (value: T) => U): List<U>;
|
|
12
|
-
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
13
|
-
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
14
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
15
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
16
|
-
concat(other: List<T>): List<T>;
|
|
17
|
-
toString(): string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { List };
|
|
1
|
+
export { List } from '../index.cjs';
|
|
2
|
+
import '../error/ParseError.cjs';
|
package/dist/list/List.d.ts
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare class List<T> implements IFunctor<T> {
|
|
4
|
-
private readonly items;
|
|
5
|
-
constructor(items?: T[]);
|
|
6
|
-
get length(): number;
|
|
7
|
-
add(item: T): List<T>;
|
|
8
|
-
removeAt(index: number): List<T>;
|
|
9
|
-
get(index: number): T | undefined;
|
|
10
|
-
toArray(): readonly T[];
|
|
11
|
-
map<U>(f: (value: T) => U): List<U>;
|
|
12
|
-
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
13
|
-
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
14
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
15
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
16
|
-
concat(other: List<T>): List<T>;
|
|
17
|
-
toString(): string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { List };
|
|
1
|
+
export { List } from '../index.js';
|
|
2
|
+
import '../error/ParseError.js';
|
package/dist/list/List.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a}from"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as List};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkALLQJFGOcjs = require('../chunk-ALLQJFGO.cjs');var _chunkPXY4XULGcjs = require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.List = _chunkPXY4XULGcjs.a; exports.list = _chunkALLQJFGOcjs.a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b}from"../chunk-UHHZ2CVW.js";import{a}from"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as List,b as list};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOO6BXJDPcjs = require('../chunk-OO6BXJDP.cjs');require('../chunk-ALLQJFGO.cjs');require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.None = _chunkOO6BXJDPcjs.a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-TZ5KQ47S.js";import"../chunk-UHHZ2CVW.js";import"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as None};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIU7MDTQAcjs = require('../chunk-IU7MDTQA.cjs');require('../chunk-ALLQJFGO.cjs');require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.Some = _chunkIU7MDTQAcjs.a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-OAC7TJZK.js";import"../chunk-UHHZ2CVW.js";import"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as Some};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWAM77UJLcjs = require('../chunk-WAM77UJL.cjs');var _chunkOO6BXJDPcjs = require('../chunk-OO6BXJDP.cjs');var _chunkIU7MDTQAcjs = require('../chunk-IU7MDTQA.cjs');require('../chunk-ALLQJFGO.cjs');require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.None = _chunkOO6BXJDPcjs.a; exports.Some = _chunkIU7MDTQAcjs.a; exports.none = _chunkWAM77UJLcjs.c; exports.option = _chunkWAM77UJLcjs.a; exports.some = _chunkWAM77UJLcjs.b;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c,b as d,c as e}from"../chunk-LXNGDVCQ.js";import{a as b}from"../chunk-TZ5KQ47S.js";import{a}from"../chunk-OAC7TJZK.js";import"../chunk-UHHZ2CVW.js";import"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{b as None,a as Some,e as none,c as option,d as some};
|
package/package.json
CHANGED
package/dist/chunk-4EVP3IRI.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var r=class e{constructor(t){this.value=t}isLeft(){return!0}isRight(){return!1}map(t){return new e(this.value)}flatMap(t){return new e(this.value)}reduce(t){return new e(this.value)}foldLeft(t,i){return t}foldRight(t,i){return t}};exports.a = r;
|
package/dist/chunk-ABUN2GHU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r=class e{constructor(t){this.value=t}isLeft(){return!0}isRight(){return!1}map(t){return new e(this.value)}flatMap(t){return new e(this.value)}reduce(t){return new e(this.value)}foldLeft(t,i){return t}foldRight(t,i){return t}};export{r as a};
|
package/dist/chunk-CB3ZZ3RL.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var u=class r{constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}map(e){return new r(e(this.value))}flatMap(e){return e(this.value)}reduce(e){return new r(e(void 0,this.value))}foldLeft(e,t){return t(e,this.value)}foldRight(e,t){return t(this.value,e)}};exports.a = u;
|
package/dist/chunk-CN6MP6AJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var u=class r{constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}map(e){return new r(e(this.value))}flatMap(e){return e(this.value)}reduce(e){return new r(e(void 0,this.value))}foldLeft(e,t){return t(e,this.value)}foldRight(e,t){return t(this.value,e)}};export{u as a};
|
package/dist/index-28de5927.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ParseError } from './error/ParseError.js';
|
|
2
|
-
import { IFunctor } from './index.js';
|
|
3
|
-
|
|
4
|
-
declare class Right<L, R> implements Either<L, R> {
|
|
5
|
-
value: R;
|
|
6
|
-
constructor(value: R);
|
|
7
|
-
isLeft(): this is Left<L, R>;
|
|
8
|
-
isRight(): this is Right<L, R>;
|
|
9
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
10
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
11
|
-
reduce<U>(f: (acc: U, value: R) => U): IFunctor<U>;
|
|
12
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: R) => U): U;
|
|
13
|
-
foldRight<U>(initialValue: U, f: (value: R, acc: U) => U): U;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
declare class Left<L, R> implements Either<L, R> {
|
|
17
|
-
value: L;
|
|
18
|
-
constructor(value: L);
|
|
19
|
-
isLeft(): this is Left<L, R>;
|
|
20
|
-
isRight(): this is Right<L, R>;
|
|
21
|
-
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
22
|
-
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
23
|
-
reduce<U>(_f: (acc: U, value: R) => U): IFunctor<U>;
|
|
24
|
-
foldLeft<U>(initialValue: U, _f: (acc: U, value: R) => U): U;
|
|
25
|
-
foldRight<U>(initialValue: U, _f: (value: R, acc: U) => U): U;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface Either<L, R> extends IFunctor<R> {
|
|
29
|
-
value: L | R;
|
|
30
|
-
isLeft(): this is Left<L, R>;
|
|
31
|
-
isRight(): this is Right<L, R>;
|
|
32
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
33
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
34
|
-
}
|
|
35
|
-
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
36
|
-
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
37
|
-
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
38
|
-
|
|
39
|
-
export { Either as E, Left as L, Right as R, left as l, parseNumber as p, right as r };
|
package/dist/index-402b9aa2.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ParseError } from './error/ParseError.cjs';
|
|
2
|
-
import { IFunctor } from './index.cjs';
|
|
3
|
-
|
|
4
|
-
declare class Right<L, R> implements Either<L, R> {
|
|
5
|
-
value: R;
|
|
6
|
-
constructor(value: R);
|
|
7
|
-
isLeft(): this is Left<L, R>;
|
|
8
|
-
isRight(): this is Right<L, R>;
|
|
9
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
10
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
11
|
-
reduce<U>(f: (acc: U, value: R) => U): IFunctor<U>;
|
|
12
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: R) => U): U;
|
|
13
|
-
foldRight<U>(initialValue: U, f: (value: R, acc: U) => U): U;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
declare class Left<L, R> implements Either<L, R> {
|
|
17
|
-
value: L;
|
|
18
|
-
constructor(value: L);
|
|
19
|
-
isLeft(): this is Left<L, R>;
|
|
20
|
-
isRight(): this is Right<L, R>;
|
|
21
|
-
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
22
|
-
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
23
|
-
reduce<U>(_f: (acc: U, value: R) => U): IFunctor<U>;
|
|
24
|
-
foldLeft<U>(initialValue: U, _f: (acc: U, value: R) => U): U;
|
|
25
|
-
foldRight<U>(initialValue: U, _f: (value: R, acc: U) => U): U;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface Either<L, R> extends IFunctor<R> {
|
|
29
|
-
value: L | R;
|
|
30
|
-
isLeft(): this is Left<L, R>;
|
|
31
|
-
isRight(): this is Right<L, R>;
|
|
32
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
33
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
34
|
-
}
|
|
35
|
-
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
36
|
-
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
37
|
-
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
38
|
-
|
|
39
|
-
export { Either as E, Left as L, Right as R, left as l, parseNumber as p, right as r };
|