1// Generated by purs version 0.15.16
2import * as Control_Alt from "../Control.Alt/index.js";
3import * as Control_Applicative from "../Control.Applicative/index.js";
4import * as Control_Apply from "../Control.Apply/index.js";
5import * as Control_Category from "../Control.Category/index.js";
6import * as Data_Bounded from "../Data.Bounded/index.js";
7import * as Data_Eq from "../Data.Eq/index.js";
8import * as Data_Function from "../Data.Function/index.js";
9import * as Data_Functor from "../Data.Functor/index.js";
10import * as Data_Functor_Invariant from "../Data.Functor.Invariant/index.js";
11import * as Data_Generic_Rep from "../Data.Generic.Rep/index.js";
12import * as Data_Ord from "../Data.Ord/index.js";
13import * as Data_Ordering from "../Data.Ordering/index.js";
14import * as Data_Semigroup from "../Data.Semigroup/index.js";
15import * as Data_Semiring from "../Data.Semiring/index.js";
16import * as Data_Show from "../Data.Show/index.js";
17import * as Data_Unit from "../Data.Unit/index.js";
18var identity = /* #__PURE__ */ Control_Category.identity(Control_Category.categoryFn);
19var Nothing = /* #__PURE__ */ (function () {
23 Nothing.value = new Nothing();
26var Just = /* #__PURE__ */ (function () {
27 function Just(value0) {
30 Just.create = function (value0) {
31 return new Just(value0);
35var showMaybe = function (dictShow) {
36 var show = Data_Show.show(dictShow);
39 if (v instanceof Just) {
40 return "(Just " + (show(v.value0) + ")");
42 if (v instanceof Nothing) {
45 throw new Error("Failed pattern match at Data.Maybe (line 223, column 1 - line 225, column 28): " + [ v.constructor.name ]);
49var semigroupMaybe = function (dictSemigroup) {
50 var append1 = Data_Semigroup.append(dictSemigroup);
52 append: function (v) {
53 return function (v1) {
54 if (v instanceof Nothing) {
57 if (v1 instanceof Nothing) {
60 if (v instanceof Just && v1 instanceof Just) {
61 return new Just(append1(v.value0)(v1.value0));
63 throw new Error("Failed pattern match at Data.Maybe (line 182, column 1 - line 185, column 43): " + [ v.constructor.name, v1.constructor.name ]);
68var optional = function (dictAlt) {
69 var alt = Control_Alt.alt(dictAlt);
70 var map1 = Data_Functor.map(dictAlt.Functor0());
71 return function (dictApplicative) {
72 var pure = Control_Applicative.pure(dictApplicative);
74 return alt(map1(Just.create)(a))(pure(Nothing.value));
78var monoidMaybe = function (dictSemigroup) {
79 var semigroupMaybe1 = semigroupMaybe(dictSemigroup);
81 mempty: Nothing.value,
82 Semigroup0: function () {
83 return semigroupMaybe1;
87var maybe$prime = function (v) {
88 return function (v1) {
89 return function (v2) {
90 if (v2 instanceof Nothing) {
91 return v(Data_Unit.unit);
93 if (v2 instanceof Just) {
96 throw new Error("Failed pattern match at Data.Maybe (line 250, column 1 - line 250, column 62): " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
100var maybe = function (v) {
101 return function (v1) {
102 return function (v2) {
103 if (v2 instanceof Nothing) {
106 if (v2 instanceof Just) {
107 return v1(v2.value0);
109 throw new Error("Failed pattern match at Data.Maybe (line 237, column 1 - line 237, column 51): " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
113var isNothing = /* #__PURE__ */ maybe(true)(/* #__PURE__ */ Data_Function["const"](false));
114var isJust = /* #__PURE__ */ maybe(false)(/* #__PURE__ */ Data_Function["const"](true));
117 if (x instanceof Data_Generic_Rep.Inl) {
118 return Nothing.value;
120 if (x instanceof Data_Generic_Rep.Inr) {
121 return new Just(x.value0);
123 throw new Error("Failed pattern match at Data.Maybe (line 227, column 1 - line 227, column 52): " + [ x.constructor.name ]);
126 if (x instanceof Nothing) {
127 return new Data_Generic_Rep.Inl(Data_Generic_Rep.NoArguments.value);
129 if (x instanceof Just) {
130 return new Data_Generic_Rep.Inr(x.value0);
132 throw new Error("Failed pattern match at Data.Maybe (line 227, column 1 - line 227, column 52): " + [ x.constructor.name ]);
137 return function (v1) {
138 if (v1 instanceof Just) {
139 return new Just(v(v1.value0));
141 return Nothing.value;
145var map = /* #__PURE__ */ Data_Functor.map(functorMaybe);
146var invariantMaybe = {
147 imap: /* #__PURE__ */ Data_Functor_Invariant.imapF(functorMaybe)
149var fromMaybe$prime = function (a) {
150 return maybe$prime(a)(identity);
152var fromMaybe = function (a) {
153 return maybe(a)(identity);
155var fromJust = function () {
156 return function (v) {
157 if (v instanceof Just) {
160 throw new Error("Failed pattern match at Data.Maybe (line 288, column 1 - line 288, column 46): " + [ v.constructor.name ]);
164 extend: function (v) {
165 return function (v1) {
166 if (v1 instanceof Nothing) {
167 return Nothing.value;
169 return new Just(v(v1));
172 Functor0: function () {
176var eqMaybe = function (dictEq) {
177 var eq = Data_Eq.eq(dictEq);
180 return function (y) {
181 if (x instanceof Nothing && y instanceof Nothing) {
184 if (x instanceof Just && y instanceof Just) {
185 return eq(x.value0)(y.value0);
192var ordMaybe = function (dictOrd) {
193 var compare = Data_Ord.compare(dictOrd);
194 var eqMaybe1 = eqMaybe(dictOrd.Eq0());
196 compare: function (x) {
197 return function (y) {
198 if (x instanceof Nothing && y instanceof Nothing) {
199 return Data_Ordering.EQ.value;
201 if (x instanceof Nothing) {
202 return Data_Ordering.LT.value;
204 if (y instanceof Nothing) {
205 return Data_Ordering.GT.value;
207 if (x instanceof Just && y instanceof Just) {
208 return compare(x.value0)(y.value0);
210 throw new Error("Failed pattern match at Data.Maybe (line 0, column 0 - line 0, column 0): " + [ x.constructor.name, y.constructor.name ]);
219 eq1: function (dictEq) {
220 return Data_Eq.eq(eqMaybe(dictEq));
224 compare1: function (dictOrd) {
225 return Data_Ord.compare(ordMaybe(dictOrd));
231var boundedMaybe = function (dictBounded) {
232 var ordMaybe1 = ordMaybe(dictBounded.Ord0());
234 top: new Just(Data_Bounded.top(dictBounded)),
235 bottom: Nothing.value,
242 apply: function (v) {
243 return function (v1) {
244 if (v instanceof Just) {
245 return map(v.value0)(v1);
247 if (v instanceof Nothing) {
248 return Nothing.value;
250 throw new Error("Failed pattern match at Data.Maybe (line 67, column 1 - line 69, column 30): " + [ v.constructor.name, v1.constructor.name ]);
253 Functor0: function () {
257var apply = /* #__PURE__ */ Control_Apply.apply(applyMaybe);
260 return function (v1) {
261 if (v instanceof Just) {
264 if (v instanceof Nothing) {
265 return Nothing.value;
267 throw new Error("Failed pattern match at Data.Maybe (line 125, column 1 - line 127, column 28): " + [ v.constructor.name, v1.constructor.name ]);
270 Apply0: function () {
274var semiringMaybe = function (dictSemiring) {
275 var add = Data_Semiring.add(dictSemiring);
276 var mul = Data_Semiring.mul(dictSemiring);
279 one: new Just(Data_Semiring.one(dictSemiring)),
281 return function (v1) {
282 if (v instanceof Nothing) {
285 if (v1 instanceof Nothing) {
288 if (v instanceof Just && v1 instanceof Just) {
289 return new Just(add(v.value0)(v1.value0));
291 throw new Error("Failed pattern match at Data.Maybe (line 190, column 1 - line 198, column 28): " + [ v.constructor.name, v1.constructor.name ]);
295 return function (y) {
296 return apply(map(mul)(x))(y);
301var applicativeMaybe = /* #__PURE__ */ (function () {
304 Apply0: function () {
310 Applicative0: function () {
311 return applicativeMaybe;
319 return function (v1) {
320 if (v instanceof Nothing) {
326 Functor0: function () {
330var plusMaybe = /* #__PURE__ */ (function () {
332 empty: Nothing.value,
338var alternativeMaybe = {
339 Applicative0: function () {
340 return applicativeMaybe;
378//# sourceMappingURL=index.js.map
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list