1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.atRecord = exports.atReadonlySet = exports.atReadonlyMap = exports.atReadonlyRecord = exports.fromIso = exports.at = void 0;
|
4 | var O = require("fp-ts/lib/Option");
|
5 | var pipeable_1 = require("fp-ts/lib/pipeable");
|
6 | var RM = require("fp-ts/lib/ReadonlyMap");
|
7 | var RS = require("fp-ts/lib/ReadonlySet");
|
8 | var _ = require("./internal");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | exports.at = _.at;
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var fromIso = function (iso) { return function (sia) {
|
24 | return (0, exports.at)(function (i) { return (0, pipeable_1.pipe)(iso, _.isoAsLens, _.lensComposeLens(sia.at(i))); });
|
25 | }; };
|
26 | exports.fromIso = fromIso;
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | exports.atReadonlyRecord = _.atReadonlyRecord;
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | var atReadonlyMap = function (E) {
|
37 | var lookupE = RM.lookup(E);
|
38 | var deleteAtE = RM.deleteAt(E);
|
39 | var insertAtE = RM.insertAt(E);
|
40 | return function () {
|
41 | return (0, exports.at)(function (key) {
|
42 | return _.lens(function (s) { return lookupE(key, s); }, O.fold(function () { return deleteAtE(key); }, function (a) { return insertAtE(key, a); }));
|
43 | });
|
44 | };
|
45 | };
|
46 | exports.atReadonlyMap = atReadonlyMap;
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | var atReadonlySet = function (E) {
|
52 | var elemE = RS.elem(E);
|
53 | var insertE = RS.insert(E);
|
54 | var removeE = RS.remove(E);
|
55 | return (0, exports.at)(function (a) {
|
56 | var insert = insertE(a);
|
57 | var remove = removeE(a);
|
58 | return _.lens(function (s) { return elemE(a, s); }, function (b) { return function (s) { return (b ? insert(s) : remove(s)); }; });
|
59 | });
|
60 | };
|
61 | exports.atReadonlySet = atReadonlySet;
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | exports.atRecord = _.atReadonlyRecord;
|