functype 0.8.20 → 0.8.22

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 (55) hide show
  1. package/dist/chunk-R5GXK4Y7.mjs +1 -0
  2. package/dist/chunk-XF5WD6R4.js +1 -0
  3. package/dist/collections/index.d.mts +1 -1
  4. package/dist/collections/index.d.ts +1 -1
  5. package/dist/either/Either.d.mts +1 -1
  6. package/dist/either/Either.d.ts +1 -1
  7. package/dist/either/Either.js +1 -1
  8. package/dist/either/Either.mjs +1 -1
  9. package/dist/either/EitherT.d.mts +1 -1
  10. package/dist/either/EitherT.d.ts +1 -1
  11. package/dist/either/EitherT.js +1 -1
  12. package/dist/either/EitherT.mjs +1 -1
  13. package/dist/{index-DxbBrdj_.d.mts → index-B3DiwP0P.d.mts} +30 -41
  14. package/dist/{index-DEY28JXj.d.ts → index-COhyPyGF.d.ts} +30 -41
  15. package/dist/index.d.mts +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.mjs +1 -1
  19. package/dist/iterable/Seq.d.mts +1 -1
  20. package/dist/iterable/Seq.d.ts +1 -1
  21. package/dist/iterable/Seq.js +1 -1
  22. package/dist/iterable/Seq.mjs +1 -1
  23. package/dist/iterable/index.d.mts +1 -1
  24. package/dist/iterable/index.d.ts +1 -1
  25. package/dist/iterable/index.js +1 -1
  26. package/dist/iterable/index.mjs +1 -1
  27. package/dist/list/List.d.mts +1 -1
  28. package/dist/list/List.d.ts +1 -1
  29. package/dist/list/List.js +1 -1
  30. package/dist/list/List.mjs +1 -1
  31. package/dist/map/Map.d.mts +1 -1
  32. package/dist/map/Map.d.ts +1 -1
  33. package/dist/map/Map.js +1 -1
  34. package/dist/map/Map.mjs +1 -1
  35. package/dist/option/Option.d.mts +1 -1
  36. package/dist/option/Option.d.ts +1 -1
  37. package/dist/option/Option.js +1 -1
  38. package/dist/option/Option.mjs +1 -1
  39. package/dist/set/Set.d.mts +1 -1
  40. package/dist/set/Set.d.ts +1 -1
  41. package/dist/set/Set.js +1 -1
  42. package/dist/set/Set.mjs +1 -1
  43. package/dist/try/Try.d.mts +1 -1
  44. package/dist/try/Try.d.ts +1 -1
  45. package/dist/try/Try.js +1 -1
  46. package/dist/try/Try.mjs +1 -1
  47. package/dist/util/index.d.mts +1 -1
  48. package/dist/util/index.d.ts +1 -1
  49. package/dist/util/index.js +1 -1
  50. package/dist/util/index.mjs +1 -1
  51. package/lib/either/Either.d.ts +26 -39
  52. package/lib/list/List.d.ts +6 -3
  53. package/package.json +1 -1
  54. package/dist/chunk-MGOOHJA4.mjs +0 -1
  55. package/dist/chunk-ZT6U462C.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as v}from"./chunk-2I2NKDFN.mjs";import{a as b}from"./chunk-RRAIFS3D.mjs";import{a as E}from"./chunk-377WQNCB.mjs";import{a as U}from"./chunk-HA5XD5KC.mjs";var d=e=>{let t=b(e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],r=Array.from(t);return{[Symbol.iterator]:()=>r[Symbol.iterator](),get length(){return r.length},map:o=>d(r.map(o)),flatMap:o=>d(r.flatMap(a=>o(a).toArray())),forEach:o=>r.forEach(o),count:o=>r.filter(o).length,exists:o=>r.some(o),filter:o=>d(r.filter(o)),filterNot:o=>d(r.filter(a=>!o(a))),find:o=>A(r.find(o)),get head(){return r[0]},get headOption(){return r.length>0?A(r[0]):y()},get isEmpty(){return r.length===0},get size(){return r.length},toArray:()=>[...r],reduce:o=>r.reduce(o),reduceRight:o=>r.reduceRight(o),foldLeft:o=>a=>r.reduce(a,o),foldRight:o=>a=>r.reduceRight((n,f)=>a(f,n),o),valueOf:()=>({values:r})}},u=e=>d(e);var g=e=>{let t=b(e)?new U(e):new U(e?.toArray()??[]),r=u(t),o={...r,add:a=>g([...t,a]),remove:a=>{let n=new U(t);return n.delete(a),g(n)},contains:a=>t.has(a),has:a=>t.has(a),map:a=>g(r.map(a)),flatMap:a=>g(r.flatMap(a)),toList:()=>T(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},R=e=>g(e);var c=e=>{function t(n){return n!=null&&typeof n[Symbol.iterator]=="function"}let r=Array.isArray(e)?e:t(e)?Array.from(e):[],o=u(r),a={...o,_tag:"List",length:r.length,map:n=>c(r.map(n)),flatMap:n=>c(o.flatMap(n)),remove:n=>{let f=r.indexOf(n);return a.removeAt(f)},contains:n=>r.includes(n),add:n=>c([...r,n]),removeAt:n=>n<0||n>=r.length?a:c([...r.slice(0,n),...r.slice(n+1)]),get:n=>A(r[n]),concat:n=>c([...r,...n.toArray()]),toList:()=>a,toSet:()=>R(r),toString:()=>`List(${r.toString()})`,valueOf:()=>({_tag:"List",values:r})};return new Proxy(a,{get(n,f){return typeof f=="symbol"||isNaN(Number(f))?n[f]:n.get(Number(f))}})},T=e=>c(e),$=e=>c(e);console.assert($);var _=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>p(t(e)),mapAsync:t=>t(e).then(r=>p(r)).catch(r=>s(r)),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>s(r)),toOption:()=>L(e),toList:()=>T([e]),valueOf:()=>({_tag:"Right",value:e}),toString:()=>`Right(${JSON.stringify(e)})`}),O=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>s(e),mapAsync:t=>Promise.resolve(s(e)),flatMap:t=>s(e),flatMapAsync:t=>Promise.resolve(s(e)),toOption:()=>y(),toList:()=>T(),valueOf:()=>({_tag:"Left",value:e}),toString:()=>`Left(${JSON.stringify(e)})`}),p=e=>_(e),s=e=>O(e),B=e=>e.isRight(),V=e=>e.isLeft(),de=(e,t)=>{try{return p(e())}catch(r){return s(t(r))}},J=e=>_(e);console.assert(J);var j=e=>O(e);console.assert(j);var ye=async(e,t)=>{try{let r=await e();return p(r)}catch(r){return s(t(r))}};function S(e){return{value:e,map(t){let r=e.then(o=>{if(B(o))try{let a=t(o.value);return p(a)}catch(a){return s(a)}else return s(o.value)});return S(r)},flatMap(t){let r=e.then(o=>{if(B(o))try{return t(o.value).value}catch(a){return Promise.resolve(s(a))}else return Promise.resolve(s(o.value))});return S(r)},mapLeft(t){let r=e.then(o=>{if(V(o))try{let a=t(o.value);return s(a)}catch(a){return s(a)}else return p(o.value)});return S(r)},fold(t,r){return e.then(o=>B(o)?r(o.value):t(o.value))}}}var m=e=>{let t={values:new E(e)},r=()=>Array.from(t.values.entries()).map(([i,l])=>v([i,l])),o=i=>m(new E(t.values).set(i.toArray()[0],i.toArray()[1]).entries()),a=i=>{let l=new E(t.values);return l.delete(i)?m(l.entries()):m(t.values.entries())},n=i=>t.values.get(i[0])===i[1],f=()=>t.values.size,I=i=>m(Array.from(t.values.entries()).map(([l,C])=>[l,i(C)])),M=i=>{let l=m(t.values.entries()).toList();return m(l.flatMap(i).toArray())},w=i=>u(r()).reduce(i),P=i=>u(r()).reduceRight(i),N=i=>l=>u(r()).foldLeft(i)(l),z=i=>l=>u(r()).foldRight(i)(l),q=i=>A(t.values.get(i)),F=(i,l)=>A(t.values.get(i)).getOrElse(l),k=()=>t.values.size===0;return{add:o,remove:a,contains:n,get size(){return f()},map:I,flatMap:M,reduce:w,reduceRight:P,foldLeft:N,foldRight:z,get:q,getOrElse:F,get isEmpty(){return k()},orElse:(i,l)=>A(t.values.get(i)).orElse(l),toList:()=>T(r()),toSet:()=>R(r()),toString:()=>`Map(${r().toString()})`}},Ve=e=>m(e);var K=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>K(e),orThrow:t=>e,toEither:()=>p(e),map:t=>D(()=>t(e)),flatMap:t=>t(e),valueOf:()=>({_tag:"Success",value:e}),toString:()=>`Success(${JSON.stringify(e)})`}),x=e=>({_tag:"Failure",value:void 0,error:e,isSuccess:()=>!1,isFailure:()=>!0,get:()=>{throw e},getOrElse:t=>t,orElse:t=>t,orThrow:t=>{throw t},toEither:()=>s(e),map:t=>x(e),flatMap:t=>x(e),valueOf:()=>({_tag:"Failure",error:e}),toString:()=>`Failure(${e.message})`}),D=e=>{try{return K(e())}catch(t){return x(t instanceof Error?t:new Error(String(t)))}};var L=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>L(e),map:t=>L(t(e)),filter(t){return t(e)?L(e):h},flatMap:t=>t(e),reduce:t=>t(void 0,e),reduceRight:t=>t(void 0,e),foldLeft:t=>r=>r(t,e),foldRight:t=>r=>r(e,t),toList:()=>T([e]),contains:t=>t===e,size:1,toEither:t=>p(e),toString:()=>`Some(${JSON.stringify(e)})`,valueOf:()=>({_tag:"Some",value:e})}),h={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:e=>h,filter(e){return h},flatMap:e=>h,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>T([]),contains:()=>!1,size:0,toEither:e=>s(e),toString:()=>"None",valueOf:()=>({_tag:"None"})},y=()=>h,A=e=>e!=null?L(e):y();export{L as a,y as b,A as c,d,u as e,R as f,T as g,$ as h,p as i,s as j,B as k,V as l,de as m,J as n,j as o,ye as p,S as q,Ve as r,D as s};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var d=e=>{let t=_chunkBNNK42JCjs.a.call(void 0, e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],r=Array.from(t);return{[Symbol.iterator]:()=>r[Symbol.iterator](),get length(){return r.length},map:o=>d(r.map(o)),flatMap:o=>d(r.flatMap(a=>o(a).toArray())),forEach:o=>r.forEach(o),count:o=>r.filter(o).length,exists:o=>r.some(o),filter:o=>d(r.filter(o)),filterNot:o=>d(r.filter(a=>!o(a))),find:o=>A(r.find(o)),get head(){return r[0]},get headOption(){return r.length>0?A(r[0]):y()},get isEmpty(){return r.length===0},get size(){return r.length},toArray:()=>[...r],reduce:o=>r.reduce(o),reduceRight:o=>r.reduceRight(o),foldLeft:o=>a=>r.reduce(a,o),foldRight:o=>a=>r.reduceRight((n,f)=>a(f,n),o),valueOf:()=>({values:r})}},u= exports.e =e=>d(e);var g=e=>{let t=_chunkBNNK42JCjs.a.call(void 0, e)?new (0, _chunk3VJERXBPjs.a)(e):new (0, _chunk3VJERXBPjs.a)(_nullishCoalesce(_optionalChain([e, 'optionalAccess', _2 => _2.toArray, 'call', _3 => _3()]), () => ([]))),r=u(t),o={...r,add:a=>g([...t,a]),remove:a=>{let n=new (0, _chunk3VJERXBPjs.a)(t);return n.delete(a),g(n)},contains:a=>t.has(a),has:a=>t.has(a),map:a=>g(r.map(a)),flatMap:a=>g(r.flatMap(a)),toList:()=>T(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},R= exports.f =e=>g(e);var c=e=>{function t(n){return n!=null&&typeof n[Symbol.iterator]=="function"}let r=Array.isArray(e)?e:t(e)?Array.from(e):[],o=u(r),a={...o,_tag:"List",length:r.length,map:n=>c(r.map(n)),flatMap:n=>c(o.flatMap(n)),remove:n=>{let f=r.indexOf(n);return a.removeAt(f)},contains:n=>r.includes(n),add:n=>c([...r,n]),removeAt:n=>n<0||n>=r.length?a:c([...r.slice(0,n),...r.slice(n+1)]),get:n=>A(r[n]),concat:n=>c([...r,...n.toArray()]),toList:()=>a,toSet:()=>R(r),toString:()=>`List(${r.toString()})`,valueOf:()=>({_tag:"List",values:r})};return new Proxy(a,{get(n,f){return typeof f=="symbol"||isNaN(Number(f))?n[f]:n.get(Number(f))}})},T= exports.g =e=>c(e),$= exports.h =e=>c(e);console.assert($);var _=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>p(t(e)),mapAsync:t=>t(e).then(r=>p(r)).catch(r=>s(r)),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>s(r)),toOption:()=>L(e),toList:()=>T([e]),valueOf:()=>({_tag:"Right",value:e}),toString:()=>`Right(${JSON.stringify(e)})`}),O=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>s(e),mapAsync:t=>Promise.resolve(s(e)),flatMap:t=>s(e),flatMapAsync:t=>Promise.resolve(s(e)),toOption:()=>y(),toList:()=>T(),valueOf:()=>({_tag:"Left",value:e}),toString:()=>`Left(${JSON.stringify(e)})`}),p= exports.i =e=>_(e),s= exports.j =e=>O(e),B= exports.k =e=>e.isRight(),V= exports.l =e=>e.isLeft(),de= exports.m =(e,t)=>{try{return p(e())}catch(r){return s(t(r))}},J= exports.n =e=>_(e);console.assert(J);var j=e=>O(e);console.assert(j);var ye=async(e,t)=>{try{let r=await e();return p(r)}catch(r){return s(t(r))}};function S(e){return{value:e,map(t){let r=e.then(o=>{if(B(o))try{let a=t(o.value);return p(a)}catch(a){return s(a)}else return s(o.value)});return S(r)},flatMap(t){let r=e.then(o=>{if(B(o))try{return t(o.value).value}catch(a){return Promise.resolve(s(a))}else return Promise.resolve(s(o.value))});return S(r)},mapLeft(t){let r=e.then(o=>{if(V(o))try{let a=t(o.value);return s(a)}catch(a){return s(a)}else return p(o.value)});return S(r)},fold(t,r){return e.then(o=>B(o)?r(o.value):t(o.value))}}}var m=e=>{let t={values:new (0, _chunk5VTXJIR3js.a)(e)},r=()=>Array.from(t.values.entries()).map(([i,l])=>_chunkOXLZ6UIZjs.a.call(void 0, [i,l])),o=i=>m(new (0, _chunk5VTXJIR3js.a)(t.values).set(i.toArray()[0],i.toArray()[1]).entries()),a=i=>{let l=new (0, _chunk5VTXJIR3js.a)(t.values);return l.delete(i)?m(l.entries()):m(t.values.entries())},n=i=>t.values.get(i[0])===i[1],f=()=>t.values.size,I=i=>m(Array.from(t.values.entries()).map(([l,C])=>[l,i(C)])),M=i=>{let l=m(t.values.entries()).toList();return m(l.flatMap(i).toArray())},w=i=>u(r()).reduce(i),P=i=>u(r()).reduceRight(i),N=i=>l=>u(r()).foldLeft(i)(l),z=i=>l=>u(r()).foldRight(i)(l),q=i=>A(t.values.get(i)),F=(i,l)=>A(t.values.get(i)).getOrElse(l),k=()=>t.values.size===0;return{add:o,remove:a,contains:n,get size(){return f()},map:I,flatMap:M,reduce:w,reduceRight:P,foldLeft:N,foldRight:z,get:q,getOrElse:F,get isEmpty(){return k()},orElse:(i,l)=>A(t.values.get(i)).orElse(l),toList:()=>T(r()),toSet:()=>R(r()),toString:()=>`Map(${r().toString()})`}},Ve= exports.r =e=>m(e);var K=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>K(e),orThrow:t=>e,toEither:()=>p(e),map:t=>D(()=>t(e)),flatMap:t=>t(e),valueOf:()=>({_tag:"Success",value:e}),toString:()=>`Success(${JSON.stringify(e)})`}),x=e=>({_tag:"Failure",value:void 0,error:e,isSuccess:()=>!1,isFailure:()=>!0,get:()=>{throw e},getOrElse:t=>t,orElse:t=>t,orThrow:t=>{throw t},toEither:()=>s(e),map:t=>x(e),flatMap:t=>x(e),valueOf:()=>({_tag:"Failure",error:e}),toString:()=>`Failure(${e.message})`}),D= exports.s =e=>{try{return K(e())}catch(t){return x(t instanceof Error?t:new Error(String(t)))}};var L=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>L(e),map:t=>L(t(e)),filter(t){return t(e)?L(e):h},flatMap:t=>t(e),reduce:t=>t(void 0,e),reduceRight:t=>t(void 0,e),foldLeft:t=>r=>r(t,e),foldRight:t=>r=>r(e,t),toList:()=>T([e]),contains:t=>t===e,size:1,toEither:t=>p(e),toString:()=>`Some(${JSON.stringify(e)})`,valueOf:()=>({_tag:"Some",value:e})}),h={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:e=>h,filter(e){return h},flatMap:e=>h,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>T([]),contains:()=>!1,size:0,toEither:e=>s(e),toString:()=>"None",valueOf:()=>({_tag:"None"})},y= exports.b =()=>h,A= exports.c =e=>e!=null?L(e):y();exports.a = L; exports.b = y; exports.c = A; exports.d = d; exports.e = u; exports.f = R; exports.g = T; exports.h = $; exports.i = p; exports.j = s; exports.k = B; exports.l = V; exports.m = de; exports.n = J; exports.o = j; exports.p = ye; exports.q = S; exports.r = Ve; exports.s = D;
@@ -1,4 +1,4 @@
1
- export { d as Collection, C as Converters } from '../index-DxbBrdj_.mjs';
1
+ export { d as Collection, C as Converters } from '../index-B3DiwP0P.mjs';
2
2
  import '../functor/index.mjs';
3
3
  import '../identity/Identity.mjs';
4
4
  import '../tuple/Tuple.mjs';
@@ -1,4 +1,4 @@
1
- export { d as Collection, C as Converters } from '../index-DEY28JXj.js';
1
+ export { d as Collection, C as Converters } from '../index-COhyPyGF.js';
2
2
  import '../functor/index.js';
3
3
  import '../identity/Identity.js';
4
4
  import '../tuple/Tuple.js';
@@ -1,5 +1,5 @@
1
1
  import '../functor/index.mjs';
2
- export { E as Either, e as Left, R as Right, i as isLeft, f as isRight, t as tryCatch, g as tryCatchAsync } from '../index-DxbBrdj_.mjs';
2
+ export { E as Either, f as Left, R as Right, e as TestEither, j as TypeCheckLeft, h as TypeCheckRight, g as isLeft, i as isRight, t as tryCatch, k as tryCatchAsync } from '../index-B3DiwP0P.mjs';
3
3
  import '../typeable/Typeable.mjs';
4
4
  import '../identity/Identity.mjs';
5
5
  import '../tuple/Tuple.mjs';
@@ -1,5 +1,5 @@
1
1
  import '../functor/index.js';
2
- export { E as Either, e as Left, R as Right, i as isLeft, f as isRight, t as tryCatch, g as tryCatchAsync } from '../index-DEY28JXj.js';
2
+ export { E as Either, f as Left, R as Right, e as TestEither, j as TypeCheckLeft, h as TypeCheckRight, g as isLeft, i as isRight, t as tryCatch, k as tryCatchAsync } from '../index-COhyPyGF.js';
3
3
  import '../typeable/Typeable.js';
4
4
  import '../identity/Identity.js';
5
5
  import '../tuple/Tuple.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.Left = _chunkZT6U462Cjs.d; exports.Right = _chunkZT6U462Cjs.e; exports.isLeft = _chunkZT6U462Cjs.f; exports.isRight = _chunkZT6U462Cjs.g; exports.tryCatch = _chunkZT6U462Cjs.h; exports.tryCatchAsync = _chunkZT6U462Cjs.i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Left = _chunkXF5WD6R4js.j; exports.Right = _chunkXF5WD6R4js.i; exports.TypeCheckLeft = _chunkXF5WD6R4js.o; exports.TypeCheckRight = _chunkXF5WD6R4js.n; exports.isLeft = _chunkXF5WD6R4js.l; exports.isRight = _chunkXF5WD6R4js.k; exports.tryCatch = _chunkXF5WD6R4js.m; exports.tryCatchAsync = _chunkXF5WD6R4js.p;
@@ -1 +1 @@
1
- import{d as a,e as b,f as c,g as d,h as e,i as f}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{a as Left,b as Right,c as isLeft,d as isRight,e as tryCatch,f as tryCatchAsync};
1
+ import{i as a,j as b,k as c,l as d,m as e,n as f,o as g,p as h}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{b as Left,a as Right,g as TypeCheckLeft,f as TypeCheckRight,d as isLeft,c as isRight,e as tryCatch,h as tryCatchAsync};
@@ -1,4 +1,4 @@
1
- export { h as EitherT } from '../index-DxbBrdj_.mjs';
1
+ export { l as EitherT } from '../index-B3DiwP0P.mjs';
2
2
  import '../functor/index.mjs';
3
3
  import '../identity/Identity.mjs';
4
4
  import '../tuple/Tuple.mjs';
@@ -1,4 +1,4 @@
1
- export { h as EitherT } from '../index-DEY28JXj.js';
1
+ export { l as EitherT } from '../index-COhyPyGF.js';
2
2
  import '../functor/index.js';
3
3
  import '../identity/Identity.js';
4
4
  import '../tuple/Tuple.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.EitherT = _chunkZT6U462Cjs.j;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.EitherT = _chunkXF5WD6R4js.q;
@@ -1 +1 @@
1
- import{j as a}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{a as EitherT};
1
+ import{q as a}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as EitherT};
@@ -98,7 +98,8 @@ type Converters<A> = {
98
98
  };
99
99
  type Collection<A> = Converters<A>;
100
100
 
101
- type List<A> = ({
101
+ type InternalList<A> = List<A> & ArrayLike<A> & _Iterable_<A> & Collection<A>;
102
+ type List<A> = {
102
103
  add: (item: A) => List<A>;
103
104
  map: <B>(f: (a: A) => B) => List<B>;
104
105
  flatMap: <B>(f: (a: A) => _Iterable_<B>) => List<B>;
@@ -114,54 +115,42 @@ type List<A> = ({
114
115
  _tag: string;
115
116
  values: A[];
116
117
  };
117
- } & ArrayLike<A>) & (_Iterable_<A> & Collection<A> & Typeable<"List">);
118
+ } & Typeable<"List"> & Seq<A>;
118
119
  declare const List: <A>(values?: Iterable<A> | _Iterable_<A>) => List<A>;
120
+ declare const TestList: <A>(values?: Iterable<A> | _Iterable_<A>) => InternalList<A>;
119
121
 
120
- type Either<L, R> = Left<L, R> | Right<L, R>;
121
- type Left<L, R> = {
122
- readonly _tag: "Left";
123
- readonly value: L;
124
- isLeft: () => true;
125
- isRight: () => false;
122
+ type Either<L extends Type, R extends Type> = {
123
+ readonly _tag: "Left" | "Right";
124
+ value: L | R;
125
+ isLeft: () => boolean;
126
+ isRight: () => boolean;
126
127
  getOrElse: (defaultValue: R) => R;
127
128
  getOrThrow: () => R;
128
- map: <U>(f: (value: R) => U) => Left<L, U>;
129
- mapAsync: <U>(f: (value: R) => Promise<U>) => Promise<Left<L, U>>;
130
- flatMap: <L1, U>(f: (value: R) => Either<L1, U>) => Left<L | L1, U>;
131
- flatMapAsync: <L1, U>(f: (value: R) => Promise<Either<L1, U>>) => Promise<Left<L | L1, U>>;
129
+ map: <U extends Type>(f: (value: R) => U) => Either<L, U>;
130
+ mapAsync: <U extends Type>(f: (value: R) => Promise<U>) => Promise<Either<L, U>>;
131
+ flatMap: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U>;
132
+ flatMapAsync: <U extends Type>(f: (value: R) => Promise<Either<L, U>>) => Promise<Either<L, U>>;
132
133
  toOption: () => Option<R>;
133
134
  toList: () => List<R>;
134
135
  valueOf: () => {
135
- _tag: "Left";
136
- value: L;
136
+ _tag: "Left" | "Right";
137
+ value: L | R;
137
138
  };
138
139
  toString: () => string;
139
- } & Typeable<"Left">;
140
- declare const Left: <L, R>(value: L) => Left<L, R>;
141
- type Right<L, R> = {
142
- readonly _tag: "Right";
143
- readonly value: R;
144
- isLeft: () => false;
145
- isRight: () => true;
146
- getOrElse: (defaultValue: R) => R;
147
- getOrThrow: () => R;
148
- map: <U>(f: (value: R) => U) => Right<L, U>;
149
- mapAsync: <U>(f: (value: R) => Promise<U>) => Promise<Right<L, U>>;
150
- flatMap: <L1, U>(f: (value: R) => Either<L1, U>) => Either<L | L1, U>;
151
- flatMapAsync: <L1, U>(f: (value: R) => Promise<Either<L1, U>>) => Promise<Either<L | L1, U>>;
152
- toOption: () => Option<R>;
153
- toList: () => List<R>;
154
- valueOf: () => {
155
- _tag: "Right";
156
- value: R;
157
- };
158
- toString: () => string;
159
- } & Functor<R> & Typeable<"Right">;
160
- declare const Right: <L, R>(value: R) => Right<L, R>;
161
- declare const isLeft: <L, R>(either: Either<L, R>) => either is Left<L, R>;
162
- declare const isRight: <L, R>(either: Either<L, R>) => either is Right<L, R>;
163
- declare const tryCatch: <L, R>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
164
- declare const tryCatchAsync: <L, R>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
140
+ } & Typeable<"Left" | "Right">;
141
+ type TestEither<L extends Type, R extends Type> = Either<L, R> & Functor<R>;
142
+ declare const Right: <L extends Type, R extends Type>(value: R) => Either<L, R>;
143
+ declare const Left: <L extends Type, R extends Type>(value: L) => Either<L, R>;
144
+ declare const isRight: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
145
+ value: R;
146
+ };
147
+ declare const isLeft: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
148
+ value: L;
149
+ };
150
+ declare const tryCatch: <L extends Type, R extends Type>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
151
+ declare const TypeCheckRight: <L extends Type, R extends Type>(value: R) => TestEither<L, R>;
152
+ declare const TypeCheckLeft: <L extends Type, R extends Type>(value: L) => TestEither<L, R>;
153
+ declare const tryCatchAsync: <L extends Type, R extends Type>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
165
154
 
166
155
  type EitherT<L, R> = {
167
156
  value: Promise<Either<L, R>>;
@@ -216,4 +205,4 @@ type Traversable<A extends Type> = Functor<A> & {
216
205
  foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
217
206
  };
218
207
 
219
- export { type Converters as C, type Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S, Try as T, type _Iterable_ as _, Seq as a, Set as b, createSeq as c, type Collection as d, Left as e, isRight as f, tryCatchAsync as g, EitherT as h, isLeft as i, type Traversable as j, tryCatch as t };
208
+ export { type Converters as C, type Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S, TestList as T, type _Iterable_ as _, Seq as a, Set as b, createSeq as c, type Collection as d, type TestEither as e, Left as f, isLeft as g, TypeCheckRight as h, isRight as i, TypeCheckLeft as j, tryCatchAsync as k, EitherT as l, Try as m, type Traversable as n, tryCatch as t };
@@ -98,7 +98,8 @@ type Converters<A> = {
98
98
  };
99
99
  type Collection<A> = Converters<A>;
100
100
 
101
- type List<A> = ({
101
+ type InternalList<A> = List<A> & ArrayLike<A> & _Iterable_<A> & Collection<A>;
102
+ type List<A> = {
102
103
  add: (item: A) => List<A>;
103
104
  map: <B>(f: (a: A) => B) => List<B>;
104
105
  flatMap: <B>(f: (a: A) => _Iterable_<B>) => List<B>;
@@ -114,54 +115,42 @@ type List<A> = ({
114
115
  _tag: string;
115
116
  values: A[];
116
117
  };
117
- } & ArrayLike<A>) & (_Iterable_<A> & Collection<A> & Typeable<"List">);
118
+ } & Typeable<"List"> & Seq<A>;
118
119
  declare const List: <A>(values?: Iterable<A> | _Iterable_<A>) => List<A>;
120
+ declare const TestList: <A>(values?: Iterable<A> | _Iterable_<A>) => InternalList<A>;
119
121
 
120
- type Either<L, R> = Left<L, R> | Right<L, R>;
121
- type Left<L, R> = {
122
- readonly _tag: "Left";
123
- readonly value: L;
124
- isLeft: () => true;
125
- isRight: () => false;
122
+ type Either<L extends Type, R extends Type> = {
123
+ readonly _tag: "Left" | "Right";
124
+ value: L | R;
125
+ isLeft: () => boolean;
126
+ isRight: () => boolean;
126
127
  getOrElse: (defaultValue: R) => R;
127
128
  getOrThrow: () => R;
128
- map: <U>(f: (value: R) => U) => Left<L, U>;
129
- mapAsync: <U>(f: (value: R) => Promise<U>) => Promise<Left<L, U>>;
130
- flatMap: <L1, U>(f: (value: R) => Either<L1, U>) => Left<L | L1, U>;
131
- flatMapAsync: <L1, U>(f: (value: R) => Promise<Either<L1, U>>) => Promise<Left<L | L1, U>>;
129
+ map: <U extends Type>(f: (value: R) => U) => Either<L, U>;
130
+ mapAsync: <U extends Type>(f: (value: R) => Promise<U>) => Promise<Either<L, U>>;
131
+ flatMap: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U>;
132
+ flatMapAsync: <U extends Type>(f: (value: R) => Promise<Either<L, U>>) => Promise<Either<L, U>>;
132
133
  toOption: () => Option<R>;
133
134
  toList: () => List<R>;
134
135
  valueOf: () => {
135
- _tag: "Left";
136
- value: L;
136
+ _tag: "Left" | "Right";
137
+ value: L | R;
137
138
  };
138
139
  toString: () => string;
139
- } & Typeable<"Left">;
140
- declare const Left: <L, R>(value: L) => Left<L, R>;
141
- type Right<L, R> = {
142
- readonly _tag: "Right";
143
- readonly value: R;
144
- isLeft: () => false;
145
- isRight: () => true;
146
- getOrElse: (defaultValue: R) => R;
147
- getOrThrow: () => R;
148
- map: <U>(f: (value: R) => U) => Right<L, U>;
149
- mapAsync: <U>(f: (value: R) => Promise<U>) => Promise<Right<L, U>>;
150
- flatMap: <L1, U>(f: (value: R) => Either<L1, U>) => Either<L | L1, U>;
151
- flatMapAsync: <L1, U>(f: (value: R) => Promise<Either<L1, U>>) => Promise<Either<L | L1, U>>;
152
- toOption: () => Option<R>;
153
- toList: () => List<R>;
154
- valueOf: () => {
155
- _tag: "Right";
156
- value: R;
157
- };
158
- toString: () => string;
159
- } & Functor<R> & Typeable<"Right">;
160
- declare const Right: <L, R>(value: R) => Right<L, R>;
161
- declare const isLeft: <L, R>(either: Either<L, R>) => either is Left<L, R>;
162
- declare const isRight: <L, R>(either: Either<L, R>) => either is Right<L, R>;
163
- declare const tryCatch: <L, R>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
164
- declare const tryCatchAsync: <L, R>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
140
+ } & Typeable<"Left" | "Right">;
141
+ type TestEither<L extends Type, R extends Type> = Either<L, R> & Functor<R>;
142
+ declare const Right: <L extends Type, R extends Type>(value: R) => Either<L, R>;
143
+ declare const Left: <L extends Type, R extends Type>(value: L) => Either<L, R>;
144
+ declare const isRight: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
145
+ value: R;
146
+ };
147
+ declare const isLeft: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
148
+ value: L;
149
+ };
150
+ declare const tryCatch: <L extends Type, R extends Type>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
151
+ declare const TypeCheckRight: <L extends Type, R extends Type>(value: R) => TestEither<L, R>;
152
+ declare const TypeCheckLeft: <L extends Type, R extends Type>(value: L) => TestEither<L, R>;
153
+ declare const tryCatchAsync: <L extends Type, R extends Type>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
165
154
 
166
155
  type EitherT<L, R> = {
167
156
  value: Promise<Either<L, R>>;
@@ -216,4 +205,4 @@ type Traversable<A extends Type> = Functor<A> & {
216
205
  foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
217
206
  };
218
207
 
219
- export { type Converters as C, type Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S, Try as T, type _Iterable_ as _, Seq as a, Set as b, createSeq as c, type Collection as d, Left as e, isRight as f, tryCatchAsync as g, EitherT as h, isLeft as i, type Traversable as j, tryCatch as t };
208
+ export { type Converters as C, type Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S, TestList as T, type _Iterable_ as _, Seq as a, Set as b, createSeq as c, type Collection as d, type TestEither as e, Left as f, isLeft as g, TypeCheckRight as h, isRight as i, TypeCheckLeft as j, tryCatchAsync as k, EitherT as l, Try as m, type Traversable as n, tryCatch as t };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type } from './functor/index.mjs';
2
- export { E as Either, h as EitherT, e as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, b as Set, S as Some, j as Traversable, T as Try, _ as _Iterable_, i as isLeft, f as isRight, t as tryCatch, g as tryCatchAsync } from './index-DxbBrdj_.mjs';
2
+ export { E as Either, l as EitherT, f as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, b as Set, S as Some, e as TestEither, T as TestList, n as Traversable, m as Try, j as TypeCheckLeft, h as TypeCheckRight, _ as _Iterable_, g as isLeft, i as isRight, t as tryCatch, k as tryCatchAsync } from './index-B3DiwP0P.mjs';
3
3
  export { Identity } from './identity/Identity.mjs';
4
4
  export { Tuple } from './tuple/Tuple.mjs';
5
5
  export { Typeable } from './typeable/Typeable.mjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type } from './functor/index.js';
2
- export { E as Either, h as EitherT, e as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, b as Set, S as Some, j as Traversable, T as Try, _ as _Iterable_, i as isLeft, f as isRight, t as tryCatch, g as tryCatchAsync } from './index-DEY28JXj.js';
2
+ export { E as Either, l as EitherT, f as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, b as Set, S as Some, e as TestEither, T as TestList, n as Traversable, m as Try, j as TypeCheckLeft, h as TypeCheckRight, _ as _Iterable_, g as isLeft, i as isRight, t as tryCatch, k as tryCatchAsync } from './index-COhyPyGF.js';
3
3
  export { Identity } from './identity/Identity.js';
4
4
  export { Tuple } from './tuple/Tuple.js';
5
5
  export { Typeable } from './typeable/Typeable.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('./chunk-ZT6U462C.js');var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');require('./chunk-BNNK42JC.js');var _chunk5O6YELD3js = require('./chunk-5O6YELD3.js');require('./chunk-K3EKBPQE.js');require('./chunk-5VTXJIR3.js');require('./chunk-3VJERXBP.js');require('./chunk-XORABVON.js');exports.EitherT = _chunkZT6U462Cjs.j; exports.Left = _chunkZT6U462Cjs.d; exports.List = _chunkZT6U462Cjs.n; exports.Map = _chunkZT6U462Cjs.o; exports.None = _chunkZT6U462Cjs.b; exports.Option = _chunkZT6U462Cjs.c; exports.Right = _chunkZT6U462Cjs.e; exports.Seq = _chunkZT6U462Cjs.l; exports.Set = _chunkZT6U462Cjs.m; exports.Some = _chunkZT6U462Cjs.a; exports.Try = _chunkZT6U462Cjs.p; exports.Tuple = _chunkOXLZ6UIZjs.a; exports.Typeable = _chunk5O6YELD3js.a; exports.isLeft = _chunkZT6U462Cjs.f; exports.isRight = _chunkZT6U462Cjs.g; exports.tryCatch = _chunkZT6U462Cjs.h; exports.tryCatchAsync = _chunkZT6U462Cjs.i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('./chunk-XF5WD6R4.js');var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');var _chunk5O6YELD3js = require('./chunk-5O6YELD3.js');require('./chunk-BNNK42JC.js');require('./chunk-5VTXJIR3.js');require('./chunk-3VJERXBP.js');require('./chunk-XORABVON.js');require('./chunk-K3EKBPQE.js');exports.EitherT = _chunkXF5WD6R4js.q; exports.Left = _chunkXF5WD6R4js.j; exports.List = _chunkXF5WD6R4js.g; exports.Map = _chunkXF5WD6R4js.r; exports.None = _chunkXF5WD6R4js.b; exports.Option = _chunkXF5WD6R4js.c; exports.Right = _chunkXF5WD6R4js.i; exports.Seq = _chunkXF5WD6R4js.e; exports.Set = _chunkXF5WD6R4js.f; exports.Some = _chunkXF5WD6R4js.a; exports.TestList = _chunkXF5WD6R4js.h; exports.Try = _chunkXF5WD6R4js.s; exports.Tuple = _chunkOXLZ6UIZjs.a; exports.TypeCheckLeft = _chunkXF5WD6R4js.o; exports.TypeCheckRight = _chunkXF5WD6R4js.n; exports.Typeable = _chunk5O6YELD3js.a; exports.isLeft = _chunkXF5WD6R4js.l; exports.isRight = _chunkXF5WD6R4js.k; exports.tryCatch = _chunkXF5WD6R4js.m; exports.tryCatchAsync = _chunkXF5WD6R4js.p;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,l as k,m as l,n as m,o,p}from"./chunk-MGOOHJA4.mjs";import{a as n}from"./chunk-2I2NKDFN.mjs";import"./chunk-RRAIFS3D.mjs";import{a as q}from"./chunk-V7DKESTM.mjs";import"./chunk-2ML63TYF.mjs";import"./chunk-377WQNCB.mjs";import"./chunk-HA5XD5KC.mjs";import"./chunk-V2J3R5IU.mjs";export{j as EitherT,d as Left,m as List,o as Map,b as None,c as Option,e as Right,k as Seq,l as Set,a as Some,p as Try,n as Tuple,q as Typeable,f as isLeft,g as isRight,h as tryCatch,i as tryCatchAsync};
1
+ import{a,b,c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r,s}from"./chunk-R5GXK4Y7.mjs";import{a as q}from"./chunk-2I2NKDFN.mjs";import{a as t}from"./chunk-V7DKESTM.mjs";import"./chunk-RRAIFS3D.mjs";import"./chunk-377WQNCB.mjs";import"./chunk-HA5XD5KC.mjs";import"./chunk-V2J3R5IU.mjs";import"./chunk-2ML63TYF.mjs";export{p as EitherT,i as Left,f as List,r as Map,b as None,c as Option,h as Right,d as Seq,e as Set,a as Some,g as TestList,s as Try,q as Tuple,n as TypeCheckLeft,m as TypeCheckRight,t as Typeable,k as isLeft,j as isRight,l as tryCatch,o as tryCatchAsync};
@@ -1,4 +1,4 @@
1
- export { a as Seq, c as createSeq } from '../index-DxbBrdj_.mjs';
1
+ export { a as Seq, c as createSeq } from '../index-B3DiwP0P.mjs';
2
2
  import '../functor/index.mjs';
3
3
  import '../identity/Identity.mjs';
4
4
  import '../tuple/Tuple.mjs';
@@ -1,4 +1,4 @@
1
- export { a as Seq, c as createSeq } from '../index-DEY28JXj.js';
1
+ export { a as Seq, c as createSeq } from '../index-COhyPyGF.js';
2
2
  import '../functor/index.js';
3
3
  import '../identity/Identity.js';
4
4
  import '../tuple/Tuple.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.Seq = _chunkZT6U462Cjs.l; exports.createSeq = _chunkZT6U462Cjs.k;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Seq = _chunkXF5WD6R4js.e; exports.createSeq = _chunkXF5WD6R4js.d;
@@ -1 +1 @@
1
- import{k as a,l as b}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{b as Seq,a as createSeq};
1
+ import{d as a,e as b}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{b as Seq,a as createSeq};
@@ -1,5 +1,5 @@
1
1
  import '../functor/index.mjs';
2
- export { a as Seq, _ as _Iterable_ } from '../index-DxbBrdj_.mjs';
2
+ export { a as Seq, _ as _Iterable_ } from '../index-B3DiwP0P.mjs';
3
3
  import '../identity/Identity.mjs';
4
4
  import '../tuple/Tuple.mjs';
5
5
  import '../typeable/Typeable.mjs';
@@ -1,5 +1,5 @@
1
1
  import '../functor/index.js';
2
- export { a as Seq, _ as _Iterable_ } from '../index-DEY28JXj.js';
2
+ export { a as Seq, _ as _Iterable_ } from '../index-COhyPyGF.js';
3
3
  import '../identity/Identity.js';
4
4
  import '../tuple/Tuple.js';
5
5
  import '../typeable/Typeable.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.Seq = _chunkZT6U462Cjs.l;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Seq = _chunkXF5WD6R4js.e;
@@ -1 +1 @@
1
- import{l as a}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{a as Seq};
1
+ import{e as a}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as Seq};
@@ -1,4 +1,4 @@
1
- export { L as List } from '../index-DxbBrdj_.mjs';
1
+ export { L as List, T as TestList } from '../index-B3DiwP0P.mjs';
2
2
  import '../typeable/Typeable.mjs';
3
3
  import '../functor/index.mjs';
4
4
  import '../identity/Identity.mjs';
@@ -1,4 +1,4 @@
1
- export { L as List } from '../index-DEY28JXj.js';
1
+ export { L as List, T as TestList } from '../index-COhyPyGF.js';
2
2
  import '../typeable/Typeable.js';
3
3
  import '../functor/index.js';
4
4
  import '../identity/Identity.js';
package/dist/list/List.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.List = _chunkZT6U462Cjs.n;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.List = _chunkXF5WD6R4js.g; exports.TestList = _chunkXF5WD6R4js.h;
@@ -1 +1 @@
1
- import{n as a}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{a as List};
1
+ import{g as a,h as b}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as List,b as TestList};
@@ -1,4 +1,4 @@
1
- export { M as Map } from '../index-DxbBrdj_.mjs';
1
+ export { M as Map } from '../index-B3DiwP0P.mjs';
2
2
  import '../tuple/Tuple.mjs';
3
3
  import '../functor/index.mjs';
4
4
  import '../identity/Identity.mjs';
package/dist/map/Map.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { M as Map } from '../index-DEY28JXj.js';
1
+ export { M as Map } from '../index-COhyPyGF.js';
2
2
  import '../tuple/Tuple.js';
3
3
  import '../functor/index.js';
4
4
  import '../identity/Identity.js';
package/dist/map/Map.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.Map = _chunkZT6U462Cjs.o;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Map = _chunkXF5WD6R4js.r;
package/dist/map/Map.mjs CHANGED
@@ -1 +1 @@
1
- import{o as a}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{a as Map};
1
+ import{r as a}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as Map};
@@ -1,5 +1,5 @@
1
1
  import '../functor/index.mjs';
2
- export { N as None, O as Option, S as Some } from '../index-DxbBrdj_.mjs';
2
+ export { N as None, O as Option, S as Some } from '../index-B3DiwP0P.mjs';
3
3
  import '../typeable/Typeable.mjs';
4
4
  import '../identity/Identity.mjs';
5
5
  import '../tuple/Tuple.mjs';
@@ -1,5 +1,5 @@
1
1
  import '../functor/index.js';
2
- export { N as None, O as Option, S as Some } from '../index-DEY28JXj.js';
2
+ export { N as None, O as Option, S as Some } from '../index-COhyPyGF.js';
3
3
  import '../typeable/Typeable.js';
4
4
  import '../identity/Identity.js';
5
5
  import '../tuple/Tuple.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.None = _chunkZT6U462Cjs.b; exports.Option = _chunkZT6U462Cjs.c; exports.Some = _chunkZT6U462Cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.None = _chunkXF5WD6R4js.b; exports.Option = _chunkXF5WD6R4js.c; exports.Some = _chunkXF5WD6R4js.a;
@@ -1 +1 @@
1
- import{a,b,c}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{b as None,c as Option,a as Some};
1
+ import{a,b,c}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{b as None,c as Option,a as Some};
@@ -1,4 +1,4 @@
1
- export { b as Set } from '../index-DxbBrdj_.mjs';
1
+ export { b as Set } from '../index-B3DiwP0P.mjs';
2
2
  import '../functor/index.mjs';
3
3
  import '../identity/Identity.mjs';
4
4
  import '../tuple/Tuple.mjs';
package/dist/set/Set.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { b as Set } from '../index-DEY28JXj.js';
1
+ export { b as Set } from '../index-COhyPyGF.js';
2
2
  import '../functor/index.js';
3
3
  import '../identity/Identity.js';
4
4
  import '../tuple/Tuple.js';
package/dist/set/Set.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.Set = _chunkZT6U462Cjs.m;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Set = _chunkXF5WD6R4js.f;
package/dist/set/Set.mjs CHANGED
@@ -1 +1 @@
1
- import{m as a}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{a as Set};
1
+ import{f as a}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as Set};
@@ -1,4 +1,4 @@
1
- export { T as Try } from '../index-DxbBrdj_.mjs';
1
+ export { m as Try } from '../index-B3DiwP0P.mjs';
2
2
  import '../typeable/Typeable.mjs';
3
3
  import '../functor/index.mjs';
4
4
  import '../identity/Identity.mjs';
package/dist/try/Try.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { T as Try } from '../index-DEY28JXj.js';
1
+ export { m as Try } from '../index-COhyPyGF.js';
2
2
  import '../typeable/Typeable.js';
3
3
  import '../functor/index.js';
4
4
  import '../identity/Identity.js';
package/dist/try/Try.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');exports.Try = _chunkZT6U462Cjs.p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Try = _chunkXF5WD6R4js.s;
package/dist/try/Try.mjs CHANGED
@@ -1 +1 @@
1
- import{p as a}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";export{a as Try};
1
+ import{s as a}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as Try};
@@ -1,4 +1,4 @@
1
- import { E as Either } from '../index-DxbBrdj_.mjs';
1
+ import { E as Either } from '../index-B3DiwP0P.mjs';
2
2
  import { ParseError } from '../error/ParseError.mjs';
3
3
  import '../functor/index.mjs';
4
4
  import '../identity/Identity.mjs';
@@ -1,4 +1,4 @@
1
- import { E as Either } from '../index-DEY28JXj.js';
1
+ import { E as Either } from '../index-COhyPyGF.js';
2
2
  import { ParseError } from '../error/ParseError.js';
3
3
  import '../functor/index.js';
4
4
  import '../identity/Identity.js';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE6RS47F7js = require('../chunk-E6RS47F7.js');var _chunkZT6U462Cjs = require('../chunk-ZT6U462C.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-5O6YELD3.js');require('../chunk-K3EKBPQE.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');var a=o=>{let r=parseInt(o,10);return isNaN(r)?_chunkZT6U462Cjs.d.call(void 0, _chunkE6RS47F7js.a.call(void 0, `${r}`)):_chunkZT6U462Cjs.e.call(void 0, r)};exports.parseNumber = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE6RS47F7js = require('../chunk-E6RS47F7.js');var _chunkXF5WD6R4js = require('../chunk-XF5WD6R4.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-5O6YELD3.js');require('../chunk-BNNK42JC.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');var a=o=>{let r=parseInt(o,10);return isNaN(r)?_chunkXF5WD6R4js.j.call(void 0, _chunkE6RS47F7js.a.call(void 0, `${r}`)):_chunkXF5WD6R4js.i.call(void 0, r)};exports.parseNumber = a;
@@ -1 +1 @@
1
- import{a as s}from"../chunk-VK5GL6NM.mjs";import{d as e,e as t}from"../chunk-MGOOHJA4.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";var a=o=>{let r=parseInt(o,10);return isNaN(r)?e(s(`${r}`)):t(r)};export{a as parseNumber};
1
+ import{a as s}from"../chunk-VK5GL6NM.mjs";import{i as e,j as t}from"../chunk-R5GXK4Y7.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";var a=o=>{let r=parseInt(o,10);return isNaN(r)?t(s(`${r}`)):e(r)};export{a as parseNumber};
@@ -1,49 +1,36 @@
1
- import { Functor } from "../functor";
1
+ import { Functor, Type } from "../functor";
2
2
  import { List } from "../list/List";
3
3
  import { Option } from "../option/Option";
4
4
  import { Typeable } from "../typeable/Typeable";
5
- export type Left<L, R> = {
6
- readonly _tag: "Left";
7
- readonly value: L;
8
- isLeft: () => true;
9
- isRight: () => false;
5
+ export type Either<L extends Type, R extends Type> = {
6
+ readonly _tag: "Left" | "Right";
7
+ value: L | R;
8
+ isLeft: () => boolean;
9
+ isRight: () => boolean;
10
10
  getOrElse: (defaultValue: R) => R;
11
11
  getOrThrow: () => R;
12
- map: <U>(f: (value: R) => U) => Left<L, U>;
13
- mapAsync: <U>(f: (value: R) => Promise<U>) => Promise<Left<L, U>>;
14
- flatMap: <L1, U>(f: (value: R) => Either<L1, U>) => Left<L | L1, U>;
15
- flatMapAsync: <L1, U>(f: (value: R) => Promise<Either<L1, U>>) => Promise<Left<L | L1, U>>;
12
+ map: <U extends Type>(f: (value: R) => U) => Either<L, U>;
13
+ mapAsync: <U extends Type>(f: (value: R) => Promise<U>) => Promise<Either<L, U>>;
14
+ flatMap: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U>;
15
+ flatMapAsync: <U extends Type>(f: (value: R) => Promise<Either<L, U>>) => Promise<Either<L, U>>;
16
16
  toOption: () => Option<R>;
17
17
  toList: () => List<R>;
18
18
  valueOf: () => {
19
- _tag: "Left";
20
- value: L;
19
+ _tag: "Left" | "Right";
20
+ value: L | R;
21
21
  };
22
22
  toString: () => string;
23
- } & Typeable<"Left">;
24
- export type Right<L, R> = {
25
- readonly _tag: "Right";
26
- readonly value: R;
27
- isLeft: () => false;
28
- isRight: () => true;
29
- getOrElse: (defaultValue: R) => R;
30
- getOrThrow: () => R;
31
- map: <U>(f: (value: R) => U) => Right<L, U>;
32
- mapAsync: <U>(f: (value: R) => Promise<U>) => Promise<Right<L, U>>;
33
- flatMap: <L1, U>(f: (value: R) => Either<L1, U>) => Either<L | L1, U>;
34
- flatMapAsync: <L1, U>(f: (value: R) => Promise<Either<L1, U>>) => Promise<Either<L | L1, U>>;
35
- toOption: () => Option<R>;
36
- toList: () => List<R>;
37
- valueOf: () => {
38
- _tag: "Right";
39
- value: R;
40
- };
41
- toString: () => string;
42
- } & Functor<R> & Typeable<"Right">;
43
- export type Either<L, R> = Left<L, R> | Right<L, R>;
44
- export declare const Left: <L, R>(value: L) => Left<L, R>;
45
- export declare const Right: <L, R>(value: R) => Right<L, R>;
46
- export declare const isLeft: <L, R>(either: Either<L, R>) => either is Left<L, R>;
47
- export declare const isRight: <L, R>(either: Either<L, R>) => either is Right<L, R>;
48
- export declare const tryCatch: <L, R>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
49
- export declare const tryCatchAsync: <L, R>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
23
+ } & Typeable<"Left" | "Right">;
24
+ export type TestEither<L extends Type, R extends Type> = Either<L, R> & Functor<R>;
25
+ export declare const Right: <L extends Type, R extends Type>(value: R) => Either<L, R>;
26
+ export declare const Left: <L extends Type, R extends Type>(value: L) => Either<L, R>;
27
+ export declare const isRight: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
28
+ value: R;
29
+ };
30
+ export declare const isLeft: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
31
+ value: L;
32
+ };
33
+ export declare const tryCatch: <L extends Type, R extends Type>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
34
+ export declare const TypeCheckRight: <L extends Type, R extends Type>(value: R) => TestEither<L, R>;
35
+ export declare const TypeCheckLeft: <L extends Type, R extends Type>(value: L) => TestEither<L, R>;
36
+ export declare const tryCatchAsync: <L extends Type, R extends Type>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
@@ -1,9 +1,9 @@
1
1
  import { Collection } from "../collections";
2
- import { _Iterable_ } from "../iterable";
2
+ import { _Iterable_, Seq } from "../iterable";
3
3
  import { Option } from "../option/Option";
4
4
  import { Set } from "../set/Set";
5
5
  import { Typeable } from "../typeable/Typeable";
6
- export type List<A> = ({
6
+ export type List<A> = {
7
7
  add: (item: A) => List<A>;
8
8
  map: <B>(f: (a: A) => B) => List<B>;
9
9
  flatMap: <B>(f: (a: A) => _Iterable_<B>) => List<B>;
@@ -19,5 +19,8 @@ export type List<A> = ({
19
19
  _tag: string;
20
20
  values: A[];
21
21
  };
22
- } & ArrayLike<A>) & (_Iterable_<A> & Collection<A> & Typeable<"List">);
22
+ } & Typeable<"List"> & Seq<A>;
23
+ type InternalList<A> = List<A> & ArrayLike<A> & _Iterable_<A> & Collection<A>;
23
24
  export declare const List: <A>(values?: Iterable<A> | _Iterable_<A>) => List<A>;
25
+ export declare const TestList: <A>(values?: Iterable<A> | _Iterable_<A>) => InternalList<A>;
26
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functype",
3
- "version": "0.8.20",
3
+ "version": "0.8.22",
4
4
  "description": "A smallish functional library for TypeScript",
5
5
  "author": "jordan.burke@gmail.com",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{a as V}from"./chunk-2I2NKDFN.mjs";import{a as h}from"./chunk-RRAIFS3D.mjs";import{a as B}from"./chunk-377WQNCB.mjs";import{a as b}from"./chunk-HA5XD5KC.mjs";var U=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>U(e),mapAsync:async t=>U(e),flatMap:t=>U(e),flatMapAsync:async t=>U(e),toOption:()=>g(),toList:()=>g().toList(),valueOf:()=>({_tag:"Left",value:e}),toString:()=>`Left(${JSON.stringify(e)})`}),v=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>v(t(e)),mapAsync:async t=>v(await t(e)),flatMap:t=>t(e),flatMapAsync:t=>t(e),toOption:()=>c(e),toList:()=>c(e).toList(),valueOf:()=>({_tag:"Right",value:e}),toString:()=>`Right(${JSON.stringify(e)})`}),l=e=>U(e),u=e=>v(e),x=e=>e._tag==="Left",E=e=>e._tag==="Right",W=(e,t)=>{try{return u(e())}catch(r){return l(t(r))}},X=async(e,t)=>{try{let r=await e();return u(r)}catch(r){return l(t(r))}};function _(e){return{value:e,map(t){let r=e.then(o=>{if(E(o))try{let a=t(o.value);return u(a)}catch(a){return l(a)}else return l(o.value)});return _(r)},flatMap(t){let r=e.then(o=>{if(E(o))try{return t(o.value).value}catch(a){return Promise.resolve(l(a))}else return Promise.resolve(l(o.value))});return _(r)},mapLeft(t){let r=e.then(o=>{if(x(o))try{let a=t(o.value);return l(a)}catch(a){return l(a)}else return u(o.value)});return _(r)},fold(t,r){return e.then(o=>E(o)?r(o.value):t(o.value))}}}var d=e=>{let t=h(e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],r=Array.from(t);return{[Symbol.iterator]:()=>r[Symbol.iterator](),get length(){return r.length},map:o=>d(r.map(o)),flatMap:o=>d(r.flatMap(a=>o(a).toArray())),forEach:o=>r.forEach(o),count:o=>r.filter(o).length,exists:o=>r.some(o),filter:o=>d(r.filter(o)),filterNot:o=>d(r.filter(a=>!o(a))),find:o=>L(r.find(o)),get head(){return r[0]},get headOption(){return r.length>0?L(r[0]):g()},get isEmpty(){return r.length===0},get size(){return r.length},toArray:()=>[...r],reduce:o=>r.reduce(o),reduceRight:o=>r.reduceRight(o),foldLeft:o=>a=>r.reduce(a,o),foldRight:o=>a=>r.reduceRight((n,p)=>a(p,n),o),valueOf:()=>({values:r})}},f=e=>d(e);var y=e=>{let t=h(e)?new b(e):new b(e?.toArray()??[]),r=f(t),o={...r,add:a=>y([...t,a]),remove:a=>{let n=new b(t);return n.delete(a),y(n)},contains:a=>t.has(a),has:a=>t.has(a),map:a=>y(r.map(a)),flatMap:a=>y(r.flatMap(a)),toList:()=>A(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},S=e=>y(e);var T=e=>{function t(n){return n!=null&&typeof n[Symbol.iterator]=="function"}let r=Array.isArray(e)?e:t(e)?Array.from(e):[],o=f(r),a={...o,_tag:"List",length:r.length,map:n=>T(r.map(n)),flatMap:n=>T(o.flatMap(n)),remove:n=>{let p=r.indexOf(n);return a.removeAt(p)},contains:n=>r.includes(n),add:n=>T([...r,n]),removeAt:n=>n<0||n>=r.length?a:T([...r.slice(0,n),...r.slice(n+1)]),get:n=>L(r[n]),concat:n=>T([...r,...n.toArray()]),toList:()=>a,toSet:()=>S(r),toString:()=>`List(${r.toString()})`,valueOf:()=>({_tag:"List",values:r})};return new Proxy(a,{get(n,p){return typeof p=="symbol"||isNaN(Number(p))?n[p]:n.get(Number(p))}})},A=e=>T(e);var m=e=>{let t={values:new B(e)},r=()=>Array.from(t.values.entries()).map(([i,s])=>V([i,s])),o=i=>m(new B(t.values).set(i.toArray()[0],i.toArray()[1]).entries()),a=i=>{let s=new B(t.values);return s.delete(i)?m(s.entries()):m(t.values.entries())},n=i=>t.values.get(i[0])===i[1],p=()=>t.values.size,M=i=>m(Array.from(t.values.entries()).map(([s,C])=>[s,i(C)])),I=i=>{let s=m(t.values.entries()).toList();return m(s.flatMap(i).toArray())},w=i=>f(r()).reduce(i),P=i=>f(r()).reduceRight(i),N=i=>s=>f(r()).foldLeft(i)(s),z=i=>s=>f(r()).foldRight(i)(s),F=i=>L(t.values.get(i)),q=(i,s)=>L(t.values.get(i)).getOrElse(s),k=()=>t.values.size===0;return{add:o,remove:a,contains:n,get size(){return p()},map:M,flatMap:I,reduce:w,reduceRight:P,foldLeft:N,foldRight:z,get:F,getOrElse:q,get isEmpty(){return k()},orElse:(i,s)=>L(t.values.get(i)).orElse(s),toList:()=>A(r()),toSet:()=>S(r()),toString:()=>`Map(${r().toString()})`}},ve=e=>m(e);var K=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>K(e),orThrow:t=>e,toEither:()=>u(e),map:t=>$(()=>t(e)),flatMap:t=>t(e),valueOf:()=>({_tag:"Success",value:e}),toString:()=>`Success(${JSON.stringify(e)})`}),O=e=>({_tag:"Failure",value:void 0,error:e,isSuccess:()=>!1,isFailure:()=>!0,get:()=>{throw e},getOrElse:t=>t,orElse:t=>t,orThrow:t=>{throw t},toEither:()=>l(e),map:t=>O(e),flatMap:t=>O(e),valueOf:()=>({_tag:"Failure",error:e}),toString:()=>`Failure(${e.message})`}),$=e=>{try{return K(e())}catch(t){return O(t instanceof Error?t:new Error(String(t)))}};var c=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>c(e),map:t=>c(t(e)),filter(t){return t(e)?c(e):R},flatMap:t=>t(e),reduce:t=>t(void 0,e),reduceRight:t=>t(void 0,e),foldLeft:t=>r=>r(t,e),foldRight:t=>r=>r(e,t),toList:()=>A([e]),contains:t=>t===e,size:1,toEither:t=>u(e),toString:()=>`Some(${JSON.stringify(e)})`,valueOf:()=>({_tag:"Some",value:e})}),R={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:e=>R,filter(e){return R},flatMap:e=>R,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>A([]),contains:()=>!1,size:0,toEither:e=>l(e),toString:()=>"None",valueOf:()=>({_tag:"None"})},g=()=>R,L=e=>e!=null?c(e):g();export{c as a,g as b,L as c,l as d,u as e,x as f,E as g,W as h,X as i,_ as j,d as k,f as l,S as m,A as n,ve as o,$ as p};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var U=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>U(e),mapAsync:async t=>U(e),flatMap:t=>U(e),flatMapAsync:async t=>U(e),toOption:()=>g(),toList:()=>g().toList(),valueOf:()=>({_tag:"Left",value:e}),toString:()=>`Left(${JSON.stringify(e)})`}),v=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>v(t(e)),mapAsync:async t=>v(await t(e)),flatMap:t=>t(e),flatMapAsync:t=>t(e),toOption:()=>c(e),toList:()=>c(e).toList(),valueOf:()=>({_tag:"Right",value:e}),toString:()=>`Right(${JSON.stringify(e)})`}),l= exports.d =e=>U(e),u= exports.e =e=>v(e),x= exports.f =e=>e._tag==="Left",E= exports.g =e=>e._tag==="Right",W= exports.h =(e,t)=>{try{return u(e())}catch(r){return l(t(r))}},X= exports.i =async(e,t)=>{try{let r=await e();return u(r)}catch(r){return l(t(r))}};function _(e){return{value:e,map(t){let r=e.then(o=>{if(E(o))try{let a=t(o.value);return u(a)}catch(a){return l(a)}else return l(o.value)});return _(r)},flatMap(t){let r=e.then(o=>{if(E(o))try{return t(o.value).value}catch(a){return Promise.resolve(l(a))}else return Promise.resolve(l(o.value))});return _(r)},mapLeft(t){let r=e.then(o=>{if(x(o))try{let a=t(o.value);return l(a)}catch(a){return l(a)}else return u(o.value)});return _(r)},fold(t,r){return e.then(o=>E(o)?r(o.value):t(o.value))}}}var d=e=>{let t=_chunkBNNK42JCjs.a.call(void 0, e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],r=Array.from(t);return{[Symbol.iterator]:()=>r[Symbol.iterator](),get length(){return r.length},map:o=>d(r.map(o)),flatMap:o=>d(r.flatMap(a=>o(a).toArray())),forEach:o=>r.forEach(o),count:o=>r.filter(o).length,exists:o=>r.some(o),filter:o=>d(r.filter(o)),filterNot:o=>d(r.filter(a=>!o(a))),find:o=>L(r.find(o)),get head(){return r[0]},get headOption(){return r.length>0?L(r[0]):g()},get isEmpty(){return r.length===0},get size(){return r.length},toArray:()=>[...r],reduce:o=>r.reduce(o),reduceRight:o=>r.reduceRight(o),foldLeft:o=>a=>r.reduce(a,o),foldRight:o=>a=>r.reduceRight((n,p)=>a(p,n),o),valueOf:()=>({values:r})}},f= exports.l =e=>d(e);var y=e=>{let t=_chunkBNNK42JCjs.a.call(void 0, e)?new (0, _chunk3VJERXBPjs.a)(e):new (0, _chunk3VJERXBPjs.a)(_nullishCoalesce(_optionalChain([e, 'optionalAccess', _2 => _2.toArray, 'call', _3 => _3()]), () => ([]))),r=f(t),o={...r,add:a=>y([...t,a]),remove:a=>{let n=new (0, _chunk3VJERXBPjs.a)(t);return n.delete(a),y(n)},contains:a=>t.has(a),has:a=>t.has(a),map:a=>y(r.map(a)),flatMap:a=>y(r.flatMap(a)),toList:()=>A(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},S= exports.m =e=>y(e);var T=e=>{function t(n){return n!=null&&typeof n[Symbol.iterator]=="function"}let r=Array.isArray(e)?e:t(e)?Array.from(e):[],o=f(r),a={...o,_tag:"List",length:r.length,map:n=>T(r.map(n)),flatMap:n=>T(o.flatMap(n)),remove:n=>{let p=r.indexOf(n);return a.removeAt(p)},contains:n=>r.includes(n),add:n=>T([...r,n]),removeAt:n=>n<0||n>=r.length?a:T([...r.slice(0,n),...r.slice(n+1)]),get:n=>L(r[n]),concat:n=>T([...r,...n.toArray()]),toList:()=>a,toSet:()=>S(r),toString:()=>`List(${r.toString()})`,valueOf:()=>({_tag:"List",values:r})};return new Proxy(a,{get(n,p){return typeof p=="symbol"||isNaN(Number(p))?n[p]:n.get(Number(p))}})},A= exports.n =e=>T(e);var m=e=>{let t={values:new (0, _chunk5VTXJIR3js.a)(e)},r=()=>Array.from(t.values.entries()).map(([i,s])=>_chunkOXLZ6UIZjs.a.call(void 0, [i,s])),o=i=>m(new (0, _chunk5VTXJIR3js.a)(t.values).set(i.toArray()[0],i.toArray()[1]).entries()),a=i=>{let s=new (0, _chunk5VTXJIR3js.a)(t.values);return s.delete(i)?m(s.entries()):m(t.values.entries())},n=i=>t.values.get(i[0])===i[1],p=()=>t.values.size,M=i=>m(Array.from(t.values.entries()).map(([s,C])=>[s,i(C)])),I=i=>{let s=m(t.values.entries()).toList();return m(s.flatMap(i).toArray())},w=i=>f(r()).reduce(i),P=i=>f(r()).reduceRight(i),N=i=>s=>f(r()).foldLeft(i)(s),z=i=>s=>f(r()).foldRight(i)(s),F=i=>L(t.values.get(i)),q=(i,s)=>L(t.values.get(i)).getOrElse(s),k=()=>t.values.size===0;return{add:o,remove:a,contains:n,get size(){return p()},map:M,flatMap:I,reduce:w,reduceRight:P,foldLeft:N,foldRight:z,get:F,getOrElse:q,get isEmpty(){return k()},orElse:(i,s)=>L(t.values.get(i)).orElse(s),toList:()=>A(r()),toSet:()=>S(r()),toString:()=>`Map(${r().toString()})`}},ve= exports.o =e=>m(e);var K=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>K(e),orThrow:t=>e,toEither:()=>u(e),map:t=>$(()=>t(e)),flatMap:t=>t(e),valueOf:()=>({_tag:"Success",value:e}),toString:()=>`Success(${JSON.stringify(e)})`}),O=e=>({_tag:"Failure",value:void 0,error:e,isSuccess:()=>!1,isFailure:()=>!0,get:()=>{throw e},getOrElse:t=>t,orElse:t=>t,orThrow:t=>{throw t},toEither:()=>l(e),map:t=>O(e),flatMap:t=>O(e),valueOf:()=>({_tag:"Failure",error:e}),toString:()=>`Failure(${e.message})`}),$= exports.p =e=>{try{return K(e())}catch(t){return O(t instanceof Error?t:new Error(String(t)))}};var c=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>c(e),map:t=>c(t(e)),filter(t){return t(e)?c(e):R},flatMap:t=>t(e),reduce:t=>t(void 0,e),reduceRight:t=>t(void 0,e),foldLeft:t=>r=>r(t,e),foldRight:t=>r=>r(e,t),toList:()=>A([e]),contains:t=>t===e,size:1,toEither:t=>u(e),toString:()=>`Some(${JSON.stringify(e)})`,valueOf:()=>({_tag:"Some",value:e})}),R={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:e=>R,filter(e){return R},flatMap:e=>R,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>A([]),contains:()=>!1,size:0,toEither:e=>l(e),toString:()=>"None",valueOf:()=>({_tag:"None"})},g= exports.b =()=>R,L= exports.c =e=>e!=null?c(e):g();exports.a = c; exports.b = g; exports.c = L; exports.d = l; exports.e = u; exports.f = x; exports.g = E; exports.h = W; exports.i = X; exports.j = _; exports.k = d; exports.l = f; exports.m = S; exports.n = A; exports.o = ve; exports.p = $;