functype 0.1.1 → 0.2.0

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.
Files changed (119) hide show
  1. package/dist/chunk-35Y3S46C.js +1 -0
  2. package/dist/chunk-5OCPRWBH.mjs +1 -0
  3. package/dist/chunk-5RNU6GKU.mjs +1 -0
  4. package/dist/chunk-5SPJ52B5.js +1 -0
  5. package/dist/chunk-5XVNJUCA.js +1 -0
  6. package/dist/chunk-AGJ7VCYK.mjs +1 -0
  7. package/dist/chunk-AU3JU6VY.js +1 -0
  8. package/dist/chunk-BNNK42JC.js +1 -0
  9. package/dist/chunk-FBZLCLTN.mjs +1 -0
  10. package/dist/chunk-L4P3MMUC.mjs +1 -0
  11. package/dist/chunk-NBPFHDR5.js +1 -0
  12. package/dist/chunk-RRAIFS3D.mjs +1 -0
  13. package/dist/chunk-V5DD7UJW.mjs +1 -0
  14. package/dist/chunk-ZQB7I77M.js +1 -0
  15. package/dist/collections/index.d.mts +5 -0
  16. package/dist/collections/index.d.ts +5 -0
  17. package/dist/either/Left.d.mts +9 -2
  18. package/dist/either/Left.d.ts +9 -2
  19. package/dist/either/Left.js +1 -1
  20. package/dist/either/Left.mjs +1 -1
  21. package/dist/either/Right.d.mts +9 -2
  22. package/dist/either/Right.d.ts +9 -2
  23. package/dist/either/Right.js +1 -1
  24. package/dist/either/Right.mjs +1 -1
  25. package/dist/either/index.d.mts +44 -2
  26. package/dist/either/index.d.ts +44 -2
  27. package/dist/either/index.js +1 -1
  28. package/dist/either/index.mjs +1 -1
  29. package/dist/functor/index.d.mts +17 -0
  30. package/dist/functor/index.d.ts +17 -0
  31. package/dist/index-18491592.d.ts +33 -0
  32. package/dist/index-3628fb7a.d.ts +15 -0
  33. package/dist/index-64357013.d.ts +33 -0
  34. package/dist/index-8434e22f.d.ts +15 -0
  35. package/dist/index.d.mts +8 -207
  36. package/dist/index.d.ts +8 -207
  37. package/dist/index.js +1 -1
  38. package/dist/index.mjs +0 -1
  39. package/dist/iterable/Seq.d.mts +29 -0
  40. package/dist/iterable/Seq.d.ts +29 -0
  41. package/dist/iterable/Seq.js +1 -0
  42. package/dist/iterable/Seq.mjs +1 -0
  43. package/dist/iterable/index.d.mts +3 -0
  44. package/dist/iterable/index.d.ts +3 -0
  45. package/dist/iterable/index.js +1 -0
  46. package/dist/iterable/index.mjs +0 -0
  47. package/dist/list/IList.d.mts +9 -0
  48. package/dist/list/IList.d.ts +9 -0
  49. package/dist/list/IList.js +1 -0
  50. package/dist/list/IList.mjs +0 -0
  51. package/dist/list/List.d.mts +25 -2
  52. package/dist/list/List.d.ts +25 -2
  53. package/dist/list/List.js +1 -1
  54. package/dist/list/List.mjs +1 -1
  55. package/dist/list/index.d.mts +12 -2
  56. package/dist/list/index.d.ts +12 -2
  57. package/dist/list/index.js +1 -1
  58. package/dist/list/index.mjs +1 -1
  59. package/dist/map/Map.d.mts +7 -2
  60. package/dist/map/Map.d.ts +7 -2
  61. package/dist/map/Map.js +1 -1
  62. package/dist/map/Map.mjs +1 -1
  63. package/dist/map/index.d.mts +38 -2
  64. package/dist/map/index.d.ts +38 -2
  65. package/dist/map/index.js +1 -1
  66. package/dist/map/index.mjs +1 -1
  67. package/dist/option/IOption.d.mts +3 -0
  68. package/dist/option/IOption.d.ts +3 -0
  69. package/dist/option/IOption.js +1 -0
  70. package/dist/option/IOption.mjs +0 -0
  71. package/dist/option/None.d.mts +21 -2
  72. package/dist/option/None.d.ts +21 -2
  73. package/dist/option/None.js +1 -1
  74. package/dist/option/None.mjs +1 -1
  75. package/dist/option/Some.d.mts +23 -2
  76. package/dist/option/Some.d.ts +23 -2
  77. package/dist/option/Some.js +1 -1
  78. package/dist/option/Some.mjs +1 -1
  79. package/dist/option/index.d.mts +9 -2
  80. package/dist/option/index.d.ts +9 -2
  81. package/dist/option/index.js +1 -1
  82. package/dist/option/index.mjs +1 -1
  83. package/dist/set/Set.d.mts +20 -2
  84. package/dist/set/Set.d.ts +20 -2
  85. package/dist/set/Set.js +1 -1
  86. package/dist/set/Set.mjs +1 -1
  87. package/dist/set/index.d.mts +5 -2
  88. package/dist/set/index.d.ts +5 -2
  89. package/dist/set/index.js +1 -1
  90. package/dist/set/index.mjs +0 -1
  91. package/dist/try/Try.d.mts +30 -0
  92. package/dist/try/Try.d.ts +30 -0
  93. package/dist/try/Try.js +1 -0
  94. package/dist/try/Try.mjs +1 -0
  95. package/dist/tuple/Tuple.d.mts +2 -2
  96. package/dist/tuple/Tuple.d.ts +2 -2
  97. package/dist/tuple/index.d.mts +20 -2
  98. package/dist/tuple/index.d.ts +20 -2
  99. package/dist/util/index.d.mts +14 -0
  100. package/dist/util/index.d.ts +14 -0
  101. package/dist/util/index.js +1 -0
  102. package/dist/util/index.mjs +1 -0
  103. package/dist/util/isIterable.d.mts +3 -0
  104. package/dist/util/isIterable.d.ts +3 -0
  105. package/dist/util/isIterable.js +1 -0
  106. package/dist/util/isIterable.mjs +1 -0
  107. package/package.json +1 -1
  108. package/dist/chunk-7VFL33KH.js +0 -1
  109. package/dist/chunk-7XCWDOMW.js +0 -1
  110. package/dist/chunk-CZKHN2SM.mjs +0 -1
  111. package/dist/chunk-PKWOSOD7.mjs +0 -1
  112. package/dist/chunk-U237FVPP.mjs +0 -1
  113. package/dist/chunk-VWFTFPZB.mjs +0 -1
  114. package/dist/chunk-WY62QD3C.js +0 -1
  115. package/dist/chunk-XNAZ5QU3.js +0 -1
  116. /package/dist/{chunk-DOG6HMTN.js → collections/index.js} +0 -0
  117. /package/dist/{chunk-3OHJLCSR.mjs → collections/index.mjs} +0 -0
  118. /package/dist/{chunk-ZOH672YH.js → functor/index.js} +0 -0
  119. /package/dist/{chunk-72IAI5F4.mjs → functor/index.mjs} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var _chunkAU3JU6VYjs = require('./chunk-AU3JU6VY.js');var n=class r extends _chunkAU3JU6VYjs.a{constructor(t){super(t)}map(t){return new r(super.map(t).toArray())}flatMap(t){return new r(super.flatMap(t).toArray())}remove(t){let i=new r().toArray().indexOf(t);return this.removeAt(i)}contains(t){return this.toArray().indexOf(t)!==-1}add(t){let i=[...this.toArray(),t];return new r(i)}removeAt(t){if(t<0||t>=this.toArray().length)return this;let e=[...this.toArray().slice(0,t),...this.toArray().slice(t+1)];return new r(e)}get(t){return _chunkAU3JU6VYjs.d.call(void 0, this.toArray()[t])}concat(t){return new r([...this.toArray(),...t.toArray()])}toList(){return this}toSet(){return new s(this.toArray())}toString(){return`List(${this.toArray().toString()})`}};var s=class r extends _chunkAU3JU6VYjs.a{constructor(t){super(new (0, _chunk3VJERXBPjs.a)(t))}add(t){return new r([...this.values,t])}remove(t){let e=new _chunk3VJERXBPjs.a;return e.delete(t)?new r(e):this}contains(t){return this.has(t)}has(t){return this.values.has(t)}map(t){return new r(super.map(t).toArray())}flatMap(t){return new r(super.flatMap(t).toArray())}toList(){return new n(this.toArray())}toSet(){return this}};exports.a = s; exports.b = n;
@@ -0,0 +1 @@
1
+ import{b as r}from"./chunk-FBZLCLTN.mjs";import{e}from"./chunk-5RNU6GKU.mjs";var i=class s{constructor(t){this.value=t}isLeft(){return!1}isRight(){return!0}map(t){return new s(t(this.value))}flatMap(t){return t(this.value)}toOption(){return e(this.value)}toList(){return new r([this.value])}};export{i as a};
@@ -0,0 +1 @@
1
+ import{a as l}from"./chunk-RRAIFS3D.mjs";import{a as p}from"./chunk-U5EUM74A.mjs";var a=class t{constructor(e){this.value=e}get isEmpty(){return!1}get(){return this.value}getOrElse(e){return this.value}orElse(e){return this}map(e){return new t(e(this.value))}flatMap(e){return e(this.value)}reduce(e){return e(void 0,this.value)}reduceRight(e){return e(void 0,this.value)}foldLeft(e){return r=>r(e,this.value)}foldRight(e){return r=>r(this.value,e)}toList(){return new n([this.value])}contains(e){return!1}get size(){return 0}};var i=class t{get isEmpty(){return!0}get(){throw new Error("Cannot call get() on a None")}getOrElse(e){return e}orElse(e){return e}map(e){return new t}flatMap(e){return new t}reduce(e){return e(void 0,void 0)}reduceRight(e){return e(void 0,void 0)}foldLeft(e){return r=>e}foldRight(e){return r=>e}toList(){return new n}contains(e){return!1}get size(){return 0}};var s=t=>t?f(t):A(),f=t=>new a(t),A=()=>new i;var n=class t{constructor(e){p(this,"values");l(e)?this.values=e:e instanceof t?this.values=e.toArray():e||(this.values=[])}get length(){return this.toArray().length}map(e){return new t(this.toArray().map(e))}flatMap(e){let r=[];for(let u of this.values){let o=e(u);o instanceof t&&r.push(...o.values)}return new t(r)}forEach(e){this.toArray().forEach(e)}count(e){return 0}exists(e){return!this.find(e).isEmpty}filter(e){return new t(this.toArray().filter(e))}filterNot(e){return new t(this.toArray().filter(r=>!e(r)))}find(e){let r=this.toArray().find(e);return s(r)}get head(){return this.values[0]}get headOption(){return this.isEmpty?s(this.head):A()}get isEmpty(){return this.toArray().length===0}get size(){return 0}toArray(){return Array.from(this.values)}reduce(e){return this.toArray().reduce(e)}reduceRight(e){return this.toArray().reduceRight(e)}foldLeft(e){return r=>this.toArray().reduce(r,e)}foldRight(e){return r=>this.toArray().reduceRight((u,o)=>r(o,u),e)}};export{n as a,a as b,i as c,s as d,f as e,A as f};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZQB7I77Mjs = require('./chunk-ZQB7I77M.js');var _chunk5XVNJUCAjs = require('./chunk-5XVNJUCA.js');var L=t=>new (0, _chunkZQB7I77Mjs.a)(t),R= exports.b =t=>new (0, _chunk5XVNJUCAjs.a)(t);exports.a = L; exports.b = R;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk35Y3S46Cjs = require('./chunk-35Y3S46C.js');var _chunkAU3JU6VYjs = require('./chunk-AU3JU6VY.js');var i=class s{constructor(t){this.value=t}isLeft(){return!1}isRight(){return!0}map(t){return new s(t(this.value))}flatMap(t){return t(this.value)}toOption(){return _chunkAU3JU6VYjs.e.call(void 0, this.value)}toList(){return new (0, _chunk35Y3S46Cjs.b)([this.value])}};exports.a = i;
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-L4P3MMUC.mjs";import{a as r}from"./chunk-5OCPRWBH.mjs";var L=t=>new i(t),R=t=>new r(t);export{L as a,R as b};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var _chunkVTKL7OQIjs = require('./chunk-VTKL7OQI.js');var a=class t{constructor(e){this.value=e}get isEmpty(){return!1}get(){return this.value}getOrElse(e){return this.value}orElse(e){return this}map(e){return new t(e(this.value))}flatMap(e){return e(this.value)}reduce(e){return e(void 0,this.value)}reduceRight(e){return e(void 0,this.value)}foldLeft(e){return r=>r(e,this.value)}foldRight(e){return r=>r(this.value,e)}toList(){return new n([this.value])}contains(e){return!1}get size(){return 0}};var i=class t{get isEmpty(){return!0}get(){throw new Error("Cannot call get() on a None")}getOrElse(e){return e}orElse(e){return e}map(e){return new t}flatMap(e){return new t}reduce(e){return e(void 0,void 0)}reduceRight(e){return e(void 0,void 0)}foldLeft(e){return r=>e}foldRight(e){return r=>e}toList(){return new n}contains(e){return!1}get size(){return 0}};var s=t=>t?f(t):A(),f= exports.e =t=>new a(t),A= exports.f =()=>new i;var n=class t{constructor(e){_chunkVTKL7OQIjs.a.call(void 0, this,"values");_chunkBNNK42JCjs.a.call(void 0, e)?this.values=e:e instanceof t?this.values=e.toArray():e||(this.values=[])}get length(){return this.toArray().length}map(e){return new t(this.toArray().map(e))}flatMap(e){let r=[];for(let u of this.values){let o=e(u);o instanceof t&&r.push(...o.values)}return new t(r)}forEach(e){this.toArray().forEach(e)}count(e){return 0}exists(e){return!this.find(e).isEmpty}filter(e){return new t(this.toArray().filter(e))}filterNot(e){return new t(this.toArray().filter(r=>!e(r)))}find(e){let r=this.toArray().find(e);return s(r)}get head(){return this.values[0]}get headOption(){return this.isEmpty?s(this.head):A()}get isEmpty(){return this.toArray().length===0}get size(){return 0}toArray(){return Array.from(this.values)}reduce(e){return this.toArray().reduce(e)}reduceRight(e){return this.toArray().reduceRight(e)}foldLeft(e){return r=>this.toArray().reduce(r,e)}foldRight(e){return r=>this.toArray().reduceRight((u,o)=>r(o,u),e)}};exports.a = n; exports.b = a; exports.c = i; exports.d = s; exports.e = f; exports.f = A;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var e=t=>t!=null&&typeof t[Symbol.iterator]=="function";exports.a = e;
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-HA5XD5KC.mjs";import{a as o,d as A}from"./chunk-5RNU6GKU.mjs";var n=class r extends o{constructor(t){super(t)}map(t){return new r(super.map(t).toArray())}flatMap(t){return new r(super.flatMap(t).toArray())}remove(t){let i=new r().toArray().indexOf(t);return this.removeAt(i)}contains(t){return this.toArray().indexOf(t)!==-1}add(t){let i=[...this.toArray(),t];return new r(i)}removeAt(t){if(t<0||t>=this.toArray().length)return this;let e=[...this.toArray().slice(0,t),...this.toArray().slice(t+1)];return new r(e)}get(t){return A(this.toArray()[t])}concat(t){return new r([...this.toArray(),...t.toArray()])}toList(){return this}toSet(){return new s(this.toArray())}toString(){return`List(${this.toArray().toString()})`}};var s=class r extends o{constructor(t){super(new a(t))}add(t){return new r([...this.values,t])}remove(t){let e=new a;return e.delete(t)?new r(e):this}contains(t){return this.has(t)}has(t){return this.values.has(t)}map(t){return new r(super.map(t).toArray())}flatMap(t){return new r(super.flatMap(t).toArray())}toList(){return new n(this.toArray())}toSet(){return this}};export{s as a,n as b};
@@ -0,0 +1 @@
1
+ import{b as e}from"./chunk-FBZLCLTN.mjs";import{f as i}from"./chunk-5RNU6GKU.mjs";var o=class t{constructor(r){this.value=r}isLeft(){return!0}isRight(){return!1}map(r){return new t(this.value)}flatMap(r){return new t(this.value)}toOption(){return i()}toList(){return new e}};export{o as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSSP26X5Yjs = require('./chunk-SSP26X5Y.js');var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunk35Y3S46Cjs = require('./chunk-35Y3S46C.js');var _chunkAU3JU6VYjs = require('./chunk-AU3JU6VY.js');var _chunkVTKL7OQIjs = require('./chunk-VTKL7OQI.js');var o=class s{constructor(e){_chunkVTKL7OQIjs.a.call(void 0, this,"values");this.values=new (0, _chunk5VTXJIR3js.a)(e)}get entries(){return Array.from(this.values.entries()).map(([e,t])=>new (0, _chunkSSP26X5Yjs.a)([e,t]))}add(e){return new s(this.values.set(e[0],e[1]).entries())}remove(e){let t=new s([...this.values.entries()]);return t.values.delete(e[0])?t:this}contains(e){return this.values.get(e[0])===e[1]}get size(){return this.values.size}map(e){let t=[];for(let[r,u]of this.values.entries())t.push([r,e(u)]);return new s(t)}flatMap(e){let t=[];for(let[r,u]of this.values.entries()){let a=e(u);if(a instanceof s)for(let[f,c]of a.values.entries())t.push([f,c])}return new s(t)}reduce(e){return new (0, _chunkAU3JU6VYjs.a)(this.entries).reduce(e)}reduceRight(e){return new (0, _chunkAU3JU6VYjs.a)(this.entries).reduceRight(e)}foldLeft(e){let t=new (0, _chunkAU3JU6VYjs.a)(this.entries);return r=>t.foldLeft(e)(r)}foldRight(e){let t=new (0, _chunkAU3JU6VYjs.a)(this.entries);return r=>t.foldRight(e)(r)}get(e){return _chunkAU3JU6VYjs.d.call(void 0, this.values.get(e))}getOrElse(e,t){return _chunkAU3JU6VYjs.d.call(void 0, this.values.get(e)).getOrElse(t)}get isEmpty(){return this.values.size===0}orElse(e,t){let r=_chunkAU3JU6VYjs.d.call(void 0, this.values.get(e));return t}toList(){return new (0, _chunk35Y3S46Cjs.b)(this.entries)}toSet(){return new (0, _chunk35Y3S46Cjs.a)(this.entries)}},M=new o([["a",1],["b",2],["c",3]]);exports.a = o;
@@ -0,0 +1 @@
1
+ var e=t=>t!=null&&typeof t[Symbol.iterator]=="function";export{e as a};
@@ -0,0 +1 @@
1
+ import{a as m}from"./chunk-VM6KG6UB.mjs";import{a as V}from"./chunk-377WQNCB.mjs";import{a as p,b as K}from"./chunk-FBZLCLTN.mjs";import{a as n,d as i}from"./chunk-5RNU6GKU.mjs";import{a as l}from"./chunk-U5EUM74A.mjs";var o=class s{constructor(e){l(this,"values");this.values=new V(e)}get entries(){return Array.from(this.values.entries()).map(([e,t])=>new m([e,t]))}add(e){return new s(this.values.set(e[0],e[1]).entries())}remove(e){let t=new s([...this.values.entries()]);return t.values.delete(e[0])?t:this}contains(e){return this.values.get(e[0])===e[1]}get size(){return this.values.size}map(e){let t=[];for(let[r,u]of this.values.entries())t.push([r,e(u)]);return new s(t)}flatMap(e){let t=[];for(let[r,u]of this.values.entries()){let a=e(u);if(a instanceof s)for(let[f,c]of a.values.entries())t.push([f,c])}return new s(t)}reduce(e){return new n(this.entries).reduce(e)}reduceRight(e){return new n(this.entries).reduceRight(e)}foldLeft(e){let t=new n(this.entries);return r=>t.foldLeft(e)(r)}foldRight(e){let t=new n(this.entries);return r=>t.foldRight(e)(r)}get(e){return i(this.values.get(e))}getOrElse(e,t){return i(this.values.get(e)).getOrElse(t)}get isEmpty(){return this.values.size===0}orElse(e,t){let r=i(this.values.get(e));return t}toList(){return new K(this.entries)}toSet(){return new p(this.entries)}},M=new o([["a",1],["b",2],["c",3]]);export{o as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk35Y3S46Cjs = require('./chunk-35Y3S46C.js');var _chunkAU3JU6VYjs = require('./chunk-AU3JU6VY.js');var o=class t{constructor(r){this.value=r}isLeft(){return!0}isRight(){return!1}map(r){return new t(this.value)}flatMap(r){return new t(this.value)}toOption(){return _chunkAU3JU6VYjs.f.call(void 0, )}toList(){return new _chunk35Y3S46Cjs.b}};exports.a = o;
@@ -0,0 +1,5 @@
1
+ export { a as ICollection, b as IConverters } from '../index-3628fb7a.js';
2
+ import '../list/IList.mjs';
3
+ import '../index-18491592.js';
4
+ import '../functor/index.mjs';
5
+ import '../index.mjs';
@@ -0,0 +1,5 @@
1
+ export { a as ICollection, b as IConverters } from '../index-8434e22f.js';
2
+ import '../list/IList.js';
3
+ import '../index-64357013.js';
4
+ import '../functor/index.js';
5
+ import '../index.js';
@@ -1,2 +1,9 @@
1
- export { Left } from '../index.mjs';
2
- import '../error/ParseError.mjs';
1
+ export { Left } from './index.mjs';
2
+ import '../list/List.mjs';
3
+ import '../index-18491592.js';
4
+ import '../functor/index.mjs';
5
+ import '../iterable/Seq.mjs';
6
+ import '../index.mjs';
7
+ import '../index-3628fb7a.js';
8
+ import '../list/IList.mjs';
9
+ import '../set/Set.mjs';
@@ -1,2 +1,9 @@
1
- export { Left } from '../index.js';
2
- import '../error/ParseError.js';
1
+ export { Left } from './index.js';
2
+ import '../list/List.js';
3
+ import '../index-64357013.js';
4
+ import '../functor/index.js';
5
+ import '../iterable/Seq.js';
6
+ import '../index.js';
7
+ import '../index-8434e22f.js';
8
+ import '../list/IList.js';
9
+ import '../set/Set.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7XCWDOMWjs = require('../chunk-7XCWDOMW.js');require('../chunk-DOG6HMTN.js');require('../chunk-XNAZ5QU3.js');require('../chunk-3VJERXBP.js');require('../chunk-ZTL76QDL.js');require('../chunk-ZOH672YH.js');require('../chunk-7VFL33KH.js');require('../chunk-5VTXJIR3.js');require('../chunk-TVZBBVEV.js');require('../chunk-SSP26X5Y.js');require('../chunk-WY62QD3C.js');require('../chunk-VTKL7OQI.js');exports.Left = _chunk7XCWDOMWjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZQB7I77Mjs = require('../chunk-ZQB7I77M.js');require('../chunk-35Y3S46C.js');require('../chunk-3VJERXBP.js');require('../chunk-AU3JU6VY.js');require('../chunk-BNNK42JC.js');require('../chunk-VTKL7OQI.js');exports.Left = _chunkZQB7I77Mjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-VWFTFPZB.mjs";import"../chunk-72IAI5F4.mjs";import"../chunk-U237FVPP.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-CFYIJKWF.mjs";import"../chunk-3OHJLCSR.mjs";import"../chunk-PKWOSOD7.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-LBQXRIXP.mjs";import"../chunk-VM6KG6UB.mjs";import"../chunk-CZKHN2SM.mjs";import"../chunk-U5EUM74A.mjs";export{a as Left};
1
+ import{a}from"../chunk-L4P3MMUC.mjs";import"../chunk-FBZLCLTN.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-5RNU6GKU.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-U5EUM74A.mjs";export{a as Left};
@@ -1,2 +1,9 @@
1
- export { Right } from '../index.mjs';
2
- import '../error/ParseError.mjs';
1
+ export { Right } from './index.mjs';
2
+ import '../list/List.mjs';
3
+ import '../index-18491592.js';
4
+ import '../functor/index.mjs';
5
+ import '../iterable/Seq.mjs';
6
+ import '../index.mjs';
7
+ import '../index-3628fb7a.js';
8
+ import '../list/IList.mjs';
9
+ import '../set/Set.mjs';
@@ -1,2 +1,9 @@
1
- export { Right } from '../index.js';
2
- import '../error/ParseError.js';
1
+ export { Right } from './index.js';
2
+ import '../list/List.js';
3
+ import '../index-64357013.js';
4
+ import '../functor/index.js';
5
+ import '../iterable/Seq.js';
6
+ import '../index.js';
7
+ import '../index-8434e22f.js';
8
+ import '../list/IList.js';
9
+ import '../set/Set.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7XCWDOMWjs = require('../chunk-7XCWDOMW.js');require('../chunk-DOG6HMTN.js');require('../chunk-XNAZ5QU3.js');require('../chunk-3VJERXBP.js');require('../chunk-ZTL76QDL.js');require('../chunk-ZOH672YH.js');require('../chunk-7VFL33KH.js');require('../chunk-5VTXJIR3.js');require('../chunk-TVZBBVEV.js');require('../chunk-SSP26X5Y.js');require('../chunk-WY62QD3C.js');require('../chunk-VTKL7OQI.js');exports.Right = _chunk7XCWDOMWjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5XVNJUCAjs = require('../chunk-5XVNJUCA.js');require('../chunk-35Y3S46C.js');require('../chunk-3VJERXBP.js');require('../chunk-AU3JU6VY.js');require('../chunk-BNNK42JC.js');require('../chunk-VTKL7OQI.js');exports.Right = _chunk5XVNJUCAjs.a;
@@ -1 +1 @@
1
- import{b as a}from"../chunk-VWFTFPZB.mjs";import"../chunk-72IAI5F4.mjs";import"../chunk-U237FVPP.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-CFYIJKWF.mjs";import"../chunk-3OHJLCSR.mjs";import"../chunk-PKWOSOD7.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-LBQXRIXP.mjs";import"../chunk-VM6KG6UB.mjs";import"../chunk-CZKHN2SM.mjs";import"../chunk-U5EUM74A.mjs";export{a as Right};
1
+ import{a}from"../chunk-5OCPRWBH.mjs";import"../chunk-FBZLCLTN.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-5RNU6GKU.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-U5EUM74A.mjs";export{a as Right};
@@ -1,2 +1,44 @@
1
- import '../error/ParseError.mjs';
2
- export { Either, Left, Right, left, parseNumber, right } from '../index.mjs';
1
+ import { List } from '../list/List.mjs';
2
+ import { I as IOption } from '../index-18491592.js';
3
+ import { IFunctor } from '../functor/index.mjs';
4
+ import '../iterable/Seq.mjs';
5
+ import '../index-3628fb7a.js';
6
+ import '../list/IList.mjs';
7
+ import '../set/Set.mjs';
8
+ import '../index.mjs';
9
+
10
+ declare class Left<L, R> implements Either<L, R> {
11
+ value: L;
12
+ constructor(value: L);
13
+ isLeft(): this is Left<L, R>;
14
+ isRight(): this is Right<L, R>;
15
+ map<U>(_f: (value: R) => U): Either<L, U>;
16
+ flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
17
+ toOption(): IOption<R>;
18
+ toList(): List<R>;
19
+ }
20
+
21
+ declare class Right<L, R> implements Either<L, R> {
22
+ value: R;
23
+ constructor(value: R);
24
+ isLeft(): this is Left<L, R>;
25
+ isRight(): this is Right<L, R>;
26
+ map<U>(f: (value: R) => U): Either<L, U>;
27
+ flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
28
+ toOption(): IOption<R>;
29
+ toList(): List<R>;
30
+ }
31
+
32
+ interface Either<L, R> extends IFunctor<R> {
33
+ value: L | R;
34
+ isLeft(): this is Left<L, R>;
35
+ isRight(): this is Right<L, R>;
36
+ map<U>(f: (value: R) => U): Either<L, U>;
37
+ flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
38
+ toOption(): IOption<R>;
39
+ toList(): List<R>;
40
+ }
41
+ declare const left: <L, R>(value: L) => Either<L, R>;
42
+ declare const right: <L, R>(value: R) => Either<L, R>;
43
+
44
+ export { Either, Left, Right, left, right };
@@ -1,2 +1,44 @@
1
- import '../error/ParseError.js';
2
- export { Either, Left, Right, left, parseNumber, right } from '../index.js';
1
+ import { List } from '../list/List.js';
2
+ import { I as IOption } from '../index-64357013.js';
3
+ import { IFunctor } from '../functor/index.js';
4
+ import '../iterable/Seq.js';
5
+ import '../index-8434e22f.js';
6
+ import '../list/IList.js';
7
+ import '../set/Set.js';
8
+ import '../index.js';
9
+
10
+ declare class Left<L, R> implements Either<L, R> {
11
+ value: L;
12
+ constructor(value: L);
13
+ isLeft(): this is Left<L, R>;
14
+ isRight(): this is Right<L, R>;
15
+ map<U>(_f: (value: R) => U): Either<L, U>;
16
+ flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
17
+ toOption(): IOption<R>;
18
+ toList(): List<R>;
19
+ }
20
+
21
+ declare class Right<L, R> implements Either<L, R> {
22
+ value: R;
23
+ constructor(value: R);
24
+ isLeft(): this is Left<L, R>;
25
+ isRight(): this is Right<L, R>;
26
+ map<U>(f: (value: R) => U): Either<L, U>;
27
+ flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
28
+ toOption(): IOption<R>;
29
+ toList(): List<R>;
30
+ }
31
+
32
+ interface Either<L, R> extends IFunctor<R> {
33
+ value: L | R;
34
+ isLeft(): this is Left<L, R>;
35
+ isRight(): this is Right<L, R>;
36
+ map<U>(f: (value: R) => U): Either<L, U>;
37
+ flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
38
+ toOption(): IOption<R>;
39
+ toList(): List<R>;
40
+ }
41
+ declare const left: <L, R>(value: L) => Either<L, R>;
42
+ declare const right: <L, R>(value: R) => Either<L, R>;
43
+
44
+ export { Either, Left, Right, left, right };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7XCWDOMWjs = require('../chunk-7XCWDOMW.js');require('../chunk-DOG6HMTN.js');require('../chunk-XNAZ5QU3.js');require('../chunk-3VJERXBP.js');require('../chunk-ZTL76QDL.js');require('../chunk-ZOH672YH.js');require('../chunk-7VFL33KH.js');require('../chunk-5VTXJIR3.js');require('../chunk-TVZBBVEV.js');require('../chunk-SSP26X5Y.js');require('../chunk-WY62QD3C.js');require('../chunk-VTKL7OQI.js');exports.Left = _chunk7XCWDOMWjs.a; exports.Right = _chunk7XCWDOMWjs.b; exports.left = _chunk7XCWDOMWjs.c; exports.parseNumber = _chunk7XCWDOMWjs.e; exports.right = _chunk7XCWDOMWjs.d;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5SPJ52B5js = require('../chunk-5SPJ52B5.js');var _chunkZQB7I77Mjs = require('../chunk-ZQB7I77M.js');var _chunk5XVNJUCAjs = require('../chunk-5XVNJUCA.js');require('../chunk-35Y3S46C.js');require('../chunk-3VJERXBP.js');require('../chunk-AU3JU6VY.js');require('../chunk-BNNK42JC.js');require('../chunk-VTKL7OQI.js');exports.Left = _chunkZQB7I77Mjs.a; exports.Right = _chunk5XVNJUCAjs.a; exports.left = _chunk5SPJ52B5js.a; exports.right = _chunk5SPJ52B5js.b;
@@ -1 +1 @@
1
- import{a,b,c,d,e}from"../chunk-VWFTFPZB.mjs";import"../chunk-72IAI5F4.mjs";import"../chunk-U237FVPP.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-CFYIJKWF.mjs";import"../chunk-3OHJLCSR.mjs";import"../chunk-PKWOSOD7.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-LBQXRIXP.mjs";import"../chunk-VM6KG6UB.mjs";import"../chunk-CZKHN2SM.mjs";import"../chunk-U5EUM74A.mjs";export{a as Left,b as Right,c as left,e as parseNumber,d as right};
1
+ import{a as c,b as d}from"../chunk-AGJ7VCYK.mjs";import{a}from"../chunk-L4P3MMUC.mjs";import{a as b}from"../chunk-5OCPRWBH.mjs";import"../chunk-FBZLCLTN.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-5RNU6GKU.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-U5EUM74A.mjs";export{a as Left,b as Right,c as left,d as right};
@@ -0,0 +1,17 @@
1
+ type SingleType = any;
2
+ type ArrayType = SingleType[];
3
+ type Type = SingleType | ArrayType;
4
+ interface IAbstractFunctor<A extends Type> {
5
+ map(f: (value: A) => Type): IAbstractFunctor<Type>;
6
+ flatMap(f: (value: A) => IAbstractFunctor<Type>): IAbstractFunctor<Type>;
7
+ }
8
+ interface IFunctor<A extends Type> extends IAbstractFunctor<A> {
9
+ map<B extends Type>(f: (value: A) => B): IFunctor<B>;
10
+ flatMap<B extends Type>(f: (value: A) => IFunctor<B>): IFunctor<B>;
11
+ }
12
+ interface IArrayFunctor<A extends ArrayType> extends IAbstractFunctor<A> {
13
+ map<U extends ArrayType>(f: (value: A) => U): IArrayFunctor<U>;
14
+ flatMap<U extends ArrayType>(f: (value: A) => IArrayFunctor<U>): IArrayFunctor<U>;
15
+ }
16
+
17
+ export { ArrayType, IAbstractFunctor, IArrayFunctor, IFunctor, SingleType, Type };
@@ -0,0 +1,17 @@
1
+ type SingleType = any;
2
+ type ArrayType = SingleType[];
3
+ type Type = SingleType | ArrayType;
4
+ interface IAbstractFunctor<A extends Type> {
5
+ map(f: (value: A) => Type): IAbstractFunctor<Type>;
6
+ flatMap(f: (value: A) => IAbstractFunctor<Type>): IAbstractFunctor<Type>;
7
+ }
8
+ interface IFunctor<A extends Type> extends IAbstractFunctor<A> {
9
+ map<B extends Type>(f: (value: A) => B): IFunctor<B>;
10
+ flatMap<B extends Type>(f: (value: A) => IFunctor<B>): IFunctor<B>;
11
+ }
12
+ interface IArrayFunctor<A extends ArrayType> extends IAbstractFunctor<A> {
13
+ map<U extends ArrayType>(f: (value: A) => U): IArrayFunctor<U>;
14
+ flatMap<U extends ArrayType>(f: (value: A) => IArrayFunctor<U>): IArrayFunctor<U>;
15
+ }
16
+
17
+ export { ArrayType, IAbstractFunctor, IArrayFunctor, IFunctor, SingleType, Type };
@@ -0,0 +1,33 @@
1
+ import { Type, IFunctor } from './functor/index.mjs';
2
+ import { ITraversable } from './index.mjs';
3
+
4
+ interface IOption<T extends Type> extends IFunctor<T>, ITraversable<T> {
5
+ get(): T;
6
+ getOrElse(defaultValue: T): T;
7
+ orElse(alternative: IOption<T>): IOption<T>;
8
+ map<U extends Type>(f: (value: T) => U): IOption<U>;
9
+ flatMap<U extends Type>(f: (value: T) => IOption<U>): IOption<U>;
10
+ toList(): IIterable<T>;
11
+ }
12
+
13
+ interface IIterable<A extends Type> extends IFunctor<A> {
14
+ count(p: (x: A) => boolean): number;
15
+ find(p: (a: A) => boolean): IOption<A>;
16
+ forEach(f: (a: A) => void): void;
17
+ exists(p: (a: A) => boolean): Boolean;
18
+ filter(p: (a: A) => boolean): IIterable<A>;
19
+ filterNot(p: (a: A) => boolean): IIterable<A>;
20
+ reduce(f: (b: A, a: A) => A): A;
21
+ reduceRight(f: (b: A, a: A) => A): A;
22
+ foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
23
+ foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
24
+ get head(): A;
25
+ get headOption(): IOption<A>;
26
+ get isEmpty(): boolean;
27
+ map<B extends Type>(f: (a: A) => B): IIterable<B>;
28
+ flatMap<B extends Type>(f: (a: A) => IIterable<B>): IIterable<B>;
29
+ get size(): number;
30
+ toArray(): readonly A[];
31
+ }
32
+
33
+ export { IOption as I, IIterable as a };
@@ -0,0 +1,15 @@
1
+ import { a as IIterable } from './index-18491592.js';
2
+ import { IList } from './list/IList.mjs';
3
+
4
+ interface ISet<T> extends IIterable<T>, ICollection<T> {
5
+ has(value: T): boolean;
6
+ }
7
+
8
+ interface IConverters<A> {
9
+ toList(): IList<A>;
10
+ toSet(): ISet<A>;
11
+ }
12
+ interface ICollection<A> extends IConverters<A> {
13
+ }
14
+
15
+ export { ISet as I, ICollection as a, IConverters as b };
@@ -0,0 +1,33 @@
1
+ import { Type, IFunctor } from './functor/index.js';
2
+ import { ITraversable } from './index.js';
3
+
4
+ interface IOption<T extends Type> extends IFunctor<T>, ITraversable<T> {
5
+ get(): T;
6
+ getOrElse(defaultValue: T): T;
7
+ orElse(alternative: IOption<T>): IOption<T>;
8
+ map<U extends Type>(f: (value: T) => U): IOption<U>;
9
+ flatMap<U extends Type>(f: (value: T) => IOption<U>): IOption<U>;
10
+ toList(): IIterable<T>;
11
+ }
12
+
13
+ interface IIterable<A extends Type> extends IFunctor<A> {
14
+ count(p: (x: A) => boolean): number;
15
+ find(p: (a: A) => boolean): IOption<A>;
16
+ forEach(f: (a: A) => void): void;
17
+ exists(p: (a: A) => boolean): Boolean;
18
+ filter(p: (a: A) => boolean): IIterable<A>;
19
+ filterNot(p: (a: A) => boolean): IIterable<A>;
20
+ reduce(f: (b: A, a: A) => A): A;
21
+ reduceRight(f: (b: A, a: A) => A): A;
22
+ foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
23
+ foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
24
+ get head(): A;
25
+ get headOption(): IOption<A>;
26
+ get isEmpty(): boolean;
27
+ map<B extends Type>(f: (a: A) => B): IIterable<B>;
28
+ flatMap<B extends Type>(f: (a: A) => IIterable<B>): IIterable<B>;
29
+ get size(): number;
30
+ toArray(): readonly A[];
31
+ }
32
+
33
+ export { IOption as I, IIterable as a };
@@ -0,0 +1,15 @@
1
+ import { a as IIterable } from './index-64357013.js';
2
+ import { IList } from './list/IList.js';
3
+
4
+ interface ISet<T> extends IIterable<T>, ICollection<T> {
5
+ has(value: T): boolean;
6
+ }
7
+
8
+ interface IConverters<A> {
9
+ toList(): IList<A>;
10
+ toSet(): ISet<A>;
11
+ }
12
+ interface ICollection<A> extends IConverters<A> {
13
+ }
14
+
15
+ export { ISet as I, ICollection as a, IConverters as b };
package/dist/index.d.mts CHANGED
@@ -1,212 +1,13 @@
1
- import { ParseError } from './error/ParseError.mjs';
1
+ import { Type, IFunctor } from './functor/index.mjs';
2
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
- toOption(): Option<R>;
11
- toList(): List<R>;
12
- }
13
-
14
- declare class Right<L, R> implements Either<L, R> {
15
- value: R;
16
- constructor(value: R);
17
- isLeft(): this is Left<L, R>;
18
- isRight(): this is Right<L, R>;
19
- map<U>(f: (value: R) => U): Either<L, U>;
20
- flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
21
- toOption(): Option<R>;
22
- toList(): List<R>;
23
- }
24
-
25
- interface Either<L, R> extends IFunctor<R> {
26
- value: L | R;
27
- isLeft(): this is Left<L, R>;
28
- isRight(): this is Right<L, R>;
29
- map<U>(f: (value: R) => U): Either<L, U>;
30
- flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
31
- toOption(): Option<R>;
32
- toList(): List<R>;
33
- }
34
- declare const left: <L, R>(value: L) => Either<L, R>;
35
- declare const right: <L, R>(value: R) => Either<L, R>;
36
- declare const parseNumber: (input: string) => Either<ParseError, number>;
37
-
38
- declare class Some<T extends Type> implements Option<T> {
39
- private value;
40
- constructor(value: T);
41
- get isEmpty(): boolean;
42
- get(): T;
43
- getOrElse(defaultValue: T): T;
44
- orElse(alternative: Option<T>): Option<T>;
45
- map<U extends Type>(f: (value: T) => U): Option<U>;
46
- flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
47
- reduce<U>(f: (acc: U, value: T) => U): U;
48
- foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
49
- foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
50
- toList(): List<T>;
51
- contains(value: T): boolean;
52
- get size(): number;
53
- }
54
-
55
- declare class None<T extends Type> implements Option<T> {
56
- get isEmpty(): boolean;
57
- get(): T;
58
- getOrElse(defaultValue: T): T;
59
- orElse(alternative: Option<T>): Option<T>;
60
- map<U extends Type>(f: (value: T) => U): Option<U>;
61
- flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
62
- reduce<U>(f: (acc: U, value: T) => U): U;
63
- foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
64
- foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
65
- toList(): List<T>;
66
- contains(value: T): boolean;
67
- get size(): number;
68
- }
69
-
70
- interface Option<T extends Type> extends IFunctor<T>, ITraversable<T> {
71
- get(): T;
72
- getOrElse(defaultValue: T): T;
73
- orElse(alternative: Option<T>): Option<T>;
74
- map<U extends Type>(f: (value: T) => U): Option<U>;
75
- flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
76
- toList(): List<T>;
77
- }
78
- declare const option: <T extends unknown>(value?: T | undefined) => Option<T>;
79
- declare const some: <T extends unknown>(value: T) => Option<T>;
80
- declare const none: <T extends unknown>() => Option<T>;
81
-
82
- declare class List<T> implements IList<T> {
83
- private readonly items;
84
- constructor(iterable?: Iterable<T>);
85
- readonly [n: number]: T;
86
- remove(value: T): List<T>;
87
- contains(value: T): boolean;
88
- get size(): number;
89
- get isEmpty(): boolean;
90
- get length(): number;
91
- add(item: T): List<T>;
92
- removeAt(index: number): List<T>;
93
- get(index: number): Option<T>;
94
- toArray(): readonly T[];
95
- map<U>(f: (value: T) => U): List<U>;
96
- flatMap<U>(f: (value: T) => List<U>): List<U>;
97
- reduce<U>(f: (acc: U, value: T) => U): U;
98
- foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
99
- foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
100
- concat(other: List<T>): List<T>;
101
- toString(): string;
102
- }
103
-
104
- interface IList<T extends Type> extends IFunctor<T>, ICollection<T>, ArrayLike<T> {
105
- map<U extends Type>(f: (value: T) => U): IList<U>;
106
- flatMap<U extends Type>(f: (value: T) => IList<U>): IList<U>;
107
- reduce<U extends Type>(f: (acc: U, value: T) => U): U;
108
- foldLeft<U extends Type>(initialValue: U, f: (acc: U, value: T) => U): U;
109
- foldRight<U extends Type>(initialValue: U, f: (value: T, acc: U) => U): U;
110
- }
111
- declare const list: <T extends unknown>(items: T[] | undefined) => List<T>;
112
-
113
- declare class Tuple<T extends ArrayType> implements ITuple<T> {
114
- private readonly values;
115
- constructor(values: T);
116
- map<U extends ArrayType>(f: (value: T) => U): Tuple<U>;
117
- flatMap<U extends ArrayType>(f: (value: T) => Tuple<U>): Tuple<U>;
118
- get(index: number): T[number];
119
- getAs<U>(index: number, f?: (item: T) => boolean): U;
120
- toArray(): T;
121
- }
122
-
123
- interface ITuple<T extends ArrayType> extends IArrayFunctor<T> {
124
- get(index: number): T[number];
125
- getAs<U>(index: number, f?: (item: T) => boolean): U;
126
- map<U extends any[]>(f: (value: T) => U): ITuple<U>;
127
- flatMap<U extends any[]>(f: (value: T) => ITuple<U>): ITuple<U>;
128
- }
129
-
130
- declare class Map<K, V> implements IMap<K, V> {
131
- private internalMap;
132
- constructor(entries?: [K, V][]);
133
- add(item: K): Map<K, V>;
134
- remove(value: ITuple<[K, V]>): Map<K, V>;
135
- contains(value: ITuple<[K, V]>): boolean;
136
- get size(): number;
137
- map<U extends Type>(f: (value: V) => U): IMap<K, U>;
138
- flatMap<U extends Type>(f: (value: V) => IMap<K, U>): IMap<K, U>;
139
- reduce<U extends ITuple<[K, V]>>(f: (acc: U, value: ITuple<[K, V]>) => U): U;
140
- foldLeft<U>(initialValue: U, f: (acc: U, value: ITuple<[K, V]>) => U): U;
141
- foldRight<U>(initialValue: U, f: (value: ITuple<[K, V]>, acc: U) => U): U;
142
- get(key: K): Option<V>;
143
- getOrElse(key: K, defaultValue: V): V;
144
- get isEmpty(): boolean;
145
- orElse(key: K, alternative: Option<V>): Option<V>;
146
- }
147
-
148
- interface IMap<K, V> extends IFunctor<ITuple<[K, V]>>, ITraversable<ITuple<[K, V]>> {
149
- map<U>(f: (value: any) => U): IMap<K, U>;
150
- flatMap<U>(f: (value: any) => IMap<K, U>): IMap<K, U>;
151
- reduce<U extends ITuple<[K, V]>>(f: (acc: U, value: ITuple<[K, V]>) => U): U;
152
- foldLeft<U>(initialValue: U, f: (acc: U, value: ITuple<[K, V]>) => U): U;
153
- foldRight<U>(initialValue: U, f: (value: ITuple<[K, V]>, acc: U) => U): U;
154
- get(key: K): Option<V>;
155
- getOrElse(key: K, defaultValue: V): V;
156
- orElse(key: K, alternative: Option<V>): Option<V>;
157
- }
158
-
159
- declare class Set<T> implements ISet<T>, ICollection<T> {
160
- private readonly internalSet;
161
- constructor(iterable?: Iterable<T>);
162
- add(value: T): Set<T>;
163
- remove(value: T): Set<T>;
164
- contains(value: T): boolean;
3
+ interface ITraversable<A extends Type> extends IFunctor<A> {
165
4
  get size(): number;
166
5
  get isEmpty(): boolean;
167
- map<U>(f: (value: T) => U): ISet<U>;
168
- flatMap<U>(f: (value: T) => ISet<U>): ISet<U>;
169
- reduce<U>(f: (acc: U, value: T) => U): U;
170
- foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
171
- foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
172
- has(value: T): boolean;
173
- }
174
-
175
- interface ISet<T> extends IFunctor<T> {
176
- map<U>(f: (value: T) => U): ISet<U>;
177
- flatMap<U>(f: (value: T) => ISet<U>): ISet<U>;
178
- reduce<U>(f: (acc: U, value: T) => U): U;
179
- foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
180
- foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
181
- has(value: T): boolean;
182
- }
183
-
184
- type SingleType = any;
185
- type ArrayType = SingleType[];
186
- type Type = SingleType | ArrayType;
187
- interface AbstractFunctor<T extends Type> {
188
- map(f: (value: T) => Type): AbstractFunctor<Type>;
189
- flatMap(f: (value: T) => AbstractFunctor<Type>): AbstractFunctor<Type>;
190
- }
191
- interface IFunctor<T extends Type> extends AbstractFunctor<T> {
192
- map<U extends Type>(f: (value: T) => U): IFunctor<U>;
193
- flatMap<U extends Type>(f: (value: T) => IFunctor<U>): IFunctor<U>;
194
- }
195
- interface IArrayFunctor<T extends ArrayType> extends AbstractFunctor<T> {
196
- map<U extends ArrayType>(f: (value: T) => U): IArrayFunctor<U>;
197
- flatMap<U extends ArrayType>(f: (value: T) => IArrayFunctor<U>): IArrayFunctor<U>;
198
- }
199
- interface ITraversable<T extends Type> extends IFunctor<T> {
200
- get size(): number;
201
- get isEmpty(): boolean;
202
- contains(value: T): boolean;
203
- reduce<U extends T>(f: (acc: U, value: T) => U): U;
204
- foldLeft<U extends Type>(initialValue: U, f: (acc: U, value: T) => U): U;
205
- foldRight<U extends Type>(initialValue: U, f: (value: T, acc: U) => U): U;
206
- }
207
- interface ICollection<T extends Type> extends ITraversable<T> {
208
- add(value: T): ITraversable<T>;
209
- remove(value: T): ITraversable<T>;
6
+ contains(value: A): boolean;
7
+ reduce(f: (b: A, a: A) => A): A;
8
+ reduceRight(f: (b: A, a: A) => A): A;
9
+ foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
10
+ foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
210
11
  }
211
12
 
212
- export { AbstractFunctor, ArrayType, Either, IArrayFunctor, ICollection, IFunctor, IList, IMap, ISet, ITraversable, ITuple, Left, List, Map, None, Option, Right, Set, SingleType, Some, Tuple, Type, left, list, none, option, parseNumber, right, some };
13
+ export { ITraversable };