@lsby/ts-fp-data 0.0.2 → 0.0.4

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.
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/either.ts
20
+ // src/data/either.ts
21
21
  var either_exports = {};
22
22
  __export(either_exports, {
23
23
  Either: () => Either,
@@ -62,6 +62,9 @@ var Left = class _Left extends Either {
62
62
  assertRight() {
63
63
  throw new Error("\u65AD\u8A00\u5931\u8D25");
64
64
  }
65
+ match(onLeft, _onRight) {
66
+ return onLeft(this.\u503C);
67
+ }
65
68
  };
66
69
  var Right = class _Right extends Either {
67
70
  constructor(\u503C) {
@@ -95,6 +98,9 @@ var Right = class _Right extends Either {
95
98
  assertRight() {
96
99
  return this;
97
100
  }
101
+ match(_onLeft, onRight) {
102
+ return onRight(this.\u503C);
103
+ }
98
104
  };
99
105
  // Annotate the CommonJS export names for ESM import in node:
100
106
  0 && (module.exports = {
@@ -8,6 +8,7 @@ declare abstract class Either<L, R> {
8
8
  abstract getValue(): L | R;
9
9
  abstract assertLeft(): Left<L, R>;
10
10
  abstract assertRight(): Right<L, R>;
11
+ abstract match<X>(onLeft: (a: L) => X, onRight: (a: R) => X): X;
11
12
  }
12
13
  declare class Left<L, R> extends Either<L, R> {
13
14
  private 值;
@@ -21,6 +22,7 @@ declare class Left<L, R> extends Either<L, R> {
21
22
  getValue(): L | R;
22
23
  assertLeft(): Left<L, R>;
23
24
  assertRight(): Right<L, R>;
25
+ match<X>(onLeft: (a: L) => X, _onRight: (a: R) => X): X;
24
26
  }
25
27
  declare class Right<L, R> extends Either<L, R> {
26
28
  private 值;
@@ -34,6 +36,7 @@ declare class Right<L, R> extends Either<L, R> {
34
36
  getValue(): L | R;
35
37
  assertLeft(): Left<L, R>;
36
38
  assertRight(): Right<L, R>;
39
+ match<X>(_onLeft: (a: L) => X, onRight: (a: R) => X): X;
37
40
  }
38
41
 
39
42
  export { Either, Left, Right };
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/maybe.ts
20
+ // src/data/maybe.ts
21
21
  var maybe_exports = {};
22
22
  __export(maybe_exports, {
23
23
  Just: () => Just,
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/data/task.ts
21
+ var task_exports = {};
22
+ __export(task_exports, {
23
+ Task: () => Task
24
+ });
25
+ module.exports = __toCommonJS(task_exports);
26
+
27
+ // src/data/either.ts
28
+ var Either = class {
29
+ static pure(a) {
30
+ return new Right(a);
31
+ }
32
+ };
33
+ var Left = class _Left extends Either {
34
+ constructor(\u503C) {
35
+ super();
36
+ this.\u503C = \u503C;
37
+ }
38
+ map(_f) {
39
+ return new _Left(this.\u503C);
40
+ }
41
+ mapLeft(f) {
42
+ return new _Left(f(this.\u503C));
43
+ }
44
+ bind(_f) {
45
+ return new _Left(this.\u503C);
46
+ }
47
+ isLeft() {
48
+ return true;
49
+ }
50
+ isRight() {
51
+ return false;
52
+ }
53
+ getLeft() {
54
+ return this.\u503C;
55
+ }
56
+ getValue() {
57
+ return this.\u503C;
58
+ }
59
+ assertLeft() {
60
+ return this;
61
+ }
62
+ assertRight() {
63
+ throw new Error("\u65AD\u8A00\u5931\u8D25");
64
+ }
65
+ match(onLeft, _onRight) {
66
+ return onLeft(this.\u503C);
67
+ }
68
+ };
69
+ var Right = class _Right extends Either {
70
+ constructor(\u503C) {
71
+ super();
72
+ this.\u503C = \u503C;
73
+ }
74
+ map(f) {
75
+ return new _Right(f(this.\u503C));
76
+ }
77
+ mapLeft(_f) {
78
+ return new _Right(this.\u503C);
79
+ }
80
+ bind(f) {
81
+ return f(this.\u503C);
82
+ }
83
+ isLeft() {
84
+ return false;
85
+ }
86
+ isRight() {
87
+ return true;
88
+ }
89
+ getRight() {
90
+ return this.\u503C;
91
+ }
92
+ getValue() {
93
+ return this.\u503C;
94
+ }
95
+ assertLeft() {
96
+ throw new Error("\u65AD\u8A00\u5931\u8D25");
97
+ }
98
+ assertRight() {
99
+ return this;
100
+ }
101
+ match(_onLeft, onRight) {
102
+ return onRight(this.\u503C);
103
+ }
104
+ };
105
+
106
+ // src/data/task.ts
107
+ var Task = class _Task {
108
+ constructor(f) {
109
+ this.f = f;
110
+ }
111
+ static pure(a) {
112
+ return new _Task(async () => a);
113
+ }
114
+ map(f) {
115
+ return new _Task(async () => f(await this.f()));
116
+ }
117
+ bind(f) {
118
+ return new _Task(async () => f(await this.f()).run());
119
+ }
120
+ run() {
121
+ return this.f();
122
+ }
123
+ tryRun() {
124
+ try {
125
+ return new Right(this.run());
126
+ } catch (e) {
127
+ if (e instanceof Error)
128
+ return new Left(e);
129
+ return new Left(new Error(String(e)));
130
+ }
131
+ }
132
+ };
133
+ // Annotate the CommonJS export names for ESM import in node:
134
+ 0 && (module.exports = {
135
+ Task
136
+ });
@@ -1,3 +1,5 @@
1
+ import { Either } from './either.cjs';
2
+
1
3
  declare class Task<A> {
2
4
  private f;
3
5
  static pure<A>(a: A): Task<A>;
@@ -5,6 +7,7 @@ declare class Task<A> {
5
7
  map<B>(f: (a: A) => B): Task<B>;
6
8
  bind<B>(f: (a: A) => Task<B>): Task<B>;
7
9
  run(): Promise<A>;
10
+ tryRun(): Either<Error, Promise<A>>;
8
11
  }
9
12
 
10
13
  export { Task };
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/func/seq.ts
21
+ var seq_exports = {};
22
+ __export(seq_exports, {
23
+ seqArrayTask: () => seqArrayTask
24
+ });
25
+ module.exports = __toCommonJS(seq_exports);
26
+
27
+ // src/data/either.ts
28
+ var Either = class {
29
+ static pure(a) {
30
+ return new Right(a);
31
+ }
32
+ };
33
+ var Left = class _Left extends Either {
34
+ constructor(\u503C) {
35
+ super();
36
+ this.\u503C = \u503C;
37
+ }
38
+ map(_f) {
39
+ return new _Left(this.\u503C);
40
+ }
41
+ mapLeft(f) {
42
+ return new _Left(f(this.\u503C));
43
+ }
44
+ bind(_f) {
45
+ return new _Left(this.\u503C);
46
+ }
47
+ isLeft() {
48
+ return true;
49
+ }
50
+ isRight() {
51
+ return false;
52
+ }
53
+ getLeft() {
54
+ return this.\u503C;
55
+ }
56
+ getValue() {
57
+ return this.\u503C;
58
+ }
59
+ assertLeft() {
60
+ return this;
61
+ }
62
+ assertRight() {
63
+ throw new Error("\u65AD\u8A00\u5931\u8D25");
64
+ }
65
+ match(onLeft, _onRight) {
66
+ return onLeft(this.\u503C);
67
+ }
68
+ };
69
+ var Right = class _Right extends Either {
70
+ constructor(\u503C) {
71
+ super();
72
+ this.\u503C = \u503C;
73
+ }
74
+ map(f) {
75
+ return new _Right(f(this.\u503C));
76
+ }
77
+ mapLeft(_f) {
78
+ return new _Right(this.\u503C);
79
+ }
80
+ bind(f) {
81
+ return f(this.\u503C);
82
+ }
83
+ isLeft() {
84
+ return false;
85
+ }
86
+ isRight() {
87
+ return true;
88
+ }
89
+ getRight() {
90
+ return this.\u503C;
91
+ }
92
+ getValue() {
93
+ return this.\u503C;
94
+ }
95
+ assertLeft() {
96
+ throw new Error("\u65AD\u8A00\u5931\u8D25");
97
+ }
98
+ assertRight() {
99
+ return this;
100
+ }
101
+ match(_onLeft, onRight) {
102
+ return onRight(this.\u503C);
103
+ }
104
+ };
105
+
106
+ // src/data/task.ts
107
+ var Task = class _Task {
108
+ constructor(f) {
109
+ this.f = f;
110
+ }
111
+ static pure(a) {
112
+ return new _Task(async () => a);
113
+ }
114
+ map(f) {
115
+ return new _Task(async () => f(await this.f()));
116
+ }
117
+ bind(f) {
118
+ return new _Task(async () => f(await this.f()).run());
119
+ }
120
+ run() {
121
+ return this.f();
122
+ }
123
+ tryRun() {
124
+ try {
125
+ return new Right(this.run());
126
+ } catch (e) {
127
+ if (e instanceof Error)
128
+ return new Left(e);
129
+ return new Left(new Error(String(e)));
130
+ }
131
+ }
132
+ };
133
+
134
+ // src/func/seq.ts
135
+ function seqArrayTask(a) {
136
+ return new Task(async () => {
137
+ return Promise.all(a.map(async (a2) => await a2.run()));
138
+ });
139
+ }
140
+ // Annotate the CommonJS export names for ESM import in node:
141
+ 0 && (module.exports = {
142
+ seqArrayTask
143
+ });
@@ -0,0 +1,6 @@
1
+ import { Task } from '../data/task.cjs';
2
+ import '../data/either.cjs';
3
+
4
+ declare function seqArrayTask<A>(a: Array<Task<A>>): Task<Array<A>>;
5
+
6
+ export { seqArrayTask };
@@ -26,84 +26,12 @@ __export(src_exports, {
26
26
  Maybe: () => Maybe,
27
27
  Nothing: () => Nothing,
28
28
  Right: () => Right,
29
- Task: () => Task
29
+ Task: () => Task,
30
+ seqArrayTask: () => seqArrayTask
30
31
  });
31
32
  module.exports = __toCommonJS(src_exports);
32
33
 
33
- // src/task.ts
34
- var Task = class _Task {
35
- constructor(f) {
36
- this.f = f;
37
- }
38
- static pure(a) {
39
- return new _Task(async () => a);
40
- }
41
- map(f) {
42
- return new _Task(async () => f(await this.f()));
43
- }
44
- bind(f) {
45
- return new _Task(async () => f(await this.f()).run());
46
- }
47
- run() {
48
- return this.f();
49
- }
50
- };
51
-
52
- // src/maybe.ts
53
- var Maybe = class {
54
- static pure(a) {
55
- return new Just(a);
56
- }
57
- };
58
- var Just = class _Just extends Maybe {
59
- constructor(\u503C) {
60
- super();
61
- this.\u503C = \u503C;
62
- }
63
- match(onJust, _onNothing) {
64
- return onJust(this.\u503C);
65
- }
66
- map(f) {
67
- return new _Just(f(this.\u503C));
68
- }
69
- bind(f) {
70
- return f(this.\u503C);
71
- }
72
- isJust() {
73
- return true;
74
- }
75
- isNothing() {
76
- return false;
77
- }
78
- getJust() {
79
- return this.\u503C;
80
- }
81
- getJustOrNull() {
82
- return this.\u503C;
83
- }
84
- };
85
- var Nothing = class _Nothing extends Maybe {
86
- match(_onJust, onNothing) {
87
- return onNothing();
88
- }
89
- map(_f) {
90
- return new _Nothing();
91
- }
92
- bind(_f) {
93
- return new _Nothing();
94
- }
95
- isJust() {
96
- return false;
97
- }
98
- isNothing() {
99
- return true;
100
- }
101
- getJustOrNull() {
102
- return null;
103
- }
104
- };
105
-
106
- // src/either.ts
34
+ // src/data/either.ts
107
35
  var Either = class {
108
36
  static pure(a) {
109
37
  return new Right(a);
@@ -141,6 +69,9 @@ var Left = class _Left extends Either {
141
69
  assertRight() {
142
70
  throw new Error("\u65AD\u8A00\u5931\u8D25");
143
71
  }
72
+ match(onLeft, _onRight) {
73
+ return onLeft(this.\u503C);
74
+ }
144
75
  };
145
76
  var Right = class _Right extends Either {
146
77
  constructor(\u503C) {
@@ -174,7 +105,99 @@ var Right = class _Right extends Either {
174
105
  assertRight() {
175
106
  return this;
176
107
  }
108
+ match(_onLeft, onRight) {
109
+ return onRight(this.\u503C);
110
+ }
177
111
  };
112
+
113
+ // src/data/task.ts
114
+ var Task = class _Task {
115
+ constructor(f) {
116
+ this.f = f;
117
+ }
118
+ static pure(a) {
119
+ return new _Task(async () => a);
120
+ }
121
+ map(f) {
122
+ return new _Task(async () => f(await this.f()));
123
+ }
124
+ bind(f) {
125
+ return new _Task(async () => f(await this.f()).run());
126
+ }
127
+ run() {
128
+ return this.f();
129
+ }
130
+ tryRun() {
131
+ try {
132
+ return new Right(this.run());
133
+ } catch (e) {
134
+ if (e instanceof Error)
135
+ return new Left(e);
136
+ return new Left(new Error(String(e)));
137
+ }
138
+ }
139
+ };
140
+
141
+ // src/data/maybe.ts
142
+ var Maybe = class {
143
+ static pure(a) {
144
+ return new Just(a);
145
+ }
146
+ };
147
+ var Just = class _Just extends Maybe {
148
+ constructor(\u503C) {
149
+ super();
150
+ this.\u503C = \u503C;
151
+ }
152
+ match(onJust, _onNothing) {
153
+ return onJust(this.\u503C);
154
+ }
155
+ map(f) {
156
+ return new _Just(f(this.\u503C));
157
+ }
158
+ bind(f) {
159
+ return f(this.\u503C);
160
+ }
161
+ isJust() {
162
+ return true;
163
+ }
164
+ isNothing() {
165
+ return false;
166
+ }
167
+ getJust() {
168
+ return this.\u503C;
169
+ }
170
+ getJustOrNull() {
171
+ return this.\u503C;
172
+ }
173
+ };
174
+ var Nothing = class _Nothing extends Maybe {
175
+ match(_onJust, onNothing) {
176
+ return onNothing();
177
+ }
178
+ map(_f) {
179
+ return new _Nothing();
180
+ }
181
+ bind(_f) {
182
+ return new _Nothing();
183
+ }
184
+ isJust() {
185
+ return false;
186
+ }
187
+ isNothing() {
188
+ return true;
189
+ }
190
+ getJustOrNull() {
191
+ return null;
192
+ }
193
+ };
194
+
195
+ // src/func/seq.ts
196
+ function seqArrayTask(a) {
197
+ return new Task(async () => {
198
+ return Promise.all(a.map(async (a2) => await a2.run()));
199
+ });
200
+ }
178
201
  // Annotate the CommonJS export names for ESM import in node:
179
202
  0 && (module.exports = {
180
203
  Either,
@@ -183,5 +206,6 @@ var Right = class _Right extends Either {
183
206
  Maybe,
184
207
  Nothing,
185
208
  Right,
186
- Task
209
+ Task,
210
+ seqArrayTask
187
211
  });
@@ -1,3 +1,4 @@
1
- export { Task } from './task.cjs';
2
- export { Just, Maybe, Nothing } from './maybe.cjs';
3
- export { Either, Left, Right } from './either.cjs';
1
+ export { Task } from './data/task.cjs';
2
+ export { Just, Maybe, Nothing } from './data/maybe.cjs';
3
+ export { Either, Left, Right } from './data/either.cjs';
4
+ export { seqArrayTask } from './func/seq.cjs';
@@ -0,0 +1,14 @@
1
+ import {
2
+ Task
3
+ } from "./chunk-V3O5DWBY.js";
4
+
5
+ // src/func/seq.ts
6
+ function seqArrayTask(a) {
7
+ return new Task(async () => {
8
+ return Promise.all(a.map(async (a2) => await a2.run()));
9
+ });
10
+ }
11
+
12
+ export {
13
+ seqArrayTask
14
+ };
@@ -1,4 +1,4 @@
1
- // src/maybe.ts
1
+ // src/data/maybe.ts
2
2
  var Maybe = class {
3
3
  static pure(a) {
4
4
  return new Just(a);
@@ -1,4 +1,9 @@
1
- // src/task.ts
1
+ import {
2
+ Left,
3
+ Right
4
+ } from "./chunk-VTI5CRVQ.js";
5
+
6
+ // src/data/task.ts
2
7
  var Task = class _Task {
3
8
  constructor(f) {
4
9
  this.f = f;
@@ -15,6 +20,15 @@ var Task = class _Task {
15
20
  run() {
16
21
  return this.f();
17
22
  }
23
+ tryRun() {
24
+ try {
25
+ return new Right(this.run());
26
+ } catch (e) {
27
+ if (e instanceof Error)
28
+ return new Left(e);
29
+ return new Left(new Error(String(e)));
30
+ }
31
+ }
18
32
  };
19
33
 
20
34
  export {
@@ -1,4 +1,4 @@
1
- // src/either.ts
1
+ // src/data/either.ts
2
2
  var Either = class {
3
3
  static pure(a) {
4
4
  return new Right(a);
@@ -36,6 +36,9 @@ var Left = class _Left extends Either {
36
36
  assertRight() {
37
37
  throw new Error("\u65AD\u8A00\u5931\u8D25");
38
38
  }
39
+ match(onLeft, _onRight) {
40
+ return onLeft(this.\u503C);
41
+ }
39
42
  };
40
43
  var Right = class _Right extends Either {
41
44
  constructor(\u503C) {
@@ -69,6 +72,9 @@ var Right = class _Right extends Either {
69
72
  assertRight() {
70
73
  return this;
71
74
  }
75
+ match(_onLeft, onRight) {
76
+ return onRight(this.\u503C);
77
+ }
72
78
  };
73
79
 
74
80
  export {
@@ -8,6 +8,7 @@ declare abstract class Either<L, R> {
8
8
  abstract getValue(): L | R;
9
9
  abstract assertLeft(): Left<L, R>;
10
10
  abstract assertRight(): Right<L, R>;
11
+ abstract match<X>(onLeft: (a: L) => X, onRight: (a: R) => X): X;
11
12
  }
12
13
  declare class Left<L, R> extends Either<L, R> {
13
14
  private 值;
@@ -21,6 +22,7 @@ declare class Left<L, R> extends Either<L, R> {
21
22
  getValue(): L | R;
22
23
  assertLeft(): Left<L, R>;
23
24
  assertRight(): Right<L, R>;
25
+ match<X>(onLeft: (a: L) => X, _onRight: (a: R) => X): X;
24
26
  }
25
27
  declare class Right<L, R> extends Either<L, R> {
26
28
  private 值;
@@ -34,6 +36,7 @@ declare class Right<L, R> extends Either<L, R> {
34
36
  getValue(): L | R;
35
37
  assertLeft(): Left<L, R>;
36
38
  assertRight(): Right<L, R>;
39
+ match<X>(_onLeft: (a: L) => X, onRight: (a: R) => X): X;
37
40
  }
38
41
 
39
42
  export { Either, Left, Right };
@@ -2,7 +2,7 @@ import {
2
2
  Either,
3
3
  Left,
4
4
  Right
5
- } from "./chunk-WNXSHYAM.js";
5
+ } from "../chunk-VTI5CRVQ.js";
6
6
  export {
7
7
  Either,
8
8
  Left,
@@ -2,7 +2,7 @@ import {
2
2
  Just,
3
3
  Maybe,
4
4
  Nothing
5
- } from "./chunk-LDWARHRU.js";
5
+ } from "../chunk-PP7TCBHD.js";
6
6
  export {
7
7
  Just,
8
8
  Maybe,
@@ -1,3 +1,5 @@
1
+ import { Either } from './either.js';
2
+
1
3
  declare class Task<A> {
2
4
  private f;
3
5
  static pure<A>(a: A): Task<A>;
@@ -5,6 +7,7 @@ declare class Task<A> {
5
7
  map<B>(f: (a: A) => B): Task<B>;
6
8
  bind<B>(f: (a: A) => Task<B>): Task<B>;
7
9
  run(): Promise<A>;
10
+ tryRun(): Either<Error, Promise<A>>;
8
11
  }
9
12
 
10
13
  export { Task };
@@ -0,0 +1,7 @@
1
+ import {
2
+ Task
3
+ } from "../chunk-V3O5DWBY.js";
4
+ import "../chunk-VTI5CRVQ.js";
5
+ export {
6
+ Task
7
+ };
@@ -0,0 +1,6 @@
1
+ import { Task } from '../data/task.js';
2
+ import '../data/either.js';
3
+
4
+ declare function seqArrayTask<A>(a: Array<Task<A>>): Task<Array<A>>;
5
+
6
+ export { seqArrayTask };
@@ -0,0 +1,8 @@
1
+ import {
2
+ seqArrayTask
3
+ } from "../chunk-IGVGNMBF.js";
4
+ import "../chunk-V3O5DWBY.js";
5
+ import "../chunk-VTI5CRVQ.js";
6
+ export {
7
+ seqArrayTask
8
+ };
@@ -1,3 +1,4 @@
1
- export { Task } from './task.js';
2
- export { Just, Maybe, Nothing } from './maybe.js';
3
- export { Either, Left, Right } from './either.js';
1
+ export { Task } from './data/task.js';
2
+ export { Just, Maybe, Nothing } from './data/maybe.js';
3
+ export { Either, Left, Right } from './data/either.js';
4
+ export { seqArrayTask } from './func/seq.js';
package/dist/esm/index.js CHANGED
@@ -1,16 +1,19 @@
1
- import {
2
- Either,
3
- Left,
4
- Right
5
- } from "./chunk-WNXSHYAM.js";
6
1
  import {
7
2
  Just,
8
3
  Maybe,
9
4
  Nothing
10
- } from "./chunk-LDWARHRU.js";
5
+ } from "./chunk-PP7TCBHD.js";
6
+ import {
7
+ seqArrayTask
8
+ } from "./chunk-IGVGNMBF.js";
11
9
  import {
12
10
  Task
13
- } from "./chunk-MUKICLFD.js";
11
+ } from "./chunk-V3O5DWBY.js";
12
+ import {
13
+ Either,
14
+ Left,
15
+ Right
16
+ } from "./chunk-VTI5CRVQ.js";
14
17
  export {
15
18
  Either,
16
19
  Just,
@@ -18,5 +21,6 @@ export {
18
21
  Maybe,
19
22
  Nothing,
20
23
  Right,
21
- Task
24
+ Task,
25
+ seqArrayTask
22
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsby/ts-fp-data",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "require": "./dist/cjs/index.cjs",
package/dist/cjs/task.cjs DELETED
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/task.ts
21
- var task_exports = {};
22
- __export(task_exports, {
23
- Task: () => Task
24
- });
25
- module.exports = __toCommonJS(task_exports);
26
- var Task = class _Task {
27
- constructor(f) {
28
- this.f = f;
29
- }
30
- static pure(a) {
31
- return new _Task(async () => a);
32
- }
33
- map(f) {
34
- return new _Task(async () => f(await this.f()));
35
- }
36
- bind(f) {
37
- return new _Task(async () => f(await this.f()).run());
38
- }
39
- run() {
40
- return this.f();
41
- }
42
- };
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- Task
46
- });
package/dist/esm/task.js DELETED
@@ -1,6 +0,0 @@
1
- import {
2
- Task
3
- } from "./chunk-MUKICLFD.js";
4
- export {
5
- Task
6
- };
File without changes
File without changes