git.iko.soy/rowtype-yoga/psfp
on d37fadc help sign in
71 lines 2.3 kB history raw
1// Generated by purs version 0.13.6
2"use strict";
3var Control_Applicative = require("../Control.Applicative/index.js");
4var Control_Apply = require("../Control.Apply/index.js");
5var Data_Functor = require("../Data.Functor/index.js");
6var Left = (function () {
7 function Left(value0) {
8 this.value0 = value0;
9 };
10 Left.create = function (value0) {
11 return new Left(value0);
12 };
13 return Left;
14})();
15var Right = (function () {
16 function Right(value0) {
17 this.value0 = value0;
18 };
19 Right.create = function (value0) {
20 return new Right(value0);
21 };
22 return Right;
23})();
24var functorEither = new Data_Functor.Functor(function (f) {
25 return function (m) {
26 if (m instanceof Left) {
27 return new Left(m.value0);
28 };
29 if (m instanceof Right) {
30 return new Right(f(m.value0));
31 };
32 throw new Error("Failed pattern match at Data.Either (line 38, column 1 - line 38, column 52): " + [ m.constructor.name ]);
33 };
34});
35var either = function (v) {
36 return function (v1) {
37 return function (v2) {
38 if (v2 instanceof Left) {
39 return v(v2.value0);
40 };
41 if (v2 instanceof Right) {
42 return v1(v2.value0);
43 };
44 throw new Error("Failed pattern match at Data.Either (line 238, column 1 - line 238, column 64): " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
45 };
46 };
47};
48var applyEither = new Control_Apply.Apply(function ($dollar__unused) {
49 return functorEither;
50}, function (v) {
51 return function (v1) {
52 if (v instanceof Left) {
53 return new Left(v.value0);
54 };
55 if (v instanceof Right) {
56 return Data_Functor.map(functorEither)(v.value0)(v1);
57 };
58 throw new Error("Failed pattern match at Data.Either (line 82, column 1 - line 84, column 30): " + [ v.constructor.name, v1.constructor.name ]);
59 };
60});
61var applicativeEither = new Control_Applicative.Applicative(function ($dollar__unused) {
62 return applyEither;
63}, Right.create);
64module.exports = {
65 Left: Left,
66 Right: Right,
67 either: either,
68 functorEither: functorEither,
69 applyEither: applyEither,
70 applicativeEither: applicativeEither
71};