@@ -0,0 +1,1944 @@
1+// Generated by purs bundle 0.12.0
2+var PS = {};
3+(function(exports) {
4+ // Generated by purs version 0.12.0
5+ "use strict";
6+ var Control_Category = PS["Control.Category"];
7+ var Data_Boolean = PS["Data.Boolean"];
8+ var Data_Ord = PS["Data.Ord"];
9+ var Data_Ring = PS["Data.Ring"];
10+ var flip = function (f) {
11+ return function (b) {
12+ return function (a) {
13+ return f(a)(b);
14+ };
15+ };
16+ };
17+ var $$const = function (a) {
18+ return function (v) {
19+ return a;
20+ };
21+ };
22+ exports["flip"] = flip;
23+ exports["const"] = $$const;
24+})(PS["Data.Function"] = PS["Data.Function"] || {});
25+(function(exports) {
26+ "use strict";
27+
28+ exports.unit = {};
29+})(PS["Data.Unit"] = PS["Data.Unit"] || {});
30+(function(exports) {
31+ // Generated by purs version 0.12.0
32+ "use strict";
33+ var $foreign = PS["Data.Unit"];
34+ var Data_Show = PS["Data.Show"];
35+ exports["unit"] = $foreign.unit;
36+})(PS["Data.Unit"] = PS["Data.Unit"] || {});
37+(function(exports) {
38+ // Generated by purs version 0.12.0
39+ "use strict";
40+ var $foreign = PS["Data.Functor"];
41+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
42+ var Data_Function = PS["Data.Function"];
43+ var Data_Unit = PS["Data.Unit"];
44+ var Functor = function (map) {
45+ this.map = map;
46+ };
47+ var map = function (dict) {
48+ return dict.map;
49+ };
50+ var $$void = function (dictFunctor) {
51+ return map(dictFunctor)(Data_Function["const"](Data_Unit.unit));
52+ };
53+ var voidRight = function (dictFunctor) {
54+ return function (x) {
55+ return map(dictFunctor)(Data_Function["const"](x));
56+ };
57+ };
58+ exports["Functor"] = Functor;
59+ exports["map"] = map;
60+ exports["void"] = $$void;
61+ exports["voidRight"] = voidRight;
62+})(PS["Data.Functor"] = PS["Data.Functor"] || {});
63+(function(exports) {
64+ // Generated by purs version 0.12.0
65+ "use strict";
66+ var $foreign = PS["Control.Apply"];
67+ var Control_Category = PS["Control.Category"];
68+ var Data_Function = PS["Data.Function"];
69+ var Data_Functor = PS["Data.Functor"];
70+ var Apply = function (Functor0, apply) {
71+ this.Functor0 = Functor0;
72+ this.apply = apply;
73+ };
74+ var apply = function (dict) {
75+ return dict.apply;
76+ };
77+ exports["Apply"] = Apply;
78+ exports["apply"] = apply;
79+})(PS["Control.Apply"] = PS["Control.Apply"] || {});
80+(function(exports) {
81+ // Generated by purs version 0.12.0
82+ "use strict";
83+ var Control_Apply = PS["Control.Apply"];
84+ var Data_Functor = PS["Data.Functor"];
85+ var Data_Unit = PS["Data.Unit"];
86+ var Applicative = function (Apply0, pure) {
87+ this.Apply0 = Apply0;
88+ this.pure = pure;
89+ };
90+ var pure = function (dict) {
91+ return dict.pure;
92+ };
93+ var liftA1 = function (dictApplicative) {
94+ return function (f) {
95+ return function (a) {
96+ return Control_Apply.apply(dictApplicative.Apply0())(pure(dictApplicative)(f))(a);
97+ };
98+ };
99+ };
100+ exports["Applicative"] = Applicative;
101+ exports["pure"] = pure;
102+ exports["liftA1"] = liftA1;
103+})(PS["Control.Applicative"] = PS["Control.Applicative"] || {});
104+(function(exports) {
105+ // Generated by purs version 0.12.0
106+ "use strict";
107+ var $foreign = PS["Control.Bind"];
108+ var Control_Applicative = PS["Control.Applicative"];
109+ var Control_Apply = PS["Control.Apply"];
110+ var Control_Category = PS["Control.Category"];
111+ var Data_Function = PS["Data.Function"];
112+ var Data_Functor = PS["Data.Functor"];
113+ var Data_Unit = PS["Data.Unit"];
114+ var Bind = function (Apply0, bind) {
115+ this.Apply0 = Apply0;
116+ this.bind = bind;
117+ };
118+ var Discard = function (discard) {
119+ this.discard = discard;
120+ };
121+ var discard = function (dict) {
122+ return dict.discard;
123+ };
124+ var bind = function (dict) {
125+ return dict.bind;
126+ };
127+ var bindFlipped = function (dictBind) {
128+ return Data_Function.flip(bind(dictBind));
129+ };
130+ var discardUnit = new Discard(function (dictBind) {
131+ return bind(dictBind);
132+ });
133+ exports["Bind"] = Bind;
134+ exports["bind"] = bind;
135+ exports["bindFlipped"] = bindFlipped;
136+ exports["Discard"] = Discard;
137+ exports["discard"] = discard;
138+ exports["discardUnit"] = discardUnit;
139+})(PS["Control.Bind"] = PS["Control.Bind"] || {});
140+(function(exports) {
141+ // Generated by purs version 0.12.0
142+ "use strict";
143+ var Control_Applicative = PS["Control.Applicative"];
144+ var Control_Apply = PS["Control.Apply"];
145+ var Control_Bind = PS["Control.Bind"];
146+ var Data_Functor = PS["Data.Functor"];
147+ var Data_Unit = PS["Data.Unit"];
148+ var Monad = function (Applicative0, Bind1) {
149+ this.Applicative0 = Applicative0;
150+ this.Bind1 = Bind1;
151+ };
152+ var ap = function (dictMonad) {
153+ return function (f) {
154+ return function (a) {
155+ return Control_Bind.bind(dictMonad.Bind1())(f)(function (v) {
156+ return Control_Bind.bind(dictMonad.Bind1())(a)(function (v1) {
157+ return Control_Applicative.pure(dictMonad.Applicative0())(v(v1));
158+ });
159+ });
160+ };
161+ };
162+ };
163+ exports["Monad"] = Monad;
164+ exports["ap"] = ap;
165+})(PS["Control.Monad"] = PS["Control.Monad"] || {});
166+(function(exports) {
167+ // Generated by purs version 0.12.0
168+ "use strict";
169+ var Control_Alt = PS["Control.Alt"];
170+ var Control_Applicative = PS["Control.Applicative"];
171+ var Control_Apply = PS["Control.Apply"];
172+ var Control_Bind = PS["Control.Bind"];
173+ var Control_Extend = PS["Control.Extend"];
174+ var Control_Monad = PS["Control.Monad"];
175+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
176+ var Data_Bifoldable = PS["Data.Bifoldable"];
177+ var Data_Bifunctor = PS["Data.Bifunctor"];
178+ var Data_Bitraversable = PS["Data.Bitraversable"];
179+ var Data_Bounded = PS["Data.Bounded"];
180+ var Data_Eq = PS["Data.Eq"];
181+ var Data_Foldable = PS["Data.Foldable"];
182+ var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
183+ var Data_Function = PS["Data.Function"];
184+ var Data_Functor = PS["Data.Functor"];
185+ var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
186+ var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
187+ var Data_Maybe = PS["Data.Maybe"];
188+ var Data_Monoid = PS["Data.Monoid"];
189+ var Data_Ord = PS["Data.Ord"];
190+ var Data_Ordering = PS["Data.Ordering"];
191+ var Data_Semigroup = PS["Data.Semigroup"];
192+ var Data_Show = PS["Data.Show"];
193+ var Data_Traversable = PS["Data.Traversable"];
194+ var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
195+ var Data_Unit = PS["Data.Unit"];
196+ var Prelude = PS["Prelude"];
197+ var Left = (function () {
198+ function Left(value0) {
199+ this.value0 = value0;
200+ };
201+ Left.create = function (value0) {
202+ return new Left(value0);
203+ };
204+ return Left;
205+ })();
206+ var Right = (function () {
207+ function Right(value0) {
208+ this.value0 = value0;
209+ };
210+ Right.create = function (value0) {
211+ return new Right(value0);
212+ };
213+ return Right;
214+ })();
215+ exports["Left"] = Left;
216+ exports["Right"] = Right;
217+})(PS["Data.Either"] = PS["Data.Either"] || {});
218+(function(exports) {
219+ // Generated by purs version 0.12.0
220+ "use strict";
221+ var Control_Applicative = PS["Control.Applicative"];
222+ var Control_Bind = PS["Control.Bind"];
223+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
224+ var Data_Either = PS["Data.Either"];
225+ var Data_Function = PS["Data.Function"];
226+ var Data_Functor = PS["Data.Functor"];
227+ var Data_Maybe = PS["Data.Maybe"];
228+ var Data_Unit = PS["Data.Unit"];
229+ var Prelude = PS["Prelude"];
230+ var MonadThrow = function (Monad0, throwError) {
231+ this.Monad0 = Monad0;
232+ this.throwError = throwError;
233+ };
234+ var MonadError = function (MonadThrow0, catchError) {
235+ this.MonadThrow0 = MonadThrow0;
236+ this.catchError = catchError;
237+ };
238+ var throwError = function (dict) {
239+ return dict.throwError;
240+ };
241+ var catchError = function (dict) {
242+ return dict.catchError;
243+ };
244+ var $$try = function (dictMonadError) {
245+ return function (a) {
246+ return catchError(dictMonadError)(Data_Functor.map(((((dictMonadError.MonadThrow0()).Monad0()).Bind1()).Apply0()).Functor0())(Data_Either.Right.create)(a))(function ($21) {
247+ return Control_Applicative.pure(((dictMonadError.MonadThrow0()).Monad0()).Applicative0())(Data_Either.Left.create($21));
248+ });
249+ };
250+ };
251+ exports["catchError"] = catchError;
252+ exports["throwError"] = throwError;
253+ exports["MonadThrow"] = MonadThrow;
254+ exports["MonadError"] = MonadError;
255+ exports["try"] = $$try;
256+})(PS["Control.Monad.Error.Class"] = PS["Control.Monad.Error.Class"] || {});
257+(function(exports) {
258+ // Generated by purs version 0.12.0
259+ "use strict";
260+ var l256 = 256;
261+ var l192 = 192;
262+ var l128 = 128;
263+ var aesKW = "AES-KW";
264+ var aesGCM = "AES-GCM";
265+ var aesCTR = "AES-CTR";
266+ var aesCBC = "AES-CBC";
267+ exports["aesCTR"] = aesCTR;
268+ exports["aesCBC"] = aesCBC;
269+ exports["aesGCM"] = aesGCM;
270+ exports["aesKW"] = aesKW;
271+ exports["l128"] = l128;
272+ exports["l192"] = l192;
273+ exports["l256"] = l256;
274+})(PS["Crypto.Subtle.Constants.AES"] = PS["Crypto.Subtle.Constants.AES"] || {});
275+(function(exports) {
276+ // Generated by purs version 0.12.0
277+ "use strict";
278+ var p521 = "P-521";
279+ var p384 = "P-384";
280+ var p256 = "P-256";
281+ var ecdsa = "ECDSA";
282+ var ecdh = "ECDH";
283+ exports["ecdsa"] = ecdsa;
284+ exports["ecdh"] = ecdh;
285+ exports["p256"] = p256;
286+ exports["p384"] = p384;
287+ exports["p521"] = p521;
288+})(PS["Crypto.Subtle.Constants.EC"] = PS["Crypto.Subtle.Constants.EC"] || {});
289+(function(exports) {
290+ "use strict";
291+
292+ exports.pureE = function (a) {
293+ return function () {
294+ return a;
295+ };
296+ };
297+
298+ exports.bindE = function (a) {
299+ return function (f) {
300+ return function () {
301+ return f(a())();
302+ };
303+ };
304+ };
305+})(PS["Effect"] = PS["Effect"] || {});
306+(function(exports) {
307+ // Generated by purs version 0.12.0
308+ "use strict";
309+ var $foreign = PS["Effect"];
310+ var Control_Applicative = PS["Control.Applicative"];
311+ var Control_Apply = PS["Control.Apply"];
312+ var Control_Bind = PS["Control.Bind"];
313+ var Control_Monad = PS["Control.Monad"];
314+ var Data_Functor = PS["Data.Functor"];
315+ var Data_Monoid = PS["Data.Monoid"];
316+ var Data_Semigroup = PS["Data.Semigroup"];
317+ var Prelude = PS["Prelude"];
318+ var monadEffect = new Control_Monad.Monad(function () {
319+ return applicativeEffect;
320+ }, function () {
321+ return bindEffect;
322+ });
323+ var bindEffect = new Control_Bind.Bind(function () {
324+ return applyEffect;
325+ }, $foreign.bindE);
326+ var applyEffect = new Control_Apply.Apply(function () {
327+ return functorEffect;
328+ }, Control_Monad.ap(monadEffect));
329+ var applicativeEffect = new Control_Applicative.Applicative(function () {
330+ return applyEffect;
331+ }, $foreign.pureE);
332+ var functorEffect = new Data_Functor.Functor(Control_Applicative.liftA1(applicativeEffect));
333+ exports["functorEffect"] = functorEffect;
334+ exports["applyEffect"] = applyEffect;
335+ exports["applicativeEffect"] = applicativeEffect;
336+ exports["bindEffect"] = bindEffect;
337+ exports["monadEffect"] = monadEffect;
338+})(PS["Effect"] = PS["Effect"] || {});
339+(function(exports) {
340+ /* globals setImmediate, clearImmediate, setTimeout, clearTimeout */
341+ /* jshint -W083, -W098, -W003 */
342+ "use strict";
343+
344+ var Aff = function () {
345+ // A unique value for empty.
346+ var EMPTY = {};
347+
348+ /*
349+
350+ An awkward approximation. We elide evidence we would otherwise need in PS for
351+ efficiency sake.
352+
353+ data Aff eff a
354+ = Pure a
355+ | Throw Error
356+ | Catch (Aff eff a) (Error -> Aff eff a)
357+ | Sync (Eff eff a)
358+ | Async ((Either Error a -> Eff eff Unit) -> Eff eff (Canceler eff))
359+ | forall b. Bind (Aff eff b) (b -> Aff eff a)
360+ | forall b. Bracket (Aff eff b) (BracketConditions eff b) (b -> Aff eff a)
361+ | forall b. Fork Boolean (Aff eff b) ?(Fiber eff b -> a)
362+ | Sequential (ParAff aff a)
363+
364+ */
365+ var PURE = "Pure";
366+ var THROW = "Throw";
367+ var CATCH = "Catch";
368+ var SYNC = "Sync";
369+ var ASYNC = "Async";
370+ var BIND = "Bind";
371+ var BRACKET = "Bracket";
372+ var FORK = "Fork";
373+ var SEQ = "Sequential";
374+
375+ /*
376+
377+ data ParAff eff a
378+ = forall b. Map (b -> a) (ParAff eff b)
379+ | forall b. Apply (ParAff eff (b -> a)) (ParAff eff b)
380+ | Alt (ParAff eff a) (ParAff eff a)
381+ | ?Par (Aff eff a)
382+
383+ */
384+ var MAP = "Map";
385+ var APPLY = "Apply";
386+ var ALT = "Alt";
387+
388+ // Various constructors used in interpretation
389+ var CONS = "Cons"; // Cons-list, for stacks
390+ var RESUME = "Resume"; // Continue indiscriminately
391+ var RELEASE = "Release"; // Continue with bracket finalizers
392+ var FINALIZER = "Finalizer"; // A non-interruptible effect
393+ var FINALIZED = "Finalized"; // Marker for finalization
394+ var FORKED = "Forked"; // Reference to a forked fiber, with resumption stack
395+ var FIBER = "Fiber"; // Actual fiber reference
396+ var THUNK = "Thunk"; // Primed effect, ready to invoke
397+
398+ function Aff(tag, _1, _2, _3) {
399+ this.tag = tag;
400+ this._1 = _1;
401+ this._2 = _2;
402+ this._3 = _3;
403+ }
404+
405+ function AffCtr(tag) {
406+ var fn = function (_1, _2, _3) {
407+ return new Aff(tag, _1, _2, _3);
408+ };
409+ fn.tag = tag;
410+ return fn;
411+ }
412+
413+ function nonCanceler(error) {
414+ return new Aff(PURE, void 0);
415+ }
416+
417+ function runEff(eff) {
418+ try {
419+ eff();
420+ } catch (error) {
421+ setTimeout(function () {
422+ throw error;
423+ }, 0);
424+ }
425+ }
426+
427+ function runSync(left, right, eff) {
428+ try {
429+ return right(eff());
430+ } catch (error) {
431+ return left(error);
432+ }
433+ }
434+
435+ function runAsync(left, eff, k) {
436+ try {
437+ return eff(k)();
438+ } catch (error) {
439+ k(left(error))();
440+ return nonCanceler;
441+ }
442+ }
443+
444+ var Scheduler = function () {
445+ var limit = 1024;
446+ var size = 0;
447+ var ix = 0;
448+ var queue = new Array(limit);
449+ var draining = false;
450+
451+ function drain() {
452+ var thunk;
453+ draining = true;
454+ while (size !== 0) {
455+ size--;
456+ thunk = queue[ix];
457+ queue[ix] = void 0;
458+ ix = (ix + 1) % limit;
459+ thunk();
460+ }
461+ draining = false;
462+ }
463+
464+ return {
465+ isDraining: function () {
466+ return draining;
467+ },
468+ enqueue: function (cb) {
469+ var i, tmp;
470+ if (size === limit) {
471+ tmp = draining;
472+ drain();
473+ draining = tmp;
474+ }
475+
476+ queue[(ix + size) % limit] = cb;
477+ size++;
478+
479+ if (!draining) {
480+ drain();
481+ }
482+ }
483+ };
484+ }();
485+
486+ function Supervisor(util) {
487+ var fibers = {};
488+ var fiberId = 0;
489+ var count = 0;
490+
491+ return {
492+ register: function (fiber) {
493+ var fid = fiberId++;
494+ fiber.onComplete({
495+ rethrow: true,
496+ handler: function (result) {
497+ return function () {
498+ count--;
499+ delete fibers[fid];
500+ };
501+ }
502+ });
503+ fibers[fid] = fiber;
504+ count++;
505+ },
506+ isEmpty: function () {
507+ return count === 0;
508+ },
509+ killAll: function (killError, cb) {
510+ return function () {
511+ var killCount = 0;
512+ var kills = {};
513+
514+ function kill(fid) {
515+ kills[fid] = fibers[fid].kill(killError, function (result) {
516+ return function () {
517+ delete kills[fid];
518+ killCount--;
519+ if (util.isLeft(result) && util.fromLeft(result)) {
520+ setTimeout(function () {
521+ throw util.fromLeft(result);
522+ }, 0);
523+ }
524+ if (killCount === 0) {
525+ cb();
526+ }
527+ };
528+ })();
529+ }
530+
531+ for (var k in fibers) {
532+ if (fibers.hasOwnProperty(k)) {
533+ killCount++;
534+ kill(k);
535+ }
536+ }
537+
538+ fibers = {};
539+ fiberId = 0;
540+ count = 0;
541+
542+ return function (error) {
543+ return new Aff(SYNC, function () {
544+ for (var k in kills) {
545+ if (kills.hasOwnProperty(k)) {
546+ kills[k]();
547+ }
548+ }
549+ });
550+ };
551+ };
552+ }
553+ };
554+ }
555+
556+ // Fiber state machine
557+ var SUSPENDED = 0; // Suspended, pending a join.
558+ var CONTINUE = 1; // Interpret the next instruction.
559+ var STEP_BIND = 2; // Apply the next bind.
560+ var STEP_RESULT = 3; // Handle potential failure from a result.
561+ var PENDING = 4; // An async effect is running.
562+ var RETURN = 5; // The current stack has returned.
563+ var COMPLETED = 6; // The entire fiber has completed.
564+
565+ function Fiber(util, supervisor, aff) {
566+ // Monotonically increasing tick, increased on each asynchronous turn.
567+ var runTick = 0;
568+
569+ // The current branch of the state machine.
570+ var status = SUSPENDED;
571+
572+ // The current point of interest for the state machine branch.
573+ var step = aff; // Successful step
574+ var fail = null; // Failure step
575+ var interrupt = null; // Asynchronous interrupt
576+
577+ // Stack of continuations for the current fiber.
578+ var bhead = null;
579+ var btail = null;
580+
581+ // Stack of attempts and finalizers for error recovery. Every `Cons` is also
582+ // tagged with current `interrupt` state. We use this to track which items
583+ // should be ignored or evaluated as a result of a kill.
584+ var attempts = null;
585+
586+ // A special state is needed for Bracket, because it cannot be killed. When
587+ // we enter a bracket acquisition or finalizer, we increment the counter,
588+ // and then decrement once complete.
589+ var bracketCount = 0;
590+
591+ // Each join gets a new id so they can be revoked.
592+ var joinId = 0;
593+ var joins = null;
594+ var rethrow = true;
595+
596+ // Each invocation of `run` requires a tick. When an asynchronous effect is
597+ // resolved, we must check that the local tick coincides with the fiber
598+ // tick before resuming. This prevents multiple async continuations from
599+ // accidentally resuming the same fiber. A common example may be invoking
600+ // the provided callback in `makeAff` more than once, but it may also be an
601+ // async effect resuming after the fiber was already cancelled.
602+ function run(localRunTick) {
603+ var tmp, result, attempt;
604+ while (true) {
605+ tmp = null;
606+ result = null;
607+ attempt = null;
608+
609+ switch (status) {
610+ case STEP_BIND:
611+ status = CONTINUE;
612+ step = bhead(step);
613+ if (btail === null) {
614+ bhead = null;
615+ } else {
616+ bhead = btail._1;
617+ btail = btail._2;
618+ }
619+ break;
620+
621+ case STEP_RESULT:
622+ if (util.isLeft(step)) {
623+ status = RETURN;
624+ fail = step;
625+ step = null;
626+ } else if (bhead === null) {
627+ status = RETURN;
628+ } else {
629+ status = STEP_BIND;
630+ step = util.fromRight(step);
631+ }
632+ break;
633+
634+ case CONTINUE:
635+ switch (step.tag) {
636+ case BIND:
637+ if (bhead) {
638+ btail = new Aff(CONS, bhead, btail);
639+ }
640+ bhead = step._2;
641+ status = CONTINUE;
642+ step = step._1;
643+ break;
644+
645+ case PURE:
646+ if (bhead === null) {
647+ status = RETURN;
648+ step = util.right(step._1);
649+ } else {
650+ status = STEP_BIND;
651+ step = step._1;
652+ }
653+ break;
654+
655+ case SYNC:
656+ status = STEP_RESULT;
657+ step = runSync(util.left, util.right, step._1);
658+ break;
659+
660+ case ASYNC:
661+ status = PENDING;
662+ step = runAsync(util.left, step._1, function (result) {
663+ return function () {
664+ if (runTick !== localRunTick) {
665+ return;
666+ }
667+ runTick++;
668+ Scheduler.enqueue(function () {
669+ // It's possible to interrupt the fiber between enqueuing and
670+ // resuming, so we need to check that the runTick is still
671+ // valid.
672+ if (runTick !== localRunTick + 1) {
673+ return;
674+ }
675+ status = STEP_RESULT;
676+ step = result;
677+ run(runTick);
678+ });
679+ };
680+ });
681+ return;
682+
683+ case THROW:
684+ status = RETURN;
685+ fail = util.left(step._1);
686+ step = null;
687+ break;
688+
689+ // Enqueue the Catch so that we can call the error handler later on
690+ // in case of an exception.
691+ case CATCH:
692+ if (bhead === null) {
693+ attempts = new Aff(CONS, step, attempts, interrupt);
694+ } else {
695+ attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
696+ }
697+ bhead = null;
698+ btail = null;
699+ status = CONTINUE;
700+ step = step._1;
701+ break;
702+
703+ // Enqueue the Bracket so that we can call the appropriate handlers
704+ // after resource acquisition.
705+ case BRACKET:
706+ bracketCount++;
707+ if (bhead === null) {
708+ attempts = new Aff(CONS, step, attempts, interrupt);
709+ } else {
710+ attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
711+ }
712+ bhead = null;
713+ btail = null;
714+ status = CONTINUE;
715+ step = step._1;
716+ break;
717+
718+ case FORK:
719+ status = STEP_RESULT;
720+ tmp = Fiber(util, supervisor, step._2);
721+ if (supervisor) {
722+ supervisor.register(tmp);
723+ }
724+ if (step._1) {
725+ tmp.run();
726+ }
727+ step = util.right(tmp);
728+ break;
729+
730+ case SEQ:
731+ status = CONTINUE;
732+ step = sequential(util, supervisor, step._1);
733+ break;
734+ }
735+ break;
736+
737+ case RETURN:
738+ bhead = null;
739+ btail = null;
740+ // If the current stack has returned, and we have no other stacks to
741+ // resume or finalizers to run, the fiber has halted and we can
742+ // invoke all join callbacks. Otherwise we need to resume.
743+ if (attempts === null) {
744+ status = COMPLETED;
745+ step = interrupt || fail || step;
746+ } else {
747+ // The interrupt status for the enqueued item.
748+ tmp = attempts._3;
749+ attempt = attempts._1;
750+ attempts = attempts._2;
751+
752+ switch (attempt.tag) {
753+ // We cannot recover from an interrupt. Otherwise we should
754+ // continue stepping, or run the exception handler if an exception
755+ // was raised.
756+ case CATCH:
757+ // We should compare the interrupt status as well because we
758+ // only want it to apply if there has been an interrupt since
759+ // enqueuing the catch.
760+ if (interrupt && interrupt !== tmp) {
761+ status = RETURN;
762+ } else if (fail) {
763+ status = CONTINUE;
764+ step = attempt._2(util.fromLeft(fail));
765+ fail = null;
766+ }
767+ break;
768+
769+ // We cannot resume from an interrupt or exception.
770+ case RESUME:
771+ // As with Catch, we only want to ignore in the case of an
772+ // interrupt since enqueing the item.
773+ if (interrupt && interrupt !== tmp || fail) {
774+ status = RETURN;
775+ } else {
776+ bhead = attempt._1;
777+ btail = attempt._2;
778+ status = STEP_BIND;
779+ step = util.fromRight(step);
780+ }
781+ break;
782+
783+ // If we have a bracket, we should enqueue the handlers,
784+ // and continue with the success branch only if the fiber has
785+ // not been interrupted. If the bracket acquisition failed, we
786+ // should not run either.
787+ case BRACKET:
788+ bracketCount--;
789+ if (fail === null) {
790+ result = util.fromRight(step);
791+ // We need to enqueue the Release with the same interrupt
792+ // status as the Bracket that is initiating it.
793+ attempts = new Aff(CONS, new Aff(RELEASE, attempt._2, result), attempts, tmp);
794+ // We should only coninue as long as the interrupt status has not changed or
795+ // we are currently within a non-interruptable finalizer.
796+ if (interrupt === tmp || bracketCount > 0) {
797+ status = CONTINUE;
798+ step = attempt._3(result);
799+ }
800+ }
801+ break;
802+
803+ // Enqueue the appropriate handler. We increase the bracket count
804+ // because it should not be cancelled.
805+ case RELEASE:
806+ bracketCount++;
807+ attempts = new Aff(CONS, new Aff(FINALIZED, step, fail), attempts, interrupt);
808+ status = CONTINUE;
809+ // It has only been killed if the interrupt status has changed
810+ // since we enqueued the item.
811+ if (interrupt && interrupt !== tmp) {
812+ step = attempt._1.killed(util.fromLeft(interrupt))(attempt._2);
813+ } else if (fail) {
814+ step = attempt._1.failed(util.fromLeft(fail))(attempt._2);
815+ } else {
816+ step = attempt._1.completed(util.fromRight(step))(attempt._2);
817+ }
818+ fail = null;
819+ break;
820+
821+ case FINALIZER:
822+ bracketCount++;
823+ attempts = new Aff(CONS, new Aff(FINALIZED, step, fail), attempts, interrupt);
824+ status = CONTINUE;
825+ step = attempt._1;
826+ break;
827+
828+ case FINALIZED:
829+ bracketCount--;
830+ status = RETURN;
831+ step = attempt._1;
832+ fail = attempt._2;
833+ break;
834+ }
835+ }
836+ break;
837+
838+ case COMPLETED:
839+ for (var k in joins) {
840+ if (joins.hasOwnProperty(k)) {
841+ rethrow = rethrow && joins[k].rethrow;
842+ runEff(joins[k].handler(step));
843+ }
844+ }
845+ joins = null;
846+ // If we have an interrupt and a fail, then the thread threw while
847+ // running finalizers. This should always rethrow in a fresh stack.
848+ if (interrupt && fail) {
849+ setTimeout(function () {
850+ throw util.fromLeft(fail);
851+ }, 0);
852+ // If we have an unhandled exception, and no other fiber has joined
853+ // then we need to throw the exception in a fresh stack.
854+ } else if (util.isLeft(step) && rethrow) {
855+ setTimeout(function () {
856+ // Guard on reathrow because a completely synchronous fiber can
857+ // still have an observer which was added after-the-fact.
858+ if (rethrow) {
859+ throw util.fromLeft(step);
860+ }
861+ }, 0);
862+ }
863+ return;
864+ case SUSPENDED:
865+ status = CONTINUE;
866+ break;
867+ case PENDING: return;
868+ }
869+ }
870+ }
871+
872+ function onComplete(join) {
873+ return function () {
874+ if (status === COMPLETED) {
875+ rethrow = rethrow && join.rethrow;
876+ join.handler(step)();
877+ return function () {};
878+ }
879+
880+ var jid = joinId++;
881+ joins = joins || {};
882+ joins[jid] = join;
883+
884+ return function() {
885+ if (joins !== null) {
886+ delete joins[jid];
887+ }
888+ };
889+ };
890+ }
891+
892+ function kill(error, cb) {
893+ return function () {
894+ if (status === COMPLETED) {
895+ cb(util.right(void 0))();
896+ return function () {};
897+ }
898+
899+ var canceler = onComplete({
900+ rethrow: false,
901+ handler: function (/* unused */) {
902+ return cb(util.right(void 0));
903+ }
904+ })();
905+
906+ switch (status) {
907+ case SUSPENDED:
908+ interrupt = util.left(error);
909+ status = COMPLETED;
910+ step = interrupt;
911+ run(runTick);
912+ break;
913+ case PENDING:
914+ if (interrupt === null) {
915+ interrupt = util.left(error);
916+ }
917+ if (bracketCount === 0) {
918+ if (status === PENDING) {
919+ attempts = new Aff(CONS, new Aff(FINALIZER, step(error)), attempts, interrupt);
920+ }
921+ status = RETURN;
922+ step = null;
923+ fail = null;
924+ run(++runTick);
925+ }
926+ break;
927+ default:
928+ if (interrupt === null) {
929+ interrupt = util.left(error);
930+ }
931+ if (bracketCount === 0) {
932+ status = RETURN;
933+ step = null;
934+ fail = null;
935+ }
936+ }
937+
938+ return canceler;
939+ };
940+ }
941+
942+ function join(cb) {
943+ return function () {
944+ var canceler = onComplete({
945+ rethrow: false,
946+ handler: cb
947+ })();
948+ if (status === SUSPENDED) {
949+ run(runTick);
950+ }
951+ return canceler;
952+ };
953+ }
954+
955+ return {
956+ kill: kill,
957+ join: join,
958+ onComplete: onComplete,
959+ isSuspended: function () {
960+ return status === SUSPENDED;
961+ },
962+ run: function () {
963+ if (status === SUSPENDED) {
964+ if (!Scheduler.isDraining()) {
965+ Scheduler.enqueue(function () {
966+ run(runTick);
967+ });
968+ } else {
969+ run(runTick);
970+ }
971+ }
972+ }
973+ };
974+ }
975+
976+ function runPar(util, supervisor, par, cb) {
977+ // Table of all forked fibers.
978+ var fiberId = 0;
979+ var fibers = {};
980+
981+ // Table of currently running cancelers, as a product of `Alt` behavior.
982+ var killId = 0;
983+ var kills = {};
984+
985+ // Error used for early cancelation on Alt branches.
986+ var early = new Error("[ParAff] Early exit");
987+
988+ // Error used to kill the entire tree.
989+ var interrupt = null;
990+
991+ // The root pointer of the tree.
992+ var root = EMPTY;
993+
994+ // Walks a tree, invoking all the cancelers. Returns the table of pending
995+ // cancellation fibers.
996+ function kill(error, par, cb) {
997+ var step = par;
998+ var head = null;
999+ var tail = null;
1000+ var count = 0;
1001+ var kills = {};
1002+ var tmp, kid;
1003+
1004+ loop: while (true) {
1005+ tmp = null;
1006+
1007+ switch (step.tag) {
1008+ case FORKED:
1009+ if (step._3 === EMPTY) {
1010+ tmp = fibers[step._1];
1011+ kills[count++] = tmp.kill(error, function (result) {
1012+ return function () {
1013+ count--;
1014+ if (count === 0) {
1015+ cb(result)();
1016+ }
1017+ };
1018+ });
1019+ }
1020+ // Terminal case.
1021+ if (head === null) {
1022+ break loop;
1023+ }
1024+ // Go down the right side of the tree.
1025+ step = head._2;
1026+ if (tail === null) {
1027+ head = null;
1028+ } else {
1029+ head = tail._1;
1030+ tail = tail._2;
1031+ }
1032+ break;
1033+ case MAP:
1034+ step = step._2;
1035+ break;
1036+ case APPLY:
1037+ case ALT:
1038+ if (head) {
1039+ tail = new Aff(CONS, head, tail);
1040+ }
1041+ head = step;
1042+ step = step._1;
1043+ break;
1044+ }
1045+ }
1046+
1047+ if (count === 0) {
1048+ cb(util.right(void 0))();
1049+ } else {
1050+ // Run the cancelation effects. We alias `count` because it's mutable.
1051+ kid = 0;
1052+ tmp = count;
1053+ for (; kid < tmp; kid++) {
1054+ kills[kid] = kills[kid]();
1055+ }
1056+ }
1057+
1058+ return kills;
1059+ }
1060+
1061+ // When a fiber resolves, we need to bubble back up the tree with the
1062+ // result, computing the applicative nodes.
1063+ function join(result, head, tail) {
1064+ var fail, step, lhs, rhs, tmp, kid;
1065+
1066+ if (util.isLeft(result)) {
1067+ fail = result;
1068+ step = null;
1069+ } else {
1070+ step = result;
1071+ fail = null;
1072+ }
1073+
1074+ loop: while (true) {
1075+ lhs = null;
1076+ rhs = null;
1077+ tmp = null;
1078+ kid = null;
1079+
1080+ // We should never continue if the entire tree has been interrupted.
1081+ if (interrupt !== null) {
1082+ return;
1083+ }
1084+
1085+ // We've made it all the way to the root of the tree, which means
1086+ // the tree has fully evaluated.
1087+ if (head === null) {
1088+ cb(fail || step)();
1089+ return;
1090+ }
1091+
1092+ // The tree has already been computed, so we shouldn't try to do it
1093+ // again. This should never happen.
1094+ // TODO: Remove this?
1095+ if (head._3 !== EMPTY) {
1096+ return;
1097+ }
1098+
1099+ switch (head.tag) {
1100+ case MAP:
1101+ if (fail === null) {
1102+ head._3 = util.right(head._1(util.fromRight(step)));
1103+ step = head._3;
1104+ } else {
1105+ head._3 = fail;
1106+ }
1107+ break;
1108+ case APPLY:
1109+ lhs = head._1._3;
1110+ rhs = head._2._3;
1111+ // If we have a failure we should kill the other side because we
1112+ // can't possible yield a result anymore.
1113+ if (fail) {
1114+ head._3 = fail;
1115+ tmp = true;
1116+ kid = killId++;
1117+
1118+ kills[kid] = kill(early, fail === lhs ? head._2 : head._1, function (/* unused */) {
1119+ return function () {
1120+ delete kills[kid];
1121+ if (tmp) {
1122+ tmp = false;
1123+ } else if (tail === null) {
1124+ join(fail, null, null);
1125+ } else {
1126+ join(fail, tail._1, tail._2);
1127+ }
1128+ };
1129+ });
1130+
1131+ if (tmp) {
1132+ tmp = false;
1133+ return;
1134+ }
1135+ } else if (lhs === EMPTY || rhs === EMPTY) {
1136+ // We can only proceed if both sides have resolved.
1137+ return;
1138+ } else {
1139+ step = util.right(util.fromRight(lhs)(util.fromRight(rhs)));
1140+ head._3 = step;
1141+ }
1142+ break;
1143+ case ALT:
1144+ lhs = head._1._3;
1145+ rhs = head._2._3;
1146+ // We can only proceed if both have resolved or we have a success
1147+ if (lhs === EMPTY && util.isLeft(rhs) || rhs === EMPTY && util.isLeft(lhs)) {
1148+ return;
1149+ }
1150+ // If both sides resolve with an error, we should continue with the
1151+ // first error
1152+ if (lhs !== EMPTY && util.isLeft(lhs) && rhs !== EMPTY && util.isLeft(rhs)) {
1153+ fail = step === lhs ? rhs : lhs;
1154+ step = null;
1155+ head._3 = fail;
1156+ } else {
1157+ head._3 = step;
1158+ tmp = true;
1159+ kid = killId++;
1160+ // Once a side has resolved, we need to cancel the side that is still
1161+ // pending before we can continue.
1162+ kills[kid] = kill(early, step === lhs ? head._2 : head._1, function (/* unused */) {
1163+ return function () {
1164+ delete kills[kid];
1165+ if (tmp) {
1166+ tmp = false;
1167+ } else if (tail === null) {
1168+ join(step, null, null);
1169+ } else {
1170+ join(step, tail._1, tail._2);
1171+ }
1172+ };
1173+ });
1174+
1175+ if (tmp) {
1176+ tmp = false;
1177+ return;
1178+ }
1179+ }
1180+ break;
1181+ }
1182+
1183+ if (tail === null) {
1184+ head = null;
1185+ } else {
1186+ head = tail._1;
1187+ tail = tail._2;
1188+ }
1189+ }
1190+ }
1191+
1192+ function resolve(fiber) {
1193+ return function (result) {
1194+ return function () {
1195+ delete fibers[fiber._1];
1196+ fiber._3 = result;
1197+ join(result, fiber._2._1, fiber._2._2);
1198+ };
1199+ };
1200+ }
1201+
1202+ // Walks the applicative tree, substituting non-applicative nodes with
1203+ // `FORKED` nodes. In this tree, all applicative nodes use the `_3` slot
1204+ // as a mutable slot for memoization. In an unresolved state, the `_3`
1205+ // slot is `EMPTY`. In the cases of `ALT` and `APPLY`, we always walk
1206+ // the left side first, because both operations are left-associative. As
1207+ // we `RETURN` from those branches, we then walk the right side.
1208+ function run() {
1209+ var status = CONTINUE;
1210+ var step = par;
1211+ var head = null;
1212+ var tail = null;
1213+ var tmp, fid;
1214+
1215+ loop: while (true) {
1216+ tmp = null;
1217+ fid = null;
1218+
1219+ switch (status) {
1220+ case CONTINUE:
1221+ switch (step.tag) {
1222+ case MAP:
1223+ if (head) {
1224+ tail = new Aff(CONS, head, tail);
1225+ }
1226+ head = new Aff(MAP, step._1, EMPTY, EMPTY);
1227+ step = step._2;
1228+ break;
1229+ case APPLY:
1230+ if (head) {
1231+ tail = new Aff(CONS, head, tail);
1232+ }
1233+ head = new Aff(APPLY, EMPTY, step._2, EMPTY);
1234+ step = step._1;
1235+ break;
1236+ case ALT:
1237+ if (head) {
1238+ tail = new Aff(CONS, head, tail);
1239+ }
1240+ head = new Aff(ALT, EMPTY, step._2, EMPTY);
1241+ step = step._1;
1242+ break;
1243+ default:
1244+ // When we hit a leaf value, we suspend the stack in the `FORKED`.
1245+ // When the fiber resolves, it can bubble back up the tree.
1246+ fid = fiberId++;
1247+ status = RETURN;
1248+ tmp = step;
1249+ step = new Aff(FORKED, fid, new Aff(CONS, head, tail), EMPTY);
1250+ tmp = Fiber(util, supervisor, tmp);
1251+ tmp.onComplete({
1252+ rethrow: false,
1253+ handler: resolve(step)
1254+ })();
1255+ fibers[fid] = tmp;
1256+ if (supervisor) {
1257+ supervisor.register(tmp);
1258+ }
1259+ }
1260+ break;
1261+ case RETURN:
1262+ // Terminal case, we are back at the root.
1263+ if (head === null) {
1264+ break loop;
1265+ }
1266+ // If we are done with the right side, we need to continue down the
1267+ // left. Otherwise we should continue up the stack.
1268+ if (head._1 === EMPTY) {
1269+ head._1 = step;
1270+ status = CONTINUE;
1271+ step = head._2;
1272+ head._2 = EMPTY;
1273+ } else {
1274+ head._2 = step;
1275+ step = head;
1276+ if (tail === null) {
1277+ head = null;
1278+ } else {
1279+ head = tail._1;
1280+ tail = tail._2;
1281+ }
1282+ }
1283+ }
1284+ }
1285+
1286+ // Keep a reference to the tree root so it can be cancelled.
1287+ root = step;
1288+
1289+ for (fid = 0; fid < fiberId; fid++) {
1290+ fibers[fid].run();
1291+ }
1292+ }
1293+
1294+ // Cancels the entire tree. If there are already subtrees being canceled,
1295+ // we need to first cancel those joins. We will then add fresh joins for
1296+ // all pending branches including those that were in the process of being
1297+ // canceled.
1298+ function cancel(error, cb) {
1299+ interrupt = util.left(error);
1300+ var innerKills;
1301+ for (var kid in kills) {
1302+ if (kills.hasOwnProperty(kid)) {
1303+ innerKills = kills[kid];
1304+ for (kid in innerKills) {
1305+ if (innerKills.hasOwnProperty(kid)) {
1306+ innerKills[kid]();
1307+ }
1308+ }
1309+ }
1310+ }
1311+
1312+ kills = null;
1313+ var newKills = kill(error, root, cb);
1314+
1315+ return function (killError) {
1316+ return new Aff(ASYNC, function (killCb) {
1317+ return function () {
1318+ for (var kid in newKills) {
1319+ if (newKills.hasOwnProperty(kid)) {
1320+ newKills[kid]();
1321+ }
1322+ }
1323+ return nonCanceler;
1324+ };
1325+ });
1326+ };
1327+ }
1328+
1329+ run();
1330+
1331+ return function (killError) {
1332+ return new Aff(ASYNC, function (killCb) {
1333+ return function () {
1334+ return cancel(killError, killCb);
1335+ };
1336+ });
1337+ };
1338+ }
1339+
1340+ function sequential(util, supervisor, par) {
1341+ return new Aff(ASYNC, function (cb) {
1342+ return function () {
1343+ return runPar(util, supervisor, par, cb);
1344+ };
1345+ });
1346+ }
1347+
1348+ Aff.EMPTY = EMPTY;
1349+ Aff.Pure = AffCtr(PURE);
1350+ Aff.Throw = AffCtr(THROW);
1351+ Aff.Catch = AffCtr(CATCH);
1352+ Aff.Sync = AffCtr(SYNC);
1353+ Aff.Async = AffCtr(ASYNC);
1354+ Aff.Bind = AffCtr(BIND);
1355+ Aff.Bracket = AffCtr(BRACKET);
1356+ Aff.Fork = AffCtr(FORK);
1357+ Aff.Seq = AffCtr(SEQ);
1358+ Aff.ParMap = AffCtr(MAP);
1359+ Aff.ParApply = AffCtr(APPLY);
1360+ Aff.ParAlt = AffCtr(ALT);
1361+ Aff.Fiber = Fiber;
1362+ Aff.Supervisor = Supervisor;
1363+ Aff.Scheduler = Scheduler;
1364+ Aff.nonCanceler = nonCanceler;
1365+
1366+ return Aff;
1367+ }();
1368+
1369+ exports._pure = Aff.Pure;
1370+
1371+ exports._throwError = Aff.Throw;
1372+
1373+ exports._catchError = function (aff) {
1374+ return function (k) {
1375+ return Aff.Catch(aff, k);
1376+ };
1377+ };
1378+
1379+ exports._map = function (f) {
1380+ return function (aff) {
1381+ if (aff.tag === Aff.Pure.tag) {
1382+ return Aff.Pure(f(aff._1));
1383+ } else {
1384+ return Aff.Bind(aff, function (value) {
1385+ return Aff.Pure(f(value));
1386+ });
1387+ }
1388+ };
1389+ };
1390+
1391+ exports._bind = function (aff) {
1392+ return function (k) {
1393+ return Aff.Bind(aff, k);
1394+ };
1395+ };
1396+
1397+ exports._liftEffect = Aff.Sync;
1398+
1399+ exports.makeAff = Aff.Async;
1400+
1401+ exports._makeFiber = function (util, aff) {
1402+ return function () {
1403+ return Aff.Fiber(util, null, aff);
1404+ };
1405+ };
1406+})(PS["Effect.Aff"] = PS["Effect.Aff"] || {});
1407+(function(exports) {
1408+ // Generated by purs version 0.12.0
1409+ "use strict";
1410+ var Control_Category = PS["Control.Category"];
1411+ var Control_Monad = PS["Control.Monad"];
1412+ var Effect = PS["Effect"];
1413+ var MonadEffect = function (Monad0, liftEffect) {
1414+ this.Monad0 = Monad0;
1415+ this.liftEffect = liftEffect;
1416+ };
1417+ var liftEffect = function (dict) {
1418+ return dict.liftEffect;
1419+ };
1420+ exports["liftEffect"] = liftEffect;
1421+ exports["MonadEffect"] = MonadEffect;
1422+})(PS["Effect.Class"] = PS["Effect.Class"] || {});
1423+(function(exports) {
1424+ "use strict";
1425+
1426+ exports.throwException = function (e) {
1427+ return function () {
1428+ throw e;
1429+ };
1430+ };
1431+})(PS["Effect.Exception"] = PS["Effect.Exception"] || {});
1432+(function(exports) {
1433+ // Generated by purs version 0.12.0
1434+ "use strict";
1435+ var $foreign = PS["Effect.Exception"];
1436+ var Control_Applicative = PS["Control.Applicative"];
1437+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
1438+ var Data_Either = PS["Data.Either"];
1439+ var Data_Functor = PS["Data.Functor"];
1440+ var Data_Maybe = PS["Data.Maybe"];
1441+ var Data_Show = PS["Data.Show"];
1442+ var Effect = PS["Effect"];
1443+ var Prelude = PS["Prelude"];
1444+ exports["throwException"] = $foreign.throwException;
1445+})(PS["Effect.Exception"] = PS["Effect.Exception"] || {});
1446+(function(exports) {
1447+ "use strict";
1448+
1449+ // module Partial.Unsafe
1450+
1451+ exports.unsafePartial = function (f) {
1452+ return f();
1453+ };
1454+})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
1455+(function(exports) {
1456+ "use strict";
1457+
1458+ // module Partial
1459+
1460+ exports.crashWith = function () {
1461+ return function (msg) {
1462+ throw new Error(msg);
1463+ };
1464+ };
1465+})(PS["Partial"] = PS["Partial"] || {});
1466+(function(exports) {
1467+ // Generated by purs version 0.12.0
1468+ "use strict";
1469+ var $foreign = PS["Partial"];
1470+ exports["crashWith"] = $foreign.crashWith;
1471+})(PS["Partial"] = PS["Partial"] || {});
1472+(function(exports) {
1473+ // Generated by purs version 0.12.0
1474+ "use strict";
1475+ var $foreign = PS["Partial.Unsafe"];
1476+ var Partial = PS["Partial"];
1477+ var unsafeCrashWith = function (msg) {
1478+ return $foreign.unsafePartial(function (dictPartial) {
1479+ return Partial.crashWith(dictPartial)(msg);
1480+ });
1481+ };
1482+ exports["unsafeCrashWith"] = unsafeCrashWith;
1483+})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
1484+(function(exports) {
1485+ // Generated by purs version 0.12.0
1486+ "use strict";
1487+ var $foreign = PS["Effect.Aff"];
1488+ var Control_Alt = PS["Control.Alt"];
1489+ var Control_Alternative = PS["Control.Alternative"];
1490+ var Control_Applicative = PS["Control.Applicative"];
1491+ var Control_Apply = PS["Control.Apply"];
1492+ var Control_Bind = PS["Control.Bind"];
1493+ var Control_Lazy = PS["Control.Lazy"];
1494+ var Control_Monad = PS["Control.Monad"];
1495+ var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
1496+ var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
1497+ var Control_Parallel = PS["Control.Parallel"];
1498+ var Control_Parallel_Class = PS["Control.Parallel.Class"];
1499+ var Control_Plus = PS["Control.Plus"];
1500+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
1501+ var Data_Either = PS["Data.Either"];
1502+ var Data_Foldable = PS["Data.Foldable"];
1503+ var Data_Function = PS["Data.Function"];
1504+ var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
1505+ var Data_Functor = PS["Data.Functor"];
1506+ var Data_Monoid = PS["Data.Monoid"];
1507+ var Data_Newtype = PS["Data.Newtype"];
1508+ var Data_Semigroup = PS["Data.Semigroup"];
1509+ var Data_Time_Duration = PS["Data.Time.Duration"];
1510+ var Data_Unit = PS["Data.Unit"];
1511+ var Effect = PS["Effect"];
1512+ var Effect_Class = PS["Effect.Class"];
1513+ var Effect_Exception = PS["Effect.Exception"];
1514+ var Effect_Unsafe = PS["Effect.Unsafe"];
1515+ var Partial_Unsafe = PS["Partial.Unsafe"];
1516+ var Prelude = PS["Prelude"];
1517+ var Unsafe_Coerce = PS["Unsafe.Coerce"];
1518+ var functorAff = new Data_Functor.Functor($foreign._map);
1519+ var ffiUtil = (function () {
1520+ var unsafeFromRight = function (v) {
1521+ if (v instanceof Data_Either.Right) {
1522+ return v.value0;
1523+ };
1524+ if (v instanceof Data_Either.Left) {
1525+ return Partial_Unsafe.unsafeCrashWith("unsafeFromRight: Left");
1526+ };
1527+ throw new Error("Failed pattern match at Effect.Aff line 400, column 21 - line 402, column 31: " + [ v.constructor.name ]);
1528+ };
1529+ var unsafeFromLeft = function (v) {
1530+ if (v instanceof Data_Either.Left) {
1531+ return v.value0;
1532+ };
1533+ if (v instanceof Data_Either.Right) {
1534+ return Partial_Unsafe.unsafeCrashWith("unsafeFromLeft: Right");
1535+ };
1536+ throw new Error("Failed pattern match at Effect.Aff line 395, column 20 - line 399, column 3: " + [ v.constructor.name ]);
1537+ };
1538+ var isLeft = function (v) {
1539+ if (v instanceof Data_Either.Left) {
1540+ return true;
1541+ };
1542+ if (v instanceof Data_Either.Right) {
1543+ return false;
1544+ };
1545+ throw new Error("Failed pattern match at Effect.Aff line 390, column 12 - line 392, column 20: " + [ v.constructor.name ]);
1546+ };
1547+ return {
1548+ isLeft: isLeft,
1549+ fromLeft: unsafeFromLeft,
1550+ fromRight: unsafeFromRight,
1551+ left: Data_Either.Left.create,
1552+ right: Data_Either.Right.create
1553+ };
1554+ })();
1555+ var makeFiber = function (aff) {
1556+ return $foreign._makeFiber(ffiUtil, aff);
1557+ };
1558+ var launchAff = function (aff) {
1559+ return function __do() {
1560+ var v = makeFiber(aff)();
1561+ v.run();
1562+ return v;
1563+ };
1564+ };
1565+ var monadAff = new Control_Monad.Monad(function () {
1566+ return applicativeAff;
1567+ }, function () {
1568+ return bindAff;
1569+ });
1570+ var bindAff = new Control_Bind.Bind(function () {
1571+ return applyAff;
1572+ }, $foreign._bind);
1573+ var applyAff = new Control_Apply.Apply(function () {
1574+ return functorAff;
1575+ }, Control_Monad.ap(monadAff));
1576+ var applicativeAff = new Control_Applicative.Applicative(function () {
1577+ return applyAff;
1578+ }, $foreign._pure);
1579+ var monadEffectAff = new Effect_Class.MonadEffect(function () {
1580+ return monadAff;
1581+ }, $foreign._liftEffect);
1582+ var monadThrowAff = new Control_Monad_Error_Class.MonadThrow(function () {
1583+ return monadAff;
1584+ }, $foreign._throwError);
1585+ var monadErrorAff = new Control_Monad_Error_Class.MonadError(function () {
1586+ return monadThrowAff;
1587+ }, $foreign._catchError);
1588+ var runAff = function (k) {
1589+ return function (aff) {
1590+ return launchAff(Control_Bind.bindFlipped(bindAff)(function ($52) {
1591+ return Effect_Class.liftEffect(monadEffectAff)(k($52));
1592+ })(Control_Monad_Error_Class["try"](monadErrorAff)(aff)));
1593+ };
1594+ };
1595+ var runAff_ = function (k) {
1596+ return function (aff) {
1597+ return Data_Functor["void"](Effect.functorEffect)(runAff(k)(aff));
1598+ };
1599+ };
1600+ var nonCanceler = Data_Function["const"](Control_Applicative.pure(applicativeAff)(Data_Unit.unit));
1601+ exports["launchAff"] = launchAff;
1602+ exports["runAff"] = runAff;
1603+ exports["runAff_"] = runAff_;
1604+ exports["nonCanceler"] = nonCanceler;
1605+ exports["functorAff"] = functorAff;
1606+ exports["applyAff"] = applyAff;
1607+ exports["applicativeAff"] = applicativeAff;
1608+ exports["bindAff"] = bindAff;
1609+ exports["monadAff"] = monadAff;
1610+ exports["monadThrowAff"] = monadThrowAff;
1611+ exports["monadErrorAff"] = monadErrorAff;
1612+ exports["monadEffectAff"] = monadEffectAff;
1613+ exports["makeAff"] = $foreign.makeAff;
1614+})(PS["Effect.Aff"] = PS["Effect.Aff"] || {});
1615+(function(exports) {
1616+
1617+ exports.promiseToEffectImpl = function (promise, onFulfilled, onRejected) {
1618+ return function () {
1619+ return promise.then(function (a) {
1620+ return onFulfilled(a)();
1621+ }, function (err) {
1622+ return onRejected(err)();
1623+ });
1624+ };
1625+ };
1626+})(PS["Effect.Promise"] = PS["Effect.Promise"] || {});
1627+(function(exports) {exports.undefer = function (f) {
1628+ return f();
1629+ };
1630+})(PS["Effect.Promise.Unsafe"] = PS["Effect.Promise.Unsafe"] || {});
1631+(function(exports) {
1632+ // Generated by purs version 0.12.0
1633+ "use strict";
1634+ var $foreign = PS["Effect.Promise.Unsafe"];
1635+ exports["undefer"] = $foreign.undefer;
1636+})(PS["Effect.Promise.Unsafe"] = PS["Effect.Promise.Unsafe"] || {});
1637+(function(exports) {
1638+ // Generated by purs version 0.12.0
1639+ "use strict";
1640+ var $foreign = PS["Effect.Promise"];
1641+ var Control_Applicative = PS["Control.Applicative"];
1642+ var Control_Apply = PS["Control.Apply"];
1643+ var Control_Bind = PS["Control.Bind"];
1644+ var Control_Monad = PS["Control.Monad"];
1645+ var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
1646+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
1647+ var Data_Array = PS["Data.Array"];
1648+ var Data_Either = PS["Data.Either"];
1649+ var Data_Foldable = PS["Data.Foldable"];
1650+ var Data_Function = PS["Data.Function"];
1651+ var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
1652+ var Data_Functor = PS["Data.Functor"];
1653+ var Data_Monoid = PS["Data.Monoid"];
1654+ var Data_Semigroup = PS["Data.Semigroup"];
1655+ var Data_Time_Duration = PS["Data.Time.Duration"];
1656+ var Data_Unfoldable = PS["Data.Unfoldable"];
1657+ var Data_Unit = PS["Data.Unit"];
1658+ var Effect = PS["Effect"];
1659+ var Effect_Class = PS["Effect.Class"];
1660+ var Effect_Exception = PS["Effect.Exception"];
1661+ var Effect_Promise_Unsafe = PS["Effect.Promise.Unsafe"];
1662+ var Prelude = PS["Prelude"];
1663+ var runPromise = function (onSucc) {
1664+ return function (onErr) {
1665+ return function (p) {
1666+ return $foreign.promiseToEffectImpl(Effect_Promise_Unsafe.undefer(function (dictDeferred) {
1667+ return p(dictDeferred);
1668+ }), onSucc, onErr);
1669+ };
1670+ };
1671+ };
1672+ exports["runPromise"] = runPromise;
1673+})(PS["Effect.Promise"] = PS["Effect.Promise"] || {});
1674+(function(exports) {
1675+ // Generated by purs version 0.12.0
1676+ "use strict";
1677+ var $foreign = PS["Crypto.Subtle.Hash"];
1678+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
1679+ var Data_ArrayBuffer_Types = PS["Data.ArrayBuffer.Types"];
1680+ var Data_Either = PS["Data.Either"];
1681+ var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
1682+ var Data_Functor = PS["Data.Functor"];
1683+ var Effect = PS["Effect"];
1684+ var Effect_Aff = PS["Effect.Aff"];
1685+ var Effect_Promise = PS["Effect.Promise"];
1686+ var Prelude = PS["Prelude"];
1687+ var sha512 = "SHA-512";
1688+ var sha384 = "SHA-384";
1689+ var sha256 = "SHA-256";
1690+ var sha1 = "SHA-1";
1691+ exports["sha1"] = sha1;
1692+ exports["sha256"] = sha256;
1693+ exports["sha384"] = sha384;
1694+ exports["sha512"] = sha512;
1695+})(PS["Crypto.Subtle.Hash"] = PS["Crypto.Subtle.Hash"] || {});
1696+(function(exports) {
1697+ "use strict";
1698+
1699+ exports.generateKeyImpl = function generateKeyImpl (a,e,u) {
1700+ return crypto.subtle.generateKey(a,e,u);
1701+ };
1702+})(PS["Crypto.Subtle.Key.Generate"] = PS["Crypto.Subtle.Key.Generate"] || {});
1703+(function(exports) {
1704+ // Generated by purs version 0.12.0
1705+ "use strict";
1706+ var $foreign = PS["Crypto.Subtle.Key.Types"];
1707+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
1708+ var Data_ArrayBuffer_Types = PS["Data.ArrayBuffer.Types"];
1709+ var Data_Either = PS["Data.Either"];
1710+ var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
1711+ var Data_Functor = PS["Data.Functor"];
1712+ var Effect = PS["Effect"];
1713+ var Effect_Aff = PS["Effect.Aff"];
1714+ var Effect_Promise = PS["Effect.Promise"];
1715+ var Foreign = PS["Foreign"];
1716+ var Prelude = PS["Prelude"];
1717+ var wrapKey = "wrapKey";
1718+ var verify = "verify";
1719+ var unwrapKey = "unwrapKey";
1720+ var sign = "sign";
1721+ var encrypt = "encrypt";
1722+ var deriveKey = "deriveKey";
1723+ var deriveBits = "deriveBits";
1724+ var decrypt = "decrypt";
1725+ var allUsages = [ encrypt, decrypt, sign, verify, deriveKey, deriveBits, wrapKey, unwrapKey ];
1726+ exports["encrypt"] = encrypt;
1727+ exports["decrypt"] = decrypt;
1728+ exports["sign"] = sign;
1729+ exports["verify"] = verify;
1730+ exports["deriveKey"] = deriveKey;
1731+ exports["deriveBits"] = deriveBits;
1732+ exports["unwrapKey"] = unwrapKey;
1733+ exports["wrapKey"] = wrapKey;
1734+ exports["allUsages"] = allUsages;
1735+})(PS["Crypto.Subtle.Key.Types"] = PS["Crypto.Subtle.Key.Types"] || {});
1736+(function(exports) {
1737+ // Generated by purs version 0.12.0
1738+ "use strict";
1739+ var $foreign = PS["Crypto.Subtle.Key.Generate"];
1740+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
1741+ var Crypto_Subtle_Constants_AES = PS["Crypto.Subtle.Constants.AES"];
1742+ var Crypto_Subtle_Constants_EC = PS["Crypto.Subtle.Constants.EC"];
1743+ var Crypto_Subtle_Constants_RSA = PS["Crypto.Subtle.Constants.RSA"];
1744+ var Crypto_Subtle_Hash = PS["Crypto.Subtle.Hash"];
1745+ var Crypto_Subtle_Key_Types = PS["Crypto.Subtle.Key.Types"];
1746+ var Data_ArrayBuffer_Types = PS["Data.ArrayBuffer.Types"];
1747+ var Data_Either = PS["Data.Either"];
1748+ var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
1749+ var Data_Functor = PS["Data.Functor"];
1750+ var Effect = PS["Effect"];
1751+ var Effect_Aff = PS["Effect.Aff"];
1752+ var Effect_Promise = PS["Effect.Promise"];
1753+ var Prelude = PS["Prelude"];
1754+ var Unsafe_Coerce = PS["Unsafe.Coerce"];
1755+ var hmac = function (h) {
1756+ return {
1757+ name: "HMAC",
1758+ hash: h
1759+ };
1760+ };
1761+ var generateKey = function (a) {
1762+ return function (e) {
1763+ return function (u) {
1764+ return Effect_Aff.makeAff(function (resolve) {
1765+ return Data_Functor.voidRight(Effect.functorEffect)(Effect_Aff.nonCanceler)(Effect_Promise.runPromise(function ($1) {
1766+ return resolve(Data_Either.Right.create($1));
1767+ })(function ($2) {
1768+ return resolve(Data_Either.Left.create($2));
1769+ })(function (dictDeferred) {
1770+ return $foreign.generateKeyImpl(a, e, u);
1771+ }));
1772+ });
1773+ };
1774+ };
1775+ };
1776+ var ec = function (e) {
1777+ return function (c) {
1778+ return {
1779+ name: e,
1780+ namedCurve: c
1781+ };
1782+ };
1783+ };
1784+ var aes = function (a) {
1785+ return function (l) {
1786+ return {
1787+ name: a,
1788+ length: l
1789+ };
1790+ };
1791+ };
1792+ exports["generateKey"] = generateKey;
1793+ exports["ec"] = ec;
1794+ exports["hmac"] = hmac;
1795+ exports["aes"] = aes;
1796+})(PS["Crypto.Subtle.Key.Generate"] = PS["Crypto.Subtle.Key.Generate"] || {});
1797+(function(exports) {
1798+ "use strict";
1799+
1800+ exports.log = function (s) {
1801+ return function () {
1802+ console.log(s);
1803+ return {};
1804+ };
1805+ };
1806+})(PS["Effect.Console"] = PS["Effect.Console"] || {});
1807+(function(exports) {
1808+ // Generated by purs version 0.12.0
1809+ "use strict";
1810+ var $foreign = PS["Effect.Console"];
1811+ var Data_Show = PS["Data.Show"];
1812+ var Data_Unit = PS["Data.Unit"];
1813+ var Effect = PS["Effect"];
1814+ exports["log"] = $foreign.log;
1815+})(PS["Effect.Console"] = PS["Effect.Console"] || {});
1816+(function(exports) {
1817+ // Generated by purs version 0.12.0
1818+ "use strict";
1819+ var Control_Applicative = PS["Control.Applicative"];
1820+ var Control_Bind = PS["Control.Bind"];
1821+ var Control_Semigroupoid = PS["Control.Semigroupoid"];
1822+ var Crypto_Subtle_Constants_AES = PS["Crypto.Subtle.Constants.AES"];
1823+ var Crypto_Subtle_Constants_EC = PS["Crypto.Subtle.Constants.EC"];
1824+ var Crypto_Subtle_Hash = PS["Crypto.Subtle.Hash"];
1825+ var Crypto_Subtle_Key_Generate = PS["Crypto.Subtle.Key.Generate"];
1826+ var Crypto_Subtle_Key_Types = PS["Crypto.Subtle.Key.Types"];
1827+ var Data_Either = PS["Data.Either"];
1828+ var Data_Unit = PS["Data.Unit"];
1829+ var Effect = PS["Effect"];
1830+ var Effect_Aff = PS["Effect.Aff"];
1831+ var Effect_Class = PS["Effect.Class"];
1832+ var Effect_Console = PS["Effect.Console"];
1833+ var Effect_Exception = PS["Effect.Exception"];
1834+ var Prelude = PS["Prelude"];
1835+ var Unsafe_Coerce = PS["Unsafe.Coerce"];
1836+ var log$prime = function ($23) {
1837+ return Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(Effect_Console.log($23));
1838+ };
1839+ var main = (function () {
1840+ var resolve = function (eX) {
1841+ if (eX instanceof Data_Either.Left) {
1842+ return Effect_Exception.throwException(eX.value0);
1843+ };
1844+ if (eX instanceof Data_Either.Right) {
1845+ return Control_Applicative.pure(Effect.applicativeEffect)(Data_Unit.unit);
1846+ };
1847+ throw new Error("Failed pattern match at Test.Main line 23, column 20 - line 25, column 29: " + [ eX.constructor.name ]);
1848+ };
1849+ return Effect_Aff.runAff_(resolve)(Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("Generating Keys..."))(function () {
1850+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)((function () {
1851+ var genAES = function (mode) {
1852+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.aes(mode)(Crypto_Subtle_Constants_AES.l128))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1853+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - 128"))(function () {
1854+ return log$prime(v);
1855+ });
1856+ }))(function () {
1857+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.aes(mode)(Crypto_Subtle_Constants_AES.l192))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1858+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - 192"))(function () {
1859+ return log$prime(v);
1860+ });
1861+ }))(function () {
1862+ return Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.aes(mode)(Crypto_Subtle_Constants_AES.l256))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1863+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - 256"))(function () {
1864+ return log$prime(v);
1865+ });
1866+ });
1867+ });
1868+ });
1869+ };
1870+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("- AES-CTR"))(function () {
1871+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(genAES(Crypto_Subtle_Constants_AES.aesCTR))(function () {
1872+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("- AES-CBC"))(function () {
1873+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(genAES(Crypto_Subtle_Constants_AES.aesCBC))(function () {
1874+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("- AES-GCM"))(function () {
1875+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(genAES(Crypto_Subtle_Constants_AES.aesGCM))(function () {
1876+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("- AES-KW"))(function () {
1877+ return genAES(Crypto_Subtle_Constants_AES.aesKW);
1878+ });
1879+ });
1880+ });
1881+ });
1882+ });
1883+ });
1884+ });
1885+ })())(function () {
1886+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("HMAC"))(function () {
1887+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.hmac(Crypto_Subtle_Hash.sha1))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1888+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - SHA-1"))(function () {
1889+ return log$prime(v);
1890+ });
1891+ }))(function () {
1892+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.hmac(Crypto_Subtle_Hash.sha256))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1893+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - SHA-256"))(function () {
1894+ return log$prime(v);
1895+ });
1896+ }))(function () {
1897+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.hmac(Crypto_Subtle_Hash.sha384))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1898+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - SHA-384"))(function () {
1899+ return log$prime(v);
1900+ });
1901+ }))(function () {
1902+ return Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.hmac(Crypto_Subtle_Hash.sha512))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1903+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - SHA-512"))(function () {
1904+ return log$prime(v);
1905+ });
1906+ });
1907+ });
1908+ });
1909+ });
1910+ }))(function () {
1911+ var genEC = function (alg) {
1912+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.ec(alg)(Crypto_Subtle_Constants_EC.p256))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1913+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - P-256"))(function () {
1914+ return log$prime(v);
1915+ });
1916+ }))(function () {
1917+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.ec(alg)(Crypto_Subtle_Constants_EC.p384))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1918+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - P-384"))(function () {
1919+ return log$prime(v);
1920+ });
1921+ }))(function () {
1922+ return Control_Bind.bind(Effect_Aff.bindAff)(Crypto_Subtle_Key_Generate.generateKey(Crypto_Subtle_Key_Generate.ec(alg)(Crypto_Subtle_Constants_EC.p521))(true)(Crypto_Subtle_Key_Types.allUsages))(function (v) {
1923+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime(" - P-521"))(function () {
1924+ return log$prime(v);
1925+ });
1926+ });
1927+ });
1928+ });
1929+ };
1930+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("- ECDSA"))(function () {
1931+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(genEC(Crypto_Subtle_Constants_EC.ecdsa))(function () {
1932+ return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(log$prime("- ECDH"))(function () {
1933+ return genEC(Crypto_Subtle_Constants_EC.ecdh);
1934+ });
1935+ });
1936+ });
1937+ });
1938+ });
1939+ }));
1940+ })();
1941+ exports["main"] = main;
1942+ exports["log'"] = log$prime;
1943+})(PS["Test.Main"] = PS["Test.Main"] || {});
1944+PS["Test.Main"].main();