git.iko.soy/rowtype-yoga/purescript-lunapark
on main help sign in
28 files changed+3468−6420
since splitsnapshots
unifiedsplit
.github/workflows/ci.yml+37 .gitignore+1−2 LICENSE+201 README.md+56 bower.json−15 ch.exe edgedriver.exe gk.exe index.js−4569 package.json−22 selenium-3.11.0.jar spago.lock+1712 spago.yaml+41 src/Lunapark.purs+14−8 src/Lunapark/API.purs+478−837 src/Lunapark/ActionF.purs+79 src/Lunapark/Affjax.purs−378 src/Lunapark/Endpoint.purs+40−28 src/Lunapark/Error.purs+36−118 src/Lunapark/Helpers.purs−162 src/Lunapark/LunaparkF.purs+237 src/Lunapark/Starter.purs−32 src/Lunapark/Types.purs+194−147 src/Lunapark/UnicodeCharacters.purs+177 src/Lunapark/Utils.purs+36 src/Lunapark/WebDriverError.purs+117 src/Main.purs−102 test/Test/Main.purs+12
.github/workflows/ci.ymlnew file+37
@@ -0,0 +1,37 @@
1+name: CI
2+
3+on:
4+ push:
5+ branches: [master, main]
6+ pull_request:
7+ branches: [master, main]
8+
9+jobs:
10+ build:
11+ runs-on: ubuntu-latest
12+ steps:
13+ - uses: actions/checkout@v4
14+
15+ - name: Set up a PureScript toolchain
16+ uses: purescript-contrib/setup-purescript@main
17+ with:
18+ purescript: "latest"
19+ purs-tidy: "latest"
20+ spago: "unstable"
21+
22+ - name: Cache PureScript dependencies
23+ uses: actions/cache@v4
24+ with:
25+ key: ${{ runner.os }}-spago-${{ hashFiles('**/spago.lock') }}
26+ path: |
27+ .spago
28+ output
29+
30+ - name: Build source
31+ run: spago build --censor-stats --strict --pedantic-packages
32+
33+ - name: Run tests
34+ run: spago test --offline --censor-stats --strict --pedantic-packages -- --censor-codes=UserDefinedWarning
35+
36+ - name: Verify formatting
37+ run: purs-tidy check src test
.gitignore+1−2
@@ -1,8 +1,7 @@
11/.*
22!/.gitignore
3−!/.travis.yml
3+!/.github
44/bower_components/
55/node_modules/
66/output/
7−/example/dist/test.js
87package-lock.json
LICENSEnew file+201
@@ -0,0 +1,201 @@
1+ Apache License
2+ Version 2.0, January 2004
3+ http://www.apache.org/licenses/
4+
5+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+ 1. Definitions.
8+
9+ "License" shall mean the terms and conditions for use, reproduction,
10+ and distribution as defined by Sections 1 through 9 of this document.
11+
12+ "Licensor" shall mean the copyright owner or entity authorized by
13+ the copyright owner that is granting the License.
14+
15+ "Legal Entity" shall mean the union of the acting entity and all
16+ other entities that control, are controlled by, or are under common
17+ control with that entity. For the purposes of this definition,
18+ "control" means (i) the power, direct or indirect, to cause the
19+ direction or management of such entity, whether by contract or
20+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21+ outstanding shares, or (iii) beneficial ownership of such entity.
22+
23+ "You" (or "Your") shall mean an individual or Legal Entity
24+ exercising permissions granted by this License.
25+
26+ "Source" form shall mean the preferred form for making modifications,
27+ including but not limited to software source code, documentation
28+ source, and configuration files.
29+
30+ "Object" form shall mean any form resulting from mechanical
31+ transformation or translation of a Source form, including but
32+ not limited to compiled object code, generated documentation,
33+ and conversions to other media types.
34+
35+ "Work" shall mean the work of authorship, whether in Source or
36+ Object form, made available under the License, as indicated by a
37+ copyright notice that is included in or attached to the work
38+ (an example is provided in the Appendix below).
39+
40+ "Derivative Works" shall mean any work, whether in Source or Object
41+ form, that is based on (or derived from) the Work and for which the
42+ editorial revisions, annotations, elaborations, or other modifications
43+ represent, as a whole, an original work of authorship. For the purposes
44+ of this License, Derivative Works shall not include works that remain
45+ separable from, or merely link (or bind by name) to the interfaces of,
46+ the Work and Derivative Works thereof.
47+
48+ "Contribution" shall mean any work of authorship, including
49+ the original version of the Work and any modifications or additions
50+ to that Work or Derivative Works thereof, that is intentionally
51+ submitted to Licensor for inclusion in the Work by the copyright owner
52+ or by an individual or Legal Entity authorized to submit on behalf of
53+ the copyright owner. For the purposes of this definition, "submitted"
54+ means any form of electronic, verbal, or written communication sent
55+ to the Licensor or its representatives, including but not limited to
56+ communication on electronic mailing lists, source code control systems,
57+ and issue tracking systems that are managed by, or on behalf of, the
58+ Licensor for the purpose of discussing and improving the Work, but
59+ excluding communication that is conspicuously marked or otherwise
60+ designated in writing by the copyright owner as "Not a Contribution."
61+
62+ "Contributor" shall mean Licensor and any individual or Legal Entity
63+ on behalf of whom a Contribution has been received by Licensor and
64+ subsequently incorporated within the Work.
65+
66+ 2. Grant of Copyright License. Subject to the terms and conditions of
67+ this License, each Contributor hereby grants to You a perpetual,
68+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69+ copyright license to reproduce, prepare Derivative Works of,
70+ publicly display, publicly perform, sublicense, and distribute the
71+ Work and such Derivative Works in Source or Object form.
72+
73+ 3. Grant of Patent License. Subject to the terms and conditions of
74+ this License, each Contributor hereby grants to You a perpetual,
75+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76+ (except as stated in this section) patent license to make, have made,
77+ use, offer to sell, sell, import, and otherwise transfer the Work,
78+ where such license applies only to those patent claims licensable
79+ by such Contributor that are necessarily infringed by their
80+ Contribution(s) alone or by combination of their Contribution(s)
81+ with the Work to which such Contribution(s) was submitted. If You
82+ institute patent litigation against any entity (including a
83+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84+ or a Contribution incorporated within the Work constitutes direct
85+ or contributory patent infringement, then any patent licenses
86+ granted to You under this License for that Work shall terminate
87+ as of the date such litigation is filed.
88+
89+ 4. Redistribution. You may reproduce and distribute copies of the
90+ Work or Derivative Works thereof in any medium, with or without
91+ modifications, and in Source or Object form, provided that You
92+ meet the following conditions:
93+
94+ (a) You must give any other recipients of the Work or
95+ Derivative Works a copy of this License; and
96+
97+ (b) You must cause any modified files to carry prominent notices
98+ stating that You changed the files; and
99+
100+ (c) You must retain, in the Source form of any Derivative Works
101+ that You distribute, all copyright, patent, trademark, and
102+ attribution notices from the Source form of the Work,
103+ excluding those notices that do not pertain to any part of
104+ the Derivative Works; and
105+
106+ (d) If the Work includes a "NOTICE" text file as part of its
107+ distribution, then any Derivative Works that You distribute must
108+ include a readable copy of the attribution notices contained
109+ within such NOTICE file, excluding those notices that do not
110+ pertain to any part of the Derivative Works, in at least one
111+ of the following places: within a NOTICE text file distributed
112+ as part of the Derivative Works; within the Source form or
113+ documentation, if provided along with the Derivative Works; or,
114+ within a display generated by the Derivative Works, if and
115+ wherever such third-party notices normally appear. The contents
116+ of the NOTICE file are for informational purposes only and
117+ do not modify the License. You may add Your own attribution
118+ notices within Derivative Works that You distribute, alongside
119+ or as an addendum to the NOTICE text from the Work, provided
120+ that such additional attribution notices cannot be construed
121+ as modifying the License.
122+
123+ You may add Your own copyright statement to Your modifications and
124+ may provide additional or different license terms and conditions
125+ for use, reproduction, or distribution of Your modifications, or
126+ for any such Derivative Works as a whole, provided Your use,
127+ reproduction, and distribution of the Work otherwise complies with
128+ the conditions stated in this License.
129+
130+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131+ any Contribution intentionally submitted for inclusion in the Work
132+ by You to the Licensor shall be under the terms and conditions of
133+ this License, without any additional terms or conditions.
134+ Notwithstanding the above, nothing herein shall supersede or modify
135+ the terms of any separate license agreement you may have executed
136+ with Licensor regarding such Contributions.
137+
138+ 6. Trademarks. This License does not grant permission to use the trade
139+ names, trademarks, service marks, or product names of the Licensor,
140+ except as required for reasonable and customary use in describing the
141+ origin of the Work and reproducing the content of the NOTICE file.
142+
143+ 7. Disclaimer of Warranty. Unless required by applicable law or
144+ agreed to in writing, Licensor provides the Work (and each
145+ Contributor provides its Contributions) on an "AS IS" BASIS,
146+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147+ implied, including, without limitation, any warranties or conditions
148+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149+ PARTICULAR PURPOSE. You are solely responsible for determining the
150+ appropriateness of using or redistributing the Work and assume any
151+ risks associated with Your exercise of permissions under this License.
152+
153+ 8. Limitation of Liability. In no event and under no legal theory,
154+ whether in tort (including negligence), contract, or otherwise,
155+ unless required by applicable law (such as deliberate and grossly
156+ negligent acts) or agreed to in writing, shall any Contributor be
157+ liable to You for damages, including any direct, indirect, special,
158+ incidental, or consequential damages of any character arising as a
159+ result of this License or out of the use or inability to use the
160+ Work (including but not limited to damages for loss of goodwill,
161+ work stoppage, computer failure or malfunction, or any and all
162+ other commercial damages or losses), even if such Contributor
163+ has been advised of the possibility of such damages.
164+
165+ 9. Accepting Warranty or Additional Liability. While redistributing
166+ the Work or Derivative Works thereof, You may choose to offer,
167+ and charge a fee for, acceptance of support, warranty, indemnity,
168+ or other liability obligations and/or rights consistent with this
169+ License. However, in accepting such obligations, You may act only
170+ on Your own behalf and on Your sole responsibility, not on behalf
171+ of any other Contributor, and only if You agree to indemnify,
172+ defend, and hold each Contributor harmless for any liability
173+ incurred by, or claims asserted against, such Contributor by reason
174+ of your accepting any such warranty or additional liability.
175+
176+ END OF TERMS AND CONDITIONS
177+
178+ APPENDIX: How to apply the Apache License to your work.
179+
180+ To apply the Apache License to your work, attach the following
181+ boilerplate notice, with the fields enclosed by brackets "{}"
182+ replaced with your own identifying information. (Don't include
183+ the brackets!) The text should be enclosed in the appropriate
184+ comment syntax for the file format. We also recommend that a
185+ file or class name and description of purpose be included on the
186+ same "printed page" as the copyright notice for easier
187+ identification within third-party archives.
188+
189+ Copyright {yyyy} {name of copyright owner}
190+
191+ Licensed under the Apache License, Version 2.0 (the "License");
192+ you may not use this file except in compliance with the License.
193+ You may obtain a copy of the License at
194+
195+ http://www.apache.org/licenses/LICENSE-2.0
196+
197+ Unless required by applicable law or agreed to in writing, software
198+ distributed under the License is distributed on an "AS IS" BASIS,
199+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200+ See the License for the specific language governing permissions and
201+ limitations under the License.
README.mdnew file+56
@@ -0,0 +1,56 @@
1+# purescript-lunapark
2+
3+[![Latest release](http://img.shields.io/github/release/slamdata/purescript-lunapark.svg)](https://github.com/slamdata/purescript-lunapark/releases)
4+![Build Status](https://github.com/slamdata/purescript-lunapark/actions/workflows/ci.yml/badge.svg)
5+
6+## Disclaimer
7+
8+Webdriver/JsonWire bindings for PureScript
9+
10+- This is WIP: some things weren't implemented, some might have bugs. Filling issues and prs are welcomed!
11+
12+## Purescript W3C webdriver protocol bindings
13+
14+The main purpose of this library is to provide purescript webdriver/json-wire protocol bindings, such that
15+won't involve any JavaScript dependencies.
16+
17+## Architecture
18+
19+- There is a module that encodes any possible error returned by Selenium.
20+- Low-level API uses `purescript-argonaut`'s `Json` type and `purescript-affjax`s helper functions (`get`, `post` etc)
21+- Endpoints are constructed using `Endpoint@Lunapark.Endpoint` type. This module also provides helper functions
22+ returning `Aff (Either Error Json)`
23+- Types of requests and resposes live in `Lunapark.Types` module.
24+- High-level API uses `purescript-run`. There are several functors, but the main two are: `LunaparkF` and `ActionF`.
25+ This functor embed in `Run` encode almost all posible interactions with w3c/selenium server.
26+- At first `ActionF` functor (that is a functor that encodes all posible actions like click, hover) is interpreted to
27+ `LunaparkF`, then `LunaparkF` is interpreted into `Run` with `EXCEPT` and `AFF|EFF` effects.
28+- `Lunapark` is facade library on top of api, functors and error.
29+- Capabilities are represented via gradually typed datastructure `Array Capability`. `init` function takes a record
30+ `{ alwaysMatch: Array Capability, firstMatch: Array (Array Capability) }`. `firstMatch` must have at least on array.
31+- To construct interpreter you need call `init@Lunapark.API`. The result would be `Aff (Either Error Interpreter)`,
32+ where `Interpreter` is function taking `Lunapark` monad and unwrapping it into `Run` with `EXCEPT` and `AFF|EFF`. E.g.
33+
34+```purescript
35+main = launchAff do
36+ interpreterOrError ← init "http://localhost:4444/wd/hub" { alwaysMatch: [], firstMatch: [[BrowserName Chrome]] }
37+ case intepreterOrError of
38+ Left err → throwError $ error "An error during selenium session initialization occured"
39+ Right interpret → Run.runBaseAff' $ Run.runExcept $ interpret do
40+ go "http://my-site.com"
41+ el ← findElement $ ByCss $ CSS.fromString ".my-class"
42+ clickEl el
43+ login ← findElement $ ByCss $ CSS.fromString "#login"
44+ password ← findElement $ ByCss $ CSS.fromString "#password"
45+ moveTo { origin: login, x: 0, y: 0, duration: Milliseconds 1000.0 }
46+ click
47+ sendKeys "login"
48+ moveTo { origin: password, x: 0, y: 0, duration: Milliseconds 100.0 }
49+ sendKeys "secret"
50+ sendKeys "\\xE007"
51+```
52+
53+- The interpreter takes care about implemented and non-implemented features of particular driver. E.g. if driver supports
54+ `GET@/session/:sessionId/timeouts` via W3C standard it will use it otherwise the interpreter makes it a chain call of
55+ JsonWire commands. The same works for actions: they are interpreted into either `POST@/session/:sessionId/action` or
56+ chains of JsonWire commands.
bower.jsondeleted−15
@@ -1,15 +0,0 @@
1−{
2− "name": "purescript-lunapark",
3− "dependencies": {
4− "purescript-affjax": "^5.0.0",
5− "purescript-debug": "^3.0.0",
6− "purescript-codec-argonaut": "^5.0.0",
7− "purescript-argonaut": "^3.1.0",
8− "purescript-css": "^3.4.0",
9− "purescript-node-fs-aff": "^5.0.0",
10− "purescript-node-child-process": "^4.0.0",
11− "purescript-node-process": "^5.0.0",
12− "purescript-free": "^4.3.0",
13− "purescript-run": "^1.0.1"
14− }
15−}
ch.exedeleted

Binary file not shown.

edgedriver.exedeleted

Binary file not shown.

gk.exedeleted

Binary file not shown.

index.jsdeleted−4569
@@ -1,4569 +0,0 @@
1−// Generated by purs bundle 0.11.7
2−var PS = {};
3−(function(exports) {
4− "use strict";
5−
6− exports.arrayMap = function (f) {
7− return function (arr) {
8− var l = arr.length;
9− var result = new Array(l);
10− for (var i = 0; i < l; i++) {
11− result[i] = f(arr[i]);
12− }
13− return result;
14− };
15− };
16−})(PS["Data.Functor"] = PS["Data.Functor"] || {});
17−(function(exports) {
18− // Generated by purs version 0.11.7
19− "use strict";
20− var Semigroupoid = function (compose) {
21− this.compose = compose;
22− };
23− var semigroupoidFn = new Semigroupoid(function (f) {
24− return function (g) {
25− return function (x) {
26− return f(g(x));
27− };
28− };
29− });
30− var compose = function (dict) {
31− return dict.compose;
32− };
33− exports["compose"] = compose;
34− exports["Semigroupoid"] = Semigroupoid;
35− exports["semigroupoidFn"] = semigroupoidFn;
36−})(PS["Control.Semigroupoid"] = PS["Control.Semigroupoid"] || {});
37−(function(exports) {
38− // Generated by purs version 0.11.7
39− "use strict";
40− var Control_Semigroupoid = PS["Control.Semigroupoid"];
41− var Category = function (Semigroupoid0, id) {
42− this.Semigroupoid0 = Semigroupoid0;
43− this.id = id;
44− };
45− var id = function (dict) {
46− return dict.id;
47− };
48− var categoryFn = new Category(function () {
49− return Control_Semigroupoid.semigroupoidFn;
50− }, function (x) {
51− return x;
52− });
53− exports["Category"] = Category;
54− exports["id"] = id;
55− exports["categoryFn"] = categoryFn;
56−})(PS["Control.Category"] = PS["Control.Category"] || {});
57−(function(exports) {
58− // Generated by purs version 0.11.7
59− "use strict";
60− var Control_Category = PS["Control.Category"];
61− var on = function (f) {
62− return function (g) {
63− return function (x) {
64− return function (y) {
65− return f(g(x))(g(y));
66− };
67− };
68− };
69− };
70− var flip = function (f) {
71− return function (b) {
72− return function (a) {
73− return f(a)(b);
74− };
75− };
76− };
77− var $$const = function (a) {
78− return function (v) {
79− return a;
80− };
81− };
82− var applyFlipped = function (x) {
83− return function (f) {
84− return f(x);
85− };
86− };
87− exports["flip"] = flip;
88− exports["const"] = $$const;
89− exports["applyFlipped"] = applyFlipped;
90− exports["on"] = on;
91−})(PS["Data.Function"] = PS["Data.Function"] || {});
92−(function(exports) {
93− "use strict";
94−
95− exports.unit = {};
96−})(PS["Data.Unit"] = PS["Data.Unit"] || {});
97−(function(exports) {
98− "use strict";
99−
100− exports.showIntImpl = function (n) {
101− return n.toString();
102− };
103−
104− exports.showStringImpl = function (s) {
105− var l = s.length;
106− return "\"" + s.replace(
107− /[\0-\x1F\x7F"\\]/g, // eslint-disable-line no-control-regex
108− function (c, i) {
109− switch (c) {
110− case "\"":
111− case "\\":
112− return "\\" + c;
113− case "\x07": return "\\a";
114− case "\b": return "\\b";
115− case "\f": return "\\f";
116− case "\n": return "\\n";
117− case "\r": return "\\r";
118− case "\t": return "\\t";
119− case "\v": return "\\v";
120− }
121− var k = i + 1;
122− var empty = k < l && s[k] >= "0" && s[k] <= "9" ? "\\&" : "";
123− return "\\" + c.charCodeAt(0).toString(10) + empty;
124− }
125− ) + "\"";
126− };
127−})(PS["Data.Show"] = PS["Data.Show"] || {});
128−(function(exports) {
129− // Generated by purs version 0.11.7
130− "use strict";
131− var $foreign = PS["Data.Show"];
132− var Show = function (show) {
133− this.show = show;
134− };
135− var showString = new Show($foreign.showStringImpl);
136− var showInt = new Show($foreign.showIntImpl);
137− var show = function (dict) {
138− return dict.show;
139− };
140− exports["Show"] = Show;
141− exports["show"] = show;
142− exports["showInt"] = showInt;
143− exports["showString"] = showString;
144−})(PS["Data.Show"] = PS["Data.Show"] || {});
145−(function(exports) {
146− // Generated by purs version 0.11.7
147− "use strict";
148− var $foreign = PS["Data.Unit"];
149− var Data_Show = PS["Data.Show"];
150− exports["unit"] = $foreign.unit;
151−})(PS["Data.Unit"] = PS["Data.Unit"] || {});
152−(function(exports) {
153− // Generated by purs version 0.11.7
154− "use strict";
155− var $foreign = PS["Data.Functor"];
156− var Control_Semigroupoid = PS["Control.Semigroupoid"];
157− var Data_Function = PS["Data.Function"];
158− var Data_Unit = PS["Data.Unit"];
159− var Functor = function (map) {
160− this.map = map;
161− };
162− var map = function (dict) {
163− return dict.map;
164− };
165− var $$void = function (dictFunctor) {
166− return map(dictFunctor)(Data_Function["const"](Data_Unit.unit));
167− };
168− var functorFn = new Functor(Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn));
169− var functorArray = new Functor($foreign.arrayMap);
170− exports["Functor"] = Functor;
171− exports["map"] = map;
172− exports["void"] = $$void;
173− exports["functorFn"] = functorFn;
174− exports["functorArray"] = functorArray;
175−})(PS["Data.Functor"] = PS["Data.Functor"] || {});
176−(function(exports) {
177− "use strict";
178−
179− exports.concatString = function (s1) {
180− return function (s2) {
181− return s1 + s2;
182− };
183− };
184−})(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
185−(function(exports) {
186− // Generated by purs version 0.11.7
187− "use strict";
188− var $foreign = PS["Data.Semigroup"];
189− var Data_Unit = PS["Data.Unit"];
190− var Data_Void = PS["Data.Void"];
191− var Semigroup = function (append) {
192− this.append = append;
193− };
194− var semigroupString = new Semigroup($foreign.concatString);
195− var append = function (dict) {
196− return dict.append;
197− };
198− exports["Semigroup"] = Semigroup;
199− exports["append"] = append;
200− exports["semigroupString"] = semigroupString;
201−})(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
202−(function(exports) {
203− // Generated by purs version 0.11.7
204− "use strict";
205− var Data_Functor = PS["Data.Functor"];
206− var Data_Semigroup = PS["Data.Semigroup"];
207− var Alt = function (Functor0, alt) {
208− this.Functor0 = Functor0;
209− this.alt = alt;
210− };
211− var alt = function (dict) {
212− return dict.alt;
213− };
214− exports["Alt"] = Alt;
215− exports["alt"] = alt;
216−})(PS["Control.Alt"] = PS["Control.Alt"] || {});
217−(function(exports) {
218− // Generated by purs version 0.11.7
219− "use strict";
220− var $foreign = PS["Control.Apply"];
221− var Control_Category = PS["Control.Category"];
222− var Data_Function = PS["Data.Function"];
223− var Data_Functor = PS["Data.Functor"];
224− var Apply = function (Functor0, apply) {
225− this.Functor0 = Functor0;
226− this.apply = apply;
227− };
228− var apply = function (dict) {
229− return dict.apply;
230− };
231− var applySecond = function (dictApply) {
232− return function (a) {
233− return function (b) {
234− return apply(dictApply)(Data_Functor.map(dictApply.Functor0())(Data_Function["const"](Control_Category.id(Control_Category.categoryFn)))(a))(b);
235− };
236− };
237− };
238− exports["Apply"] = Apply;
239− exports["apply"] = apply;
240− exports["applySecond"] = applySecond;
241−})(PS["Control.Apply"] = PS["Control.Apply"] || {});
242−(function(exports) {
243− // Generated by purs version 0.11.7
244− "use strict";
245− var Control_Apply = PS["Control.Apply"];
246− var Data_Functor = PS["Data.Functor"];
247− var Data_Unit = PS["Data.Unit"];
248− var Applicative = function (Apply0, pure) {
249− this.Apply0 = Apply0;
250− this.pure = pure;
251− };
252− var pure = function (dict) {
253− return dict.pure;
254− };
255− var liftA1 = function (dictApplicative) {
256− return function (f) {
257− return function (a) {
258− return Control_Apply.apply(dictApplicative.Apply0())(pure(dictApplicative)(f))(a);
259− };
260− };
261− };
262− exports["Applicative"] = Applicative;
263− exports["pure"] = pure;
264− exports["liftA1"] = liftA1;
265−})(PS["Control.Applicative"] = PS["Control.Applicative"] || {});
266−(function(exports) {
267− // Generated by purs version 0.11.7
268− "use strict";
269− var $foreign = PS["Control.Bind"];
270− var Control_Applicative = PS["Control.Applicative"];
271− var Control_Apply = PS["Control.Apply"];
272− var Control_Category = PS["Control.Category"];
273− var Data_Function = PS["Data.Function"];
274− var Data_Functor = PS["Data.Functor"];
275− var Data_Unit = PS["Data.Unit"];
276− var Bind = function (Apply0, bind) {
277− this.Apply0 = Apply0;
278− this.bind = bind;
279− };
280− var Discard = function (discard) {
281− this.discard = discard;
282− };
283− var discard = function (dict) {
284− return dict.discard;
285− };
286− var bind = function (dict) {
287− return dict.bind;
288− };
289− var bindFlipped = function (dictBind) {
290− return Data_Function.flip(bind(dictBind));
291− };
292− var composeKleisliFlipped = function (dictBind) {
293− return function (f) {
294− return function (g) {
295− return function (a) {
296− return bindFlipped(dictBind)(f)(g(a));
297− };
298− };
299− };
300− };
301− var discardUnit = new Discard(function (dictBind) {
302− return bind(dictBind);
303− });
304− exports["Bind"] = Bind;
305− exports["bind"] = bind;
306− exports["bindFlipped"] = bindFlipped;
307− exports["Discard"] = Discard;
308− exports["discard"] = discard;
309− exports["composeKleisliFlipped"] = composeKleisliFlipped;
310− exports["discardUnit"] = discardUnit;
311−})(PS["Control.Bind"] = PS["Control.Bind"] || {});
312−(function(exports) {
313− // Generated by purs version 0.11.7
314− "use strict";
315− var Control_Applicative = PS["Control.Applicative"];
316− var Control_Apply = PS["Control.Apply"];
317− var Control_Bind = PS["Control.Bind"];
318− var Data_Functor = PS["Data.Functor"];
319− var Data_Unit = PS["Data.Unit"];
320− var Monad = function (Applicative0, Bind1) {
321− this.Applicative0 = Applicative0;
322− this.Bind1 = Bind1;
323− };
324− var ap = function (dictMonad) {
325− return function (f) {
326− return function (a) {
327− return Control_Bind.bind(dictMonad.Bind1())(f)(function (v) {
328− return Control_Bind.bind(dictMonad.Bind1())(a)(function (v1) {
329− return Control_Applicative.pure(dictMonad.Applicative0())(v(v1));
330− });
331− });
332− };
333− };
334− };
335− exports["Monad"] = Monad;
336− exports["ap"] = ap;
337−})(PS["Control.Monad"] = PS["Control.Monad"] || {});
338−(function(exports) {
339− /* globals setImmediate, clearImmediate, setTimeout, clearTimeout */
340− /* jshint -W083, -W098, -W003 */
341− "use strict";
342−
343− var Aff = function () {
344− // A unique value for empty.
345− var EMPTY = {};
346−
347− /*
348−
349− An awkward approximation. We elide evidence we would otherwise need in PS for
350− efficiency sake.
351−
352− data Aff eff a
353− = Pure a
354− | Throw Error
355− | Catch (Aff eff a) (Error -> Aff eff a)
356− | Sync (Eff eff a)
357− | Async ((Either Error a -> Eff eff Unit) -> Eff eff (Canceler eff))
358− | forall b. Bind (Aff eff b) (b -> Aff eff a)
359− | forall b. Bracket (Aff eff b) (BracketConditions eff b) (b -> Aff eff a)
360− | forall b. Fork Boolean (Aff eff b) ?(Fiber eff b -> a)
361− | Sequential (ParAff aff a)
362−
363− */
364− var PURE = "Pure";
365− var THROW = "Throw";
366− var CATCH = "Catch";
367− var SYNC = "Sync";
368− var ASYNC = "Async";
369− var BIND = "Bind";
370− var BRACKET = "Bracket";
371− var FORK = "Fork";
372− var SEQ = "Sequential";
373−
374− /*
375−
376− data ParAff eff a
377− = forall b. Map (b -> a) (ParAff eff b)
378− | forall b. Apply (ParAff eff (b -> a)) (ParAff eff b)
379− | Alt (ParAff eff a) (ParAff eff a)
380− | ?Par (Aff eff a)
381−
382− */
383− var MAP = "Map";
384− var APPLY = "Apply";
385− var ALT = "Alt";
386−
387− // Various constructors used in interpretation
388− var CONS = "Cons"; // Cons-list, for stacks
389− var RESUME = "Resume"; // Continue indiscriminately
390− var RELEASE = "Release"; // Continue with bracket finalizers
391− var FINALIZER = "Finalizer"; // A non-interruptible effect
392− var FINALIZED = "Finalized"; // Marker for finalization
393− var FORKED = "Forked"; // Reference to a forked fiber, with resumption stack
394− var FIBER = "Fiber"; // Actual fiber reference
395− var THUNK = "Thunk"; // Primed effect, ready to invoke
396−
397− function Aff(tag, _1, _2, _3) {
398− this.tag = tag;
399− this._1 = _1;
400− this._2 = _2;
401− this._3 = _3;
402− }
403−
404− function AffCtr(tag) {
405− var fn = function (_1, _2, _3) {
406− return new Aff(tag, _1, _2, _3);
407− };
408− fn.tag = tag;
409− return fn;
410− }
411−
412− function nonCanceler(error) {
413− return new Aff(PURE, void 0);
414− }
415−
416− function runEff(eff) {
417− try {
418− eff();
419− } catch (error) {
420− setTimeout(function () {
421− throw error;
422− }, 0);
423− }
424− }
425−
426− function runSync(left, right, eff) {
427− try {
428− return right(eff());
429− } catch (error) {
430− return left(error);
431− }
432− }
433−
434− function runAsync(left, eff, k) {
435− try {
436− return eff(k)();
437− } catch (error) {
438− k(left(error))();
439− return nonCanceler;
440− }
441− }
442−
443− var Scheduler = function () {
444− var limit = 1024;
445− var size = 0;
446− var ix = 0;
447− var queue = new Array(limit);
448− var draining = false;
449−
450− function drain() {
451− var thunk;
452− draining = true;
453− while (size !== 0) {
454− size--;
455− thunk = queue[ix];
456− queue[ix] = void 0;
457− ix = (ix + 1) % limit;
458− thunk();
459− }
460− draining = false;
461− }
462−
463− return {
464− isDraining: function () {
465− return draining;
466− },
467− enqueue: function (cb) {
468− var i, tmp;
469− if (size === limit) {
470− tmp = draining;
471− drain();
472− draining = tmp;
473− }
474−
475− queue[(ix + size) % limit] = cb;
476− size++;
477−
478− if (!draining) {
479− drain();
480− }
481− }
482− };
483− }();
484−
485− function Supervisor(util) {
486− var fibers = {};
487− var fiberId = 0;
488− var count = 0;
489−
490− return {
491− register: function (fiber) {
492− var fid = fiberId++;
493− fiber.onComplete({
494− rethrow: true,
495− handler: function (result) {
496− return function () {
497− count--;
498− delete fibers[fid];
499− };
500− }
501− });
502− fibers[fid] = fiber;
503− count++;
504− },
505− isEmpty: function () {
506− return count === 0;
507− },
508− killAll: function (killError, cb) {
509− return function () {
510− var killCount = 0;
511− var kills = {};
512−
513− function kill(fid) {
514− kills[fid] = fibers[fid].kill(killError, function (result) {
515− return function () {
516− delete kills[fid];
517− killCount--;
518− if (util.isLeft(result) && util.fromLeft(result)) {
519− setTimeout(function () {
520− throw util.fromLeft(result);
521− }, 0);
522− }
523− if (killCount === 0) {
524− cb();
525− }
526− };
527− })();
528− }
529−
530− for (var k in fibers) {
531− if (fibers.hasOwnProperty(k)) {
532− killCount++;
533− kill(k);
534− }
535− }
536−
537− fibers = {};
538− fiberId = 0;
539− count = 0;
540−
541− return function (error) {
542− return new Aff(SYNC, function () {
543− for (var k in kills) {
544− if (kills.hasOwnProperty(k)) {
545− kills[k]();
546− }
547− }
548− });
549− };
550− };
551− }
552− };
553− }
554−
555− // Fiber state machine
556− var SUSPENDED = 0; // Suspended, pending a join.
557− var CONTINUE = 1; // Interpret the next instruction.
558− var STEP_BIND = 2; // Apply the next bind.
559− var STEP_RESULT = 3; // Handle potential failure from a result.
560− var PENDING = 4; // An async effect is running.
561− var RETURN = 5; // The current stack has returned.
562− var COMPLETED = 6; // The entire fiber has completed.
563−
564− function Fiber(util, supervisor, aff) {
565− // Monotonically increasing tick, increased on each asynchronous turn.
566− var runTick = 0;
567−
568− // The current branch of the state machine.
569− var status = SUSPENDED;
570−
571− // The current point of interest for the state machine branch.
572− var step = aff; // Successful step
573− var fail = null; // Failure step
574− var interrupt = null; // Asynchronous interrupt
575−
576− // Stack of continuations for the current fiber.
577− var bhead = null;
578− var btail = null;
579−
580− // Stack of attempts and finalizers for error recovery. Every `Cons` is also
581− // tagged with current `interrupt` state. We use this to track which items
582− // should be ignored or evaluated as a result of a kill.
583− var attempts = null;
584−
585− // A special state is needed for Bracket, because it cannot be killed. When
586− // we enter a bracket acquisition or finalizer, we increment the counter,
587− // and then decrement once complete.
588− var bracketCount = 0;
589−
590− // Each join gets a new id so they can be revoked.
591− var joinId = 0;
592− var joins = null;
593− var rethrow = true;
594−
595− // Each invocation of `run` requires a tick. When an asynchronous effect is
596− // resolved, we must check that the local tick coincides with the fiber
597− // tick before resuming. This prevents multiple async continuations from
598− // accidentally resuming the same fiber. A common example may be invoking
599− // the provided callback in `makeAff` more than once, but it may also be an
600− // async effect resuming after the fiber was already cancelled.
601− function run(localRunTick) {
602− var tmp, result, attempt, canceler;
603− while (true) {
604− tmp = null;
605− result = null;
606− attempt = null;
607− canceler = 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− status = STEP_RESULT;
670− step = result;
671− run(runTick);
672− });
673− };
674− });
675− return;
676−
677− case THROW:
678− status = RETURN;
679− fail = util.left(step._1);
680− step = null;
681− break;
682−
683− // Enqueue the Catch so that we can call the error handler later on
684− // in case of an exception.
685− case CATCH:
686− if (bhead === null) {
687− attempts = new Aff(CONS, step, attempts, interrupt);
688− } else {
689− attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
690− }
691− bhead = null;
692− btail = null;
693− status = CONTINUE;
694− step = step._1;
695− break;
696−
697− // Enqueue the Bracket so that we can call the appropriate handlers
698− // after resource acquisition.
699− case BRACKET:
700− bracketCount++;
701− if (bhead === null) {
702− attempts = new Aff(CONS, step, attempts, interrupt);
703− } else {
704− attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
705− }
706− bhead = null;
707− btail = null;
708− status = CONTINUE;
709− step = step._1;
710− break;
711−
712− case FORK:
713− status = STEP_BIND;
714− tmp = Fiber(util, supervisor, step._2);
715− if (supervisor) {
716− supervisor.register(tmp);
717− }
718− if (step._1) {
719− tmp.run();
720− }
721− step = tmp;
722− break;
723−
724− case SEQ:
725− status = CONTINUE;
726− step = sequential(util, supervisor, step._1);
727− break;
728− }
729− break;
730−
731− case RETURN:
732− bhead = null;
733− btail = null;
734− // If the current stack has returned, and we have no other stacks to
735− // resume or finalizers to run, the fiber has halted and we can
736− // invoke all join callbacks. Otherwise we need to resume.
737− if (attempts === null) {
738− status = COMPLETED;
739− step = interrupt || fail || step;
740− } else {
741− // The interrupt status for the enqueued item.
742− tmp = attempts._3;
743− attempt = attempts._1;
744− attempts = attempts._2;
745−
746− switch (attempt.tag) {
747− // We cannot recover from an interrupt. Otherwise we should
748− // continue stepping, or run the exception handler if an exception
749− // was raised.
750− case CATCH:
751− // We should compare the interrupt status as well because we
752− // only want it to apply if there has been an interrupt since
753− // enqueuing the catch.
754− if (interrupt && interrupt !== tmp) {
755− status = RETURN;
756− } else if (fail) {
757− status = CONTINUE;
758− step = attempt._2(util.fromLeft(fail));
759− fail = null;
760− }
761− break;
762−
763− // We cannot resume from an interrupt or exception.
764− case RESUME:
765− // As with Catch, we only want to ignore in the case of an
766− // interrupt since enqueing the item.
767− if (interrupt && interrupt !== tmp || fail) {
768− status = RETURN;
769− } else {
770− bhead = attempt._1;
771− btail = attempt._2;
772− status = STEP_BIND;
773− step = util.fromRight(step);
774− }
775− break;
776−
777− // If we have a bracket, we should enqueue the handlers,
778− // and continue with the success branch only if the fiber has
779− // not been interrupted. If the bracket acquisition failed, we
780− // should not run either.
781− case BRACKET:
782− bracketCount--;
783− if (fail === null) {
784− result = util.fromRight(step);
785− // We need to enqueue the Release with the same interrupt
786− // status as the Bracket that is initiating it.
787− attempts = new Aff(CONS, new Aff(RELEASE, attempt._2, result), attempts, tmp);
788− // We should only coninue as long as the interrupt status has not changed or
789− // we are currently within a non-interruptable finalizer.
790− if (interrupt === tmp || bracketCount > 0) {
791− status = CONTINUE;
792− step = attempt._3(result);
793− }
794− }
795− break;
796−
797− // Enqueue the appropriate handler. We increase the bracket count
798− // because it should not be cancelled.
799− case RELEASE:
800− bracketCount++;
801− attempts = new Aff(CONS, new Aff(FINALIZED, step), attempts, interrupt);
802− status = CONTINUE;
803− // It has only been killed if the interrupt status has changed
804− // since we enqueued the item.
805− if (interrupt && interrupt !== tmp) {
806− step = attempt._1.killed(util.fromLeft(interrupt))(attempt._2);
807− } else if (fail) {
808− step = attempt._1.failed(util.fromLeft(fail))(attempt._2);
809− } else {
810− step = attempt._1.completed(util.fromRight(step))(attempt._2);
811− }
812− break;
813−
814− case FINALIZER:
815− bracketCount++;
816− attempts = new Aff(CONS, new Aff(FINALIZED, step), attempts, interrupt);
817− status = CONTINUE;
818− step = attempt._1;
819− break;
820−
821− case FINALIZED:
822− bracketCount--;
823− status = RETURN;
824− step = attempt._1;
825− break;
826− }
827− }
828− break;
829−
830− case COMPLETED:
831− for (var k in joins) {
832− if (joins.hasOwnProperty(k)) {
833− rethrow = rethrow && joins[k].rethrow;
834− runEff(joins[k].handler(step));
835− }
836− }
837− joins = null;
838− // If we have an interrupt and a fail, then the thread threw while
839− // running finalizers. This should always rethrow in a fresh stack.
840− if (interrupt && fail) {
841− setTimeout(function () {
842− throw util.fromLeft(fail);
843− }, 0);
844− // If we have an unhandled exception, and no other fiber has joined
845− // then we need to throw the exception in a fresh stack.
846− } else if (util.isLeft(step) && rethrow) {
847− setTimeout(function () {
848− // Guard on reathrow because a completely synchronous fiber can
849− // still have an observer which was added after-the-fact.
850− if (rethrow) {
851− throw util.fromLeft(step);
852− }
853− }, 0);
854− }
855− return;
856− case SUSPENDED:
857− status = CONTINUE;
858− break;
859− case PENDING: return;
860− }
861− }
862− }
863−
864− function onComplete(join) {
865− return function () {
866− if (status === COMPLETED) {
867− rethrow = rethrow && join.rethrow;
868− join.handler(step)();
869− return function () {};
870− }
871−
872− var jid = joinId++;
873− joins = joins || {};
874− joins[jid] = join;
875−
876− return function() {
877− if (joins !== null) {
878− delete joins[jid];
879− }
880− };
881− };
882− }
883−
884− function kill(error, cb) {
885− return function () {
886− if (status === COMPLETED) {
887− cb(util.right(void 0))();
888− return function () {};
889− }
890−
891− var canceler = onComplete({
892− rethrow: false,
893− handler: function (/* unused */) {
894− return cb(util.right(void 0));
895− }
896− })();
897−
898− switch (status) {
899− case SUSPENDED:
900− interrupt = util.left(error);
901− status = COMPLETED;
902− step = interrupt;
903− run(runTick);
904− break;
905− case PENDING:
906− if (interrupt === null) {
907− interrupt = util.left(error);
908− }
909− if (bracketCount === 0) {
910− if (status === PENDING) {
911− attempts = new Aff(CONS, new Aff(FINALIZER, step(error)), attempts, interrupt);
912− }
913− status = RETURN;
914− step = null;
915− fail = null;
916− run(++runTick);
917− }
918− break;
919− default:
920− if (interrupt === null) {
921− interrupt = util.left(error);
922− }
923− if (bracketCount === 0) {
924− status = RETURN;
925− step = null;
926− fail = null;
927− }
928− }
929−
930− return canceler;
931− };
932− }
933−
934− function join(cb) {
935− return function () {
936− var canceler = onComplete({
937− rethrow: false,
938− handler: cb
939− })();
940− if (status === SUSPENDED) {
941− run(runTick);
942− }
943− return canceler;
944− };
945− }
946−
947− return {
948− kill: kill,
949− join: join,
950− onComplete: onComplete,
951− isSuspended: function () {
952− return status === SUSPENDED;
953− },
954− run: function () {
955− if (status === SUSPENDED) {
956− if (!Scheduler.isDraining()) {
957− Scheduler.enqueue(function () {
958− run(runTick);
959− });
960− } else {
961− run(runTick);
962− }
963− }
964− }
965− };
966− }
967−
968− function runPar(util, supervisor, par, cb) {
969− // Table of all forked fibers.
970− var fiberId = 0;
971− var fibers = {};
972−
973− // Table of currently running cancelers, as a product of `Alt` behavior.
974− var killId = 0;
975− var kills = {};
976−
977− // Error used for early cancelation on Alt branches.
978− var early = new Error("[ParAff] Early exit");
979−
980− // Error used to kill the entire tree.
981− var interrupt = null;
982−
983− // The root pointer of the tree.
984− var root = EMPTY;
985−
986− // Walks a tree, invoking all the cancelers. Returns the table of pending
987− // cancellation fibers.
988− function kill(error, par, cb) {
989− var step = par;
990− var head = null;
991− var tail = null;
992− var count = 0;
993− var kills = {};
994− var tmp, kid;
995−
996− loop: while (true) {
997− tmp = null;
998−
999− switch (step.tag) {
1000− case FORKED:
1001− if (step._3 === EMPTY) {
1002− tmp = fibers[step._1];
1003− kills[count++] = tmp.kill(error, function (result) {
1004− return function () {
1005− count--;
1006− if (count === 0) {
1007− cb(result)();
1008− }
1009− };
1010− });
1011− }
1012− // Terminal case.
1013− if (head === null) {
1014− break loop;
1015− }
1016− // Go down the right side of the tree.
1017− step = head._2;
1018− if (tail === null) {
1019− head = null;
1020− } else {
1021− head = tail._1;
1022− tail = tail._2;
1023− }
1024− break;
1025− case MAP:
1026− step = step._2;
1027− break;
1028− case APPLY:
1029− case ALT:
1030− if (head) {
1031− tail = new Aff(CONS, head, tail);
1032− }
1033− head = step;
1034− step = step._1;
1035− break;
1036− }
1037− }
1038−
1039− if (count === 0) {
1040− cb(util.right(void 0))();
1041− } else {
1042− // Run the cancelation effects. We alias `count` because it's mutable.
1043− kid = 0;
1044− tmp = count;
1045− for (; kid < tmp; kid++) {
1046− kills[kid] = kills[kid]();
1047− }
1048− }
1049−
1050− return kills;
1051− }
1052−
1053− // When a fiber resolves, we need to bubble back up the tree with the
1054− // result, computing the applicative nodes.
1055− function join(result, head, tail) {
1056− var fail, step, lhs, rhs, tmp, kid;
1057−
1058− if (util.isLeft(result)) {
1059− fail = result;
1060− step = null;
1061− } else {
1062− step = result;
1063− fail = null;
1064− }
1065−
1066− loop: while (true) {
1067− lhs = null;
1068− rhs = null;
1069− tmp = null;
1070− kid = null;
1071−
1072− // We should never continue if the entire tree has been interrupted.
1073− if (interrupt !== null) {
1074− return;
1075− }
1076−
1077− // We've made it all the way to the root of the tree, which means
1078− // the tree has fully evaluated.
1079− if (head === null) {
1080− cb(fail || step)();
1081− return;
1082− }
1083−
1084− // The tree has already been computed, so we shouldn't try to do it
1085− // again. This should never happen.
1086− // TODO: Remove this?
1087− if (head._3 !== EMPTY) {
1088− return;
1089− }
1090−
1091− switch (head.tag) {
1092− case MAP:
1093− if (fail === null) {
1094− head._3 = util.right(head._1(util.fromRight(step)));
1095− step = head._3;
1096− } else {
1097− head._3 = fail;
1098− }
1099− break;
1100− case APPLY:
1101− lhs = head._1._3;
1102− rhs = head._2._3;
1103− // If we have a failure we should kill the other side because we
1104− // can't possible yield a result anymore.
1105− if (fail) {
1106− head._3 = fail;
1107− tmp = true;
1108− kid = killId++;
1109−
1110− kills[kid] = kill(early, fail === lhs ? head._2 : head._1, function (/* unused */) {
1111− return function () {
1112− delete kills[kid];
1113− if (tmp) {
1114− tmp = false;
1115− } else if (tail === null) {
1116− join(step, null, null);
1117− } else {
1118− join(step, tail._1, tail._2);
1119− }
1120− };
1121− });
1122−
1123− if (tmp) {
1124− tmp = false;
1125− return;
1126− }
1127− } else if (lhs === EMPTY || rhs === EMPTY) {
1128− // We can only proceed if both sides have resolved.
1129− return;
1130− } else {
1131− step = util.right(util.fromRight(lhs)(util.fromRight(rhs)));
1132− head._3 = step;
1133− }
1134− break;
1135− case ALT:
1136− lhs = head._1._3;
1137− rhs = head._2._3;
1138− // We can only proceed if both have resolved or we have a success
1139− if (lhs === EMPTY && util.isLeft(rhs) || rhs === EMPTY && util.isLeft(lhs)) {
1140− return;
1141− }
1142− // If both sides resolve with an error, we should continue with the
1143− // first error
1144− if (lhs !== EMPTY && util.isLeft(lhs) && rhs !== EMPTY && util.isLeft(rhs)) {
1145− fail = step === lhs ? rhs : lhs;
1146− step = null;
1147− head._3 = fail;
1148− } else {
1149− head._3 = step;
1150− tmp = true;
1151− kid = killId++;
1152− // Once a side has resolved, we need to cancel the side that is still
1153− // pending before we can continue.
1154− kills[kid] = kill(early, step === lhs ? head._2 : head._1, function (/* unused */) {
1155− return function () {
1156− delete kills[kid];
1157− if (tmp) {
1158− tmp = false;
1159− } else if (tail === null) {
1160− join(step, null, null);
1161− } else {
1162− join(step, tail._1, tail._2);
1163− }
1164− };
1165− });
1166−
1167− if (tmp) {
1168− tmp = false;
1169− return;
1170− }
1171− }
1172− break;
1173− }
1174−
1175− if (tail === null) {
1176− head = null;
1177− } else {
1178− head = tail._1;
1179− tail = tail._2;
1180− }
1181− }
1182− }
1183−
1184− function resolve(fiber) {
1185− return function (result) {
1186− return function () {
1187− delete fibers[fiber._1];
1188− fiber._3 = result;
1189− join(result, fiber._2._1, fiber._2._2);
1190− };
1191− };
1192− }
1193−
1194− // Walks the applicative tree, substituting non-applicative nodes with
1195− // `FORKED` nodes. In this tree, all applicative nodes use the `_3` slot
1196− // as a mutable slot for memoization. In an unresolved state, the `_3`
1197− // slot is `EMPTY`. In the cases of `ALT` and `APPLY`, we always walk
1198− // the left side first, because both operations are left-associative. As
1199− // we `RETURN` from those branches, we then walk the right side.
1200− function run() {
1201− var status = CONTINUE;
1202− var step = par;
1203− var head = null;
1204− var tail = null;
1205− var tmp, fid;
1206−
1207− loop: while (true) {
1208− tmp = null;
1209− fid = null;
1210−
1211− switch (status) {
1212− case CONTINUE:
1213− switch (step.tag) {
1214− case MAP:
1215− if (head) {
1216− tail = new Aff(CONS, head, tail);
1217− }
1218− head = new Aff(MAP, step._1, EMPTY, EMPTY);
1219− step = step._2;
1220− break;
1221− case APPLY:
1222− if (head) {
1223− tail = new Aff(CONS, head, tail);
1224− }
1225− head = new Aff(APPLY, EMPTY, step._2, EMPTY);
1226− step = step._1;
1227− break;
1228− case ALT:
1229− if (head) {
1230− tail = new Aff(CONS, head, tail);
1231− }
1232− head = new Aff(ALT, EMPTY, step._2, EMPTY);
1233− step = step._1;
1234− break;
1235− default:
1236− // When we hit a leaf value, we suspend the stack in the `FORKED`.
1237− // When the fiber resolves, it can bubble back up the tree.
1238− fid = fiberId++;
1239− status = RETURN;
1240− tmp = step;
1241− step = new Aff(FORKED, fid, new Aff(CONS, head, tail), EMPTY);
1242− tmp = Fiber(util, supervisor, tmp);
1243− tmp.onComplete({
1244− rethrow: false,
1245− handler: resolve(step)
1246− })();
1247− fibers[fid] = tmp;
1248− if (supervisor) {
1249− supervisor.register(tmp);
1250− }
1251− }
1252− break;
1253− case RETURN:
1254− // Terminal case, we are back at the root.
1255− if (head === null) {
1256− break loop;
1257− }
1258− // If we are done with the right side, we need to continue down the
1259− // left. Otherwise we should continue up the stack.
1260− if (head._1 === EMPTY) {
1261− head._1 = step;
1262− status = CONTINUE;
1263− step = head._2;
1264− head._2 = EMPTY;
1265− } else {
1266− head._2 = step;
1267− step = head;
1268− if (tail === null) {
1269− head = null;
1270− } else {
1271− head = tail._1;
1272− tail = tail._2;
1273− }
1274− }
1275− }
1276− }
1277−
1278− // Keep a reference to the tree root so it can be cancelled.
1279− root = step;
1280−
1281− for (fid = 0; fid < fiberId; fid++) {
1282− fibers[fid].run();
1283− }
1284− }
1285−
1286− // Cancels the entire tree. If there are already subtrees being canceled,
1287− // we need to first cancel those joins. We will then add fresh joins for
1288− // all pending branches including those that were in the process of being
1289− // canceled.
1290− function cancel(error, cb) {
1291− interrupt = util.left(error);
1292− var innerKills;
1293− for (var kid in kills) {
1294− if (kills.hasOwnProperty(kid)) {
1295− innerKills = kills[kid];
1296− for (kid in innerKills) {
1297− if (innerKills.hasOwnProperty(kid)) {
1298− innerKills[kid]();
1299− }
1300− }
1301− }
1302− }
1303−
1304− kills = null;
1305− var newKills = kill(error, root, cb);
1306−
1307− return function (killError) {
1308− return new Aff(ASYNC, function (killCb) {
1309− return function () {
1310− for (var kid in newKills) {
1311− if (newKills.hasOwnProperty(kid)) {
1312− newKills[kid]();
1313− }
1314− }
1315− return nonCanceler;
1316− };
1317− });
1318− };
1319− }
1320−
1321− run();
1322−
1323− return function (killError) {
1324− return new Aff(ASYNC, function (killCb) {
1325− return function () {
1326− return cancel(killError, killCb);
1327− };
1328− });
1329− };
1330− }
1331−
1332− function sequential(util, supervisor, par) {
1333− return new Aff(ASYNC, function (cb) {
1334− return function () {
1335− return runPar(util, supervisor, par, cb);
1336− };
1337− });
1338− }
1339−
1340− Aff.EMPTY = EMPTY;
1341− Aff.Pure = AffCtr(PURE);
1342− Aff.Throw = AffCtr(THROW);
1343− Aff.Catch = AffCtr(CATCH);
1344− Aff.Sync = AffCtr(SYNC);
1345− Aff.Async = AffCtr(ASYNC);
1346− Aff.Bind = AffCtr(BIND);
1347− Aff.Bracket = AffCtr(BRACKET);
1348− Aff.Fork = AffCtr(FORK);
1349− Aff.Seq = AffCtr(SEQ);
1350− Aff.ParMap = AffCtr(MAP);
1351− Aff.ParApply = AffCtr(APPLY);
1352− Aff.ParAlt = AffCtr(ALT);
1353− Aff.Fiber = Fiber;
1354− Aff.Supervisor = Supervisor;
1355− Aff.Scheduler = Scheduler;
1356− Aff.nonCanceler = nonCanceler;
1357−
1358− return Aff;
1359− }();
1360−
1361− exports._pure = Aff.Pure;
1362−
1363− exports._throwError = Aff.Throw;
1364−
1365− exports._map = function (f) {
1366− return function (aff) {
1367− if (aff.tag === Aff.Pure.tag) {
1368− return Aff.Pure(f(aff._1));
1369− } else {
1370− return Aff.Bind(aff, function (value) {
1371− return Aff.Pure(f(value));
1372− });
1373− }
1374− };
1375− };
1376−
1377− exports._bind = function (aff) {
1378− return function (k) {
1379− return Aff.Bind(aff, k);
1380− };
1381− };
1382−
1383− exports.makeAff = Aff.Async;
1384−
1385− exports._makeFiber = function (util, aff) {
1386− return function () {
1387− return Aff.Fiber(util, null, aff);
1388− };
1389− };
1390−})(PS["Control.Monad.Aff"] = PS["Control.Monad.Aff"] || {});
1391−(function(exports) {
1392− "use strict";
1393−
1394− exports.pureE = function (a) {
1395− return function () {
1396− return a;
1397− };
1398− };
1399−
1400− exports.bindE = function (a) {
1401− return function (f) {
1402− return function () {
1403− return f(a())();
1404− };
1405− };
1406− };
1407−
1408− exports.runPure = function (f) {
1409− return f();
1410− };
1411−
1412− exports.foreachE = function (as) {
1413− return function (f) {
1414− return function () {
1415− for (var i = 0, l = as.length; i < l; i++) {
1416− f(as[i])();
1417− }
1418− };
1419− };
1420− };
1421−})(PS["Control.Monad.Eff"] = PS["Control.Monad.Eff"] || {});
1422−(function(exports) {
1423− // Generated by purs version 0.11.7
1424− "use strict";
1425− var otherwise = true;
1426− exports["otherwise"] = otherwise;
1427−})(PS["Data.Boolean"] = PS["Data.Boolean"] || {});
1428−(function(exports) {
1429− "use strict";
1430−
1431− exports.refEq = function (r1) {
1432− return function (r2) {
1433− return r1 === r2;
1434− };
1435− };
1436−})(PS["Data.Eq"] = PS["Data.Eq"] || {});
1437−(function(exports) {
1438− // Generated by purs version 0.11.7
1439− "use strict";
1440− var $foreign = PS["Data.Eq"];
1441− var Data_Unit = PS["Data.Unit"];
1442− var Data_Void = PS["Data.Void"];
1443− var Eq = function (eq) {
1444− this.eq = eq;
1445− };
1446− var eqString = new Eq($foreign.refEq);
1447− var eq = function (dict) {
1448− return dict.eq;
1449− };
1450− exports["Eq"] = Eq;
1451− exports["eq"] = eq;
1452− exports["eqString"] = eqString;
1453−})(PS["Data.Eq"] = PS["Data.Eq"] || {});
1454−(function(exports) {
1455− // Generated by purs version 0.11.7
1456− "use strict";
1457− var Data_Boolean = PS["Data.Boolean"];
1458− var Data_Eq = PS["Data.Eq"];
1459− var Data_EuclideanRing = PS["Data.EuclideanRing"];
1460− var Data_Function = PS["Data.Function"];
1461− var Data_Ord = PS["Data.Ord"];
1462− var Data_Ordering = PS["Data.Ordering"];
1463− var Data_Semigroup = PS["Data.Semigroup"];
1464− var Data_Unit = PS["Data.Unit"];
1465− var Prelude = PS["Prelude"];
1466− var Monoid = function (Semigroup0, mempty) {
1467− this.Semigroup0 = Semigroup0;
1468− this.mempty = mempty;
1469− };
1470− var monoidString = new Monoid(function () {
1471− return Data_Semigroup.semigroupString;
1472− }, "");
1473− var mempty = function (dict) {
1474− return dict.mempty;
1475− };
1476− exports["Monoid"] = Monoid;
1477− exports["mempty"] = mempty;
1478− exports["monoidString"] = monoidString;
1479−})(PS["Data.Monoid"] = PS["Data.Monoid"] || {});
1480−(function(exports) {
1481− // Generated by purs version 0.11.7
1482− "use strict";
1483− var $foreign = PS["Control.Monad.Eff"];
1484− var Control_Applicative = PS["Control.Applicative"];
1485− var Control_Apply = PS["Control.Apply"];
1486− var Control_Bind = PS["Control.Bind"];
1487− var Control_Monad = PS["Control.Monad"];
1488− var Data_Functor = PS["Data.Functor"];
1489− var Data_Monoid = PS["Data.Monoid"];
1490− var Data_Semigroup = PS["Data.Semigroup"];
1491− var Data_Unit = PS["Data.Unit"];
1492− var monadEff = new Control_Monad.Monad(function () {
1493− return applicativeEff;
1494− }, function () {
1495− return bindEff;
1496− });
1497− var bindEff = new Control_Bind.Bind(function () {
1498− return applyEff;
1499− }, $foreign.bindE);
1500− var applyEff = new Control_Apply.Apply(function () {
1501− return functorEff;
1502− }, Control_Monad.ap(monadEff));
1503− var applicativeEff = new Control_Applicative.Applicative(function () {
1504− return applyEff;
1505− }, $foreign.pureE);
1506− var functorEff = new Data_Functor.Functor(Control_Applicative.liftA1(applicativeEff));
1507− exports["functorEff"] = functorEff;
1508− exports["applyEff"] = applyEff;
1509− exports["applicativeEff"] = applicativeEff;
1510− exports["bindEff"] = bindEff;
1511− exports["monadEff"] = monadEff;
1512− exports["runPure"] = $foreign.runPure;
1513− exports["foreachE"] = $foreign.foreachE;
1514−})(PS["Control.Monad.Eff"] = PS["Control.Monad.Eff"] || {});
1515−(function(exports) {
1516− "use strict";
1517−
1518− exports.error = function (msg) {
1519− return new Error(msg);
1520− };
1521−})(PS["Control.Monad.Eff.Exception"] = PS["Control.Monad.Eff.Exception"] || {});
1522−(function(exports) {
1523− // Generated by purs version 0.11.7
1524− "use strict";
1525− var Control_Category = PS["Control.Category"];
1526− var Bifunctor = function (bimap) {
1527− this.bimap = bimap;
1528− };
1529− var bimap = function (dict) {
1530− return dict.bimap;
1531− };
1532− var lmap = function (dictBifunctor) {
1533− return function (f) {
1534− return bimap(dictBifunctor)(f)(Control_Category.id(Control_Category.categoryFn));
1535− };
1536− };
1537− exports["bimap"] = bimap;
1538− exports["Bifunctor"] = Bifunctor;
1539− exports["lmap"] = lmap;
1540−})(PS["Data.Bifunctor"] = PS["Data.Bifunctor"] || {});
1541−(function(exports) {
1542− "use strict";
1543−
1544− exports.foldrArray = function (f) {
1545− return function (init) {
1546− return function (xs) {
1547− var acc = init;
1548− var len = xs.length;
1549− for (var i = len - 1; i >= 0; i--) {
1550− acc = f(xs[i])(acc);
1551− }
1552− return acc;
1553− };
1554− };
1555− };
1556−
1557− exports.foldlArray = function (f) {
1558− return function (init) {
1559− return function (xs) {
1560− var acc = init;
1561− var len = xs.length;
1562− for (var i = 0; i < len; i++) {
1563− acc = f(acc)(xs[i]);
1564− }
1565− return acc;
1566− };
1567− };
1568− };
1569−})(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
1570−(function(exports) {
1571− // Generated by purs version 0.11.7
1572− "use strict";
1573− var Control_Alt = PS["Control.Alt"];
1574− var Data_Functor = PS["Data.Functor"];
1575− var Plus = function (Alt0, empty) {
1576− this.Alt0 = Alt0;
1577− this.empty = empty;
1578− };
1579− var empty = function (dict) {
1580− return dict.empty;
1581− };
1582− exports["Plus"] = Plus;
1583− exports["empty"] = empty;
1584−})(PS["Control.Plus"] = PS["Control.Plus"] || {});
1585−(function(exports) {
1586− "use strict";
1587−
1588− exports.boolConj = function (b1) {
1589− return function (b2) {
1590− return b1 && b2;
1591− };
1592− };
1593−
1594− exports.boolDisj = function (b1) {
1595− return function (b2) {
1596− return b1 || b2;
1597− };
1598− };
1599−
1600− exports.boolNot = function (b) {
1601− return !b;
1602− };
1603−})(PS["Data.HeytingAlgebra"] = PS["Data.HeytingAlgebra"] || {});
1604−(function(exports) {
1605− // Generated by purs version 0.11.7
1606− "use strict";
1607− var $foreign = PS["Data.HeytingAlgebra"];
1608− var Data_Unit = PS["Data.Unit"];
1609− var HeytingAlgebra = function (conj, disj, ff, implies, not, tt) {
1610− this.conj = conj;
1611− this.disj = disj;
1612− this.ff = ff;
1613− this.implies = implies;
1614− this.not = not;
1615− this.tt = tt;
1616− };
1617− var tt = function (dict) {
1618− return dict.tt;
1619− };
1620− var not = function (dict) {
1621− return dict.not;
1622− };
1623− var implies = function (dict) {
1624− return dict.implies;
1625− };
1626− var ff = function (dict) {
1627− return dict.ff;
1628− };
1629− var disj = function (dict) {
1630− return dict.disj;
1631− };
1632− var heytingAlgebraBoolean = new HeytingAlgebra($foreign.boolConj, $foreign.boolDisj, false, function (a) {
1633− return function (b) {
1634− return disj(heytingAlgebraBoolean)(not(heytingAlgebraBoolean)(a))(b);
1635− };
1636− }, $foreign.boolNot, true);
1637− var conj = function (dict) {
1638− return dict.conj;
1639− };
1640− exports["HeytingAlgebra"] = HeytingAlgebra;
1641− exports["tt"] = tt;
1642− exports["ff"] = ff;
1643− exports["implies"] = implies;
1644− exports["conj"] = conj;
1645− exports["disj"] = disj;
1646− exports["not"] = not;
1647− exports["heytingAlgebraBoolean"] = heytingAlgebraBoolean;
1648−})(PS["Data.HeytingAlgebra"] = PS["Data.HeytingAlgebra"] || {});
1649−(function(exports) {
1650− // Generated by purs version 0.11.7
1651− "use strict";
1652− var Control_Alt = PS["Control.Alt"];
1653− var Control_Alternative = PS["Control.Alternative"];
1654− var Control_Applicative = PS["Control.Applicative"];
1655− var Control_Apply = PS["Control.Apply"];
1656− var Control_Bind = PS["Control.Bind"];
1657− var Control_Category = PS["Control.Category"];
1658− var Control_Extend = PS["Control.Extend"];
1659− var Control_Monad = PS["Control.Monad"];
1660− var Control_MonadZero = PS["Control.MonadZero"];
1661− var Control_Plus = PS["Control.Plus"];
1662− var Data_Bounded = PS["Data.Bounded"];
1663− var Data_Eq = PS["Data.Eq"];
1664− var Data_Function = PS["Data.Function"];
1665− var Data_Functor = PS["Data.Functor"];
1666− var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
1667− var Data_Monoid = PS["Data.Monoid"];
1668− var Data_Ord = PS["Data.Ord"];
1669− var Data_Ordering = PS["Data.Ordering"];
1670− var Data_Semigroup = PS["Data.Semigroup"];
1671− var Data_Show = PS["Data.Show"];
1672− var Data_Unit = PS["Data.Unit"];
1673− var Prelude = PS["Prelude"];
1674− var Nothing = (function () {
1675− function Nothing() {
1676−
1677− };
1678− Nothing.value = new Nothing();
1679− return Nothing;
1680− })();
1681− var Just = (function () {
1682− function Just(value0) {
1683− this.value0 = value0;
1684− };
1685− Just.create = function (value0) {
1686− return new Just(value0);
1687− };
1688− return Just;
1689− })();
1690− var maybe = function (v) {
1691− return function (v1) {
1692− return function (v2) {
1693− if (v2 instanceof Nothing) {
1694− return v;
1695− };
1696− if (v2 instanceof Just) {
1697− return v1(v2.value0);
1698− };
1699− throw new Error("Failed pattern match at Data.Maybe line 219, column 1 - line 219, column 51: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
1700− };
1701− };
1702− };
1703− var functorMaybe = new Data_Functor.Functor(function (v) {
1704− return function (v1) {
1705− if (v1 instanceof Just) {
1706− return new Just(v(v1.value0));
1707− };
1708− return Nothing.value;
1709− };
1710− });
1711− exports["Nothing"] = Nothing;
1712− exports["Just"] = Just;
1713− exports["maybe"] = maybe;
1714− exports["functorMaybe"] = functorMaybe;
1715−})(PS["Data.Maybe"] = PS["Data.Maybe"] || {});
1716−(function(exports) {
1717− // Generated by purs version 0.11.7
1718− "use strict";
1719− var Control_Semigroupoid = PS["Control.Semigroupoid"];
1720− var Data_Function = PS["Data.Function"];
1721− var Data_Functor = PS["Data.Functor"];
1722− var Prelude = PS["Prelude"];
1723− var Newtype = function (unwrap, wrap) {
1724− this.unwrap = unwrap;
1725− this.wrap = wrap;
1726− };
1727− var wrap = function (dict) {
1728− return dict.wrap;
1729− };
1730− var unwrap = function (dict) {
1731− return dict.unwrap;
1732− };
1733− var alaF = function (dictFunctor) {
1734− return function (dictFunctor1) {
1735− return function (dictNewtype) {
1736− return function (dictNewtype1) {
1737− return function (v) {
1738− return function (f) {
1739− return function ($64) {
1740− return Data_Functor.map(dictFunctor1)(unwrap(dictNewtype1))(f(Data_Functor.map(dictFunctor)(wrap(dictNewtype))($64)));
1741− };
1742− };
1743− };
1744− };
1745− };
1746− };
1747− };
1748− exports["unwrap"] = unwrap;
1749− exports["wrap"] = wrap;
1750− exports["Newtype"] = Newtype;
1751− exports["alaF"] = alaF;
1752−})(PS["Data.Newtype"] = PS["Data.Newtype"] || {});
1753−(function(exports) {
1754− // Generated by purs version 0.11.7
1755− "use strict";
1756− var Control_Applicative = PS["Control.Applicative"];
1757− var Control_Apply = PS["Control.Apply"];
1758− var Control_Bind = PS["Control.Bind"];
1759− var Control_Comonad = PS["Control.Comonad"];
1760− var Control_Extend = PS["Control.Extend"];
1761− var Control_Monad = PS["Control.Monad"];
1762− var Data_Bounded = PS["Data.Bounded"];
1763− var Data_Eq = PS["Data.Eq"];
1764− var Data_Functor = PS["Data.Functor"];
1765− var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
1766− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
1767− var Data_Monoid = PS["Data.Monoid"];
1768− var Data_Newtype = PS["Data.Newtype"];
1769− var Data_Ord = PS["Data.Ord"];
1770− var Data_Semigroup = PS["Data.Semigroup"];
1771− var Data_Semiring = PS["Data.Semiring"];
1772− var Data_Show = PS["Data.Show"];
1773− var Prelude = PS["Prelude"];
1774− var Disj = function (x) {
1775− return x;
1776− };
1777− var semigroupDisj = function (dictHeytingAlgebra) {
1778− return new Data_Semigroup.Semigroup(function (v) {
1779− return function (v1) {
1780− return Data_HeytingAlgebra.disj(dictHeytingAlgebra)(v)(v1);
1781− };
1782− });
1783− };
1784− var newtypeDisj = new Data_Newtype.Newtype(function (n) {
1785− return n;
1786− }, Disj);
1787− var monoidDisj = function (dictHeytingAlgebra) {
1788− return new Data_Monoid.Monoid(function () {
1789− return semigroupDisj(dictHeytingAlgebra);
1790− }, Data_HeytingAlgebra.ff(dictHeytingAlgebra));
1791− };
1792− exports["Disj"] = Disj;
1793− exports["newtypeDisj"] = newtypeDisj;
1794− exports["semigroupDisj"] = semigroupDisj;
1795− exports["monoidDisj"] = monoidDisj;
1796−})(PS["Data.Monoid.Disj"] = PS["Data.Monoid.Disj"] || {});
1797−(function(exports) {
1798− // Generated by purs version 0.11.7
1799− "use strict";
1800− var $foreign = PS["Data.Foldable"];
1801− var Control_Alt = PS["Control.Alt"];
1802− var Control_Applicative = PS["Control.Applicative"];
1803− var Control_Apply = PS["Control.Apply"];
1804− var Control_Bind = PS["Control.Bind"];
1805− var Control_Category = PS["Control.Category"];
1806− var Control_Plus = PS["Control.Plus"];
1807− var Control_Semigroupoid = PS["Control.Semigroupoid"];
1808− var Data_Eq = PS["Data.Eq"];
1809− var Data_Function = PS["Data.Function"];
1810− var Data_Functor = PS["Data.Functor"];
1811− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
1812− var Data_Maybe = PS["Data.Maybe"];
1813− var Data_Maybe_First = PS["Data.Maybe.First"];
1814− var Data_Maybe_Last = PS["Data.Maybe.Last"];
1815− var Data_Monoid = PS["Data.Monoid"];
1816− var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
1817− var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
1818− var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
1819− var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
1820− var Data_Monoid_Endo = PS["Data.Monoid.Endo"];
1821− var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
1822− var Data_Newtype = PS["Data.Newtype"];
1823− var Data_Ord = PS["Data.Ord"];
1824− var Data_Ordering = PS["Data.Ordering"];
1825− var Data_Semigroup = PS["Data.Semigroup"];
1826− var Data_Semiring = PS["Data.Semiring"];
1827− var Data_Unit = PS["Data.Unit"];
1828− var Prelude = PS["Prelude"];
1829− var Foldable = function (foldMap, foldl, foldr) {
1830− this.foldMap = foldMap;
1831− this.foldl = foldl;
1832− this.foldr = foldr;
1833− };
1834− var foldr = function (dict) {
1835− return dict.foldr;
1836− };
1837− var traverse_ = function (dictApplicative) {
1838− return function (dictFoldable) {
1839− return function (f) {
1840− return foldr(dictFoldable)(function ($195) {
1841− return Control_Apply.applySecond(dictApplicative.Apply0())(f($195));
1842− })(Control_Applicative.pure(dictApplicative)(Data_Unit.unit));
1843− };
1844− };
1845− };
1846− var for_ = function (dictApplicative) {
1847− return function (dictFoldable) {
1848− return Data_Function.flip(traverse_(dictApplicative)(dictFoldable));
1849− };
1850− };
1851− var foldl = function (dict) {
1852− return dict.foldl;
1853− };
1854− var intercalate = function (dictFoldable) {
1855− return function (dictMonoid) {
1856− return function (sep) {
1857− return function (xs) {
1858− var go = function (v) {
1859− return function (x) {
1860− if (v.init) {
1861− return {
1862− init: false,
1863− acc: x
1864− };
1865− };
1866− return {
1867− init: false,
1868− acc: Data_Semigroup.append(dictMonoid.Semigroup0())(v.acc)(Data_Semigroup.append(dictMonoid.Semigroup0())(sep)(x))
1869− };
1870− };
1871− };
1872− return (foldl(dictFoldable)(go)({
1873− init: true,
1874− acc: Data_Monoid.mempty(dictMonoid)
1875− })(xs)).acc;
1876− };
1877− };
1878− };
1879− };
1880− var foldMapDefaultR = function (dictFoldable) {
1881− return function (dictMonoid) {
1882− return function (f) {
1883− return foldr(dictFoldable)(function (x) {
1884− return function (acc) {
1885− return Data_Semigroup.append(dictMonoid.Semigroup0())(f(x))(acc);
1886− };
1887− })(Data_Monoid.mempty(dictMonoid));
1888− };
1889− };
1890− };
1891− var foldableArray = new Foldable(function (dictMonoid) {
1892− return foldMapDefaultR(foldableArray)(dictMonoid);
1893− }, $foreign.foldlArray, $foreign.foldrArray);
1894− var foldMap = function (dict) {
1895− return dict.foldMap;
1896− };
1897− var any = function (dictFoldable) {
1898− return function (dictHeytingAlgebra) {
1899− return Data_Newtype.alaF(Data_Functor.functorFn)(Data_Functor.functorFn)(Data_Monoid_Disj.newtypeDisj)(Data_Monoid_Disj.newtypeDisj)(Data_Monoid_Disj.Disj)(foldMap(dictFoldable)(Data_Monoid_Disj.monoidDisj(dictHeytingAlgebra)));
1900− };
1901− };
1902− exports["Foldable"] = Foldable;
1903− exports["foldr"] = foldr;
1904− exports["foldl"] = foldl;
1905− exports["foldMap"] = foldMap;
1906− exports["foldMapDefaultR"] = foldMapDefaultR;
1907− exports["traverse_"] = traverse_;
1908− exports["for_"] = for_;
1909− exports["intercalate"] = intercalate;
1910− exports["any"] = any;
1911− exports["foldableArray"] = foldableArray;
1912−})(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
1913−(function(exports) {
1914− // Generated by purs version 0.11.7
1915− "use strict";
1916− var $foreign = PS["Data.Traversable"];
1917− var Control_Applicative = PS["Control.Applicative"];
1918− var Control_Apply = PS["Control.Apply"];
1919− var Control_Category = PS["Control.Category"];
1920− var Data_Foldable = PS["Data.Foldable"];
1921− var Data_Functor = PS["Data.Functor"];
1922− var Data_Maybe = PS["Data.Maybe"];
1923− var Data_Maybe_First = PS["Data.Maybe.First"];
1924− var Data_Maybe_Last = PS["Data.Maybe.Last"];
1925− var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
1926− var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
1927− var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
1928− var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
1929− var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
1930− var Data_Traversable_Accum = PS["Data.Traversable.Accum"];
1931− var Data_Traversable_Accum_Internal = PS["Data.Traversable.Accum.Internal"];
1932− var Prelude = PS["Prelude"];
1933− var Traversable = function (Foldable1, Functor0, sequence, traverse) {
1934− this.Foldable1 = Foldable1;
1935− this.Functor0 = Functor0;
1936− this.sequence = sequence;
1937− this.traverse = traverse;
1938− };
1939− var traverse = function (dict) {
1940− return dict.traverse;
1941− };
1942− var sequence = function (dict) {
1943− return dict.sequence;
1944− };
1945− exports["Traversable"] = Traversable;
1946− exports["traverse"] = traverse;
1947− exports["sequence"] = sequence;
1948−})(PS["Data.Traversable"] = PS["Data.Traversable"] || {});
1949−(function(exports) {
1950− // Generated by purs version 0.11.7
1951− "use strict";
1952− var Control_Alt = PS["Control.Alt"];
1953− var Control_Applicative = PS["Control.Applicative"];
1954− var Control_Apply = PS["Control.Apply"];
1955− var Control_Bind = PS["Control.Bind"];
1956− var Control_Extend = PS["Control.Extend"];
1957− var Control_Monad = PS["Control.Monad"];
1958− var Data_Bifoldable = PS["Data.Bifoldable"];
1959− var Data_Bifunctor = PS["Data.Bifunctor"];
1960− var Data_Bitraversable = PS["Data.Bitraversable"];
1961− var Data_Bounded = PS["Data.Bounded"];
1962− var Data_Eq = PS["Data.Eq"];
1963− var Data_Foldable = PS["Data.Foldable"];
1964− var Data_Function = PS["Data.Function"];
1965− var Data_Functor = PS["Data.Functor"];
1966− var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
1967− var Data_Maybe = PS["Data.Maybe"];
1968− var Data_Monoid = PS["Data.Monoid"];
1969− var Data_Ord = PS["Data.Ord"];
1970− var Data_Ordering = PS["Data.Ordering"];
1971− var Data_Semigroup = PS["Data.Semigroup"];
1972− var Data_Semiring = PS["Data.Semiring"];
1973− var Data_Show = PS["Data.Show"];
1974− var Data_Traversable = PS["Data.Traversable"];
1975− var Prelude = PS["Prelude"];
1976− var Left = (function () {
1977− function Left(value0) {
1978− this.value0 = value0;
1979− };
1980− Left.create = function (value0) {
1981− return new Left(value0);
1982− };
1983− return Left;
1984− })();
1985− var Right = (function () {
1986− function Right(value0) {
1987− this.value0 = value0;
1988− };
1989− Right.create = function (value0) {
1990− return new Right(value0);
1991− };
1992− return Right;
1993− })();
1994− var functorEither = new Data_Functor.Functor(function (v) {
1995− return function (v1) {
1996− if (v1 instanceof Left) {
1997− return new Left(v1.value0);
1998− };
1999− if (v1 instanceof Right) {
2000− return new Right(v(v1.value0));
2001− };
2002− throw new Error("Failed pattern match at Data.Either line 36, column 1 - line 36, column 45: " + [ v.constructor.name, v1.constructor.name ]);
2003− };
2004− });
2005− var foldableEither = new Data_Foldable.Foldable(function (dictMonoid) {
2006− return function (f) {
2007− return function (v) {
2008− if (v instanceof Left) {
2009− return Data_Monoid.mempty(dictMonoid);
2010− };
2011− if (v instanceof Right) {
2012− return f(v.value0);
2013− };
2014− throw new Error("Failed pattern match at Data.Either line 184, column 1 - line 184, column 47: " + [ f.constructor.name, v.constructor.name ]);
2015− };
2016− };
2017− }, function (v) {
2018− return function (z) {
2019− return function (v1) {
2020− if (v1 instanceof Left) {
2021− return z;
2022− };
2023− if (v1 instanceof Right) {
2024− return v(z)(v1.value0);
2025− };
2026− throw new Error("Failed pattern match at Data.Either line 184, column 1 - line 184, column 47: " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
2027− };
2028− };
2029− }, function (v) {
2030− return function (z) {
2031− return function (v1) {
2032− if (v1 instanceof Left) {
2033− return z;
2034− };
2035− if (v1 instanceof Right) {
2036− return v(v1.value0)(z);
2037− };
2038− throw new Error("Failed pattern match at Data.Either line 184, column 1 - line 184, column 47: " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
2039− };
2040− };
2041− });
2042− var either = function (v) {
2043− return function (v1) {
2044− return function (v2) {
2045− if (v2 instanceof Left) {
2046− return v(v2.value0);
2047− };
2048− if (v2 instanceof Right) {
2049− return v1(v2.value0);
2050− };
2051− throw new Error("Failed pattern match at Data.Either line 229, column 1 - line 229, column 64: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
2052− };
2053− };
2054− };
2055− var bifunctorEither = new Data_Bifunctor.Bifunctor(function (v) {
2056− return function (v1) {
2057− return function (v2) {
2058− if (v2 instanceof Left) {
2059− return new Left(v(v2.value0));
2060− };
2061− if (v2 instanceof Right) {
2062− return new Right(v1(v2.value0));
2063− };
2064− throw new Error("Failed pattern match at Data.Either line 43, column 1 - line 43, column 45: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
2065− };
2066− };
2067− });
2068− var applyEither = new Control_Apply.Apply(function () {
2069− return functorEither;
2070− }, function (v) {
2071− return function (v1) {
2072− if (v instanceof Left) {
2073− return new Left(v.value0);
2074− };
2075− if (v instanceof Right) {
2076− return Data_Functor.map(functorEither)(v.value0)(v1);
2077− };
2078− throw new Error("Failed pattern match at Data.Either line 79, column 1 - line 79, column 41: " + [ v.constructor.name, v1.constructor.name ]);
2079− };
2080− });
2081− var bindEither = new Control_Bind.Bind(function () {
2082− return applyEither;
2083− }, either(function (e) {
2084− return function (v) {
2085− return new Left(e);
2086− };
2087− })(function (a) {
2088− return function (f) {
2089− return f(a);
2090− };
2091− }));
2092− var applicativeEither = new Control_Applicative.Applicative(function () {
2093− return applyEither;
2094− }, Right.create);
2095− exports["Left"] = Left;
2096− exports["Right"] = Right;
2097− exports["either"] = either;
2098− exports["functorEither"] = functorEither;
2099− exports["bifunctorEither"] = bifunctorEither;
2100− exports["applyEither"] = applyEither;
2101− exports["applicativeEither"] = applicativeEither;
2102− exports["bindEither"] = bindEither;
2103− exports["foldableEither"] = foldableEither;
2104−})(PS["Data.Either"] = PS["Data.Either"] || {});
2105−(function(exports) {
2106− // Generated by purs version 0.11.7
2107− "use strict";
2108− var $foreign = PS["Control.Monad.Eff.Exception"];
2109− var Control_Applicative = PS["Control.Applicative"];
2110− var Control_Monad_Eff = PS["Control.Monad.Eff"];
2111− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2112− var Data_Either = PS["Data.Either"];
2113− var Data_Functor = PS["Data.Functor"];
2114− var Data_Maybe = PS["Data.Maybe"];
2115− var Data_Show = PS["Data.Show"];
2116− var Prelude = PS["Prelude"];
2117− exports["error"] = $foreign.error;
2118−})(PS["Control.Monad.Eff.Exception"] = PS["Control.Monad.Eff.Exception"] || {});
2119−(function(exports) {
2120− // Generated by purs version 0.11.7
2121− "use strict";
2122− var Control_Applicative = PS["Control.Applicative"];
2123− var Control_Bind = PS["Control.Bind"];
2124− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2125− var Data_Either = PS["Data.Either"];
2126− var Data_Function = PS["Data.Function"];
2127− var Data_Functor = PS["Data.Functor"];
2128− var Data_Maybe = PS["Data.Maybe"];
2129− var Data_Unit = PS["Data.Unit"];
2130− var Prelude = PS["Prelude"];
2131− var MonadThrow = function (Monad0, throwError) {
2132− this.Monad0 = Monad0;
2133− this.throwError = throwError;
2134− };
2135− var throwError = function (dict) {
2136− return dict.throwError;
2137− };
2138− exports["throwError"] = throwError;
2139− exports["MonadThrow"] = MonadThrow;
2140−})(PS["Control.Monad.Error.Class"] = PS["Control.Monad.Error.Class"] || {});
2141−(function(exports) {
2142− "use strict";
2143−
2144− exports.runFn4 = function (fn) {
2145− return function (a) {
2146− return function (b) {
2147− return function (c) {
2148− return function (d) {
2149− return fn(a, b, c, d);
2150− };
2151− };
2152− };
2153− };
2154− };
2155−})(PS["Data.Function.Uncurried"] = PS["Data.Function.Uncurried"] || {});
2156−(function(exports) {
2157− // Generated by purs version 0.11.7
2158− "use strict";
2159− var $foreign = PS["Data.Function.Uncurried"];
2160− var Data_Unit = PS["Data.Unit"];
2161− exports["runFn4"] = $foreign.runFn4;
2162−})(PS["Data.Function.Uncurried"] = PS["Data.Function.Uncurried"] || {});
2163−(function(exports) {
2164− "use strict";
2165−
2166− // module Partial.Unsafe
2167−
2168− exports.unsafePartial = function (f) {
2169− return f();
2170− };
2171−})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
2172−(function(exports) {
2173− "use strict";
2174−
2175− // module Partial
2176−
2177− exports.crashWith = function () {
2178− return function (msg) {
2179− throw new Error(msg);
2180− };
2181− };
2182−})(PS["Partial"] = PS["Partial"] || {});
2183−(function(exports) {
2184− // Generated by purs version 0.11.7
2185− "use strict";
2186− var $foreign = PS["Partial"];
2187− exports["crashWith"] = $foreign.crashWith;
2188−})(PS["Partial"] = PS["Partial"] || {});
2189−(function(exports) {
2190− // Generated by purs version 0.11.7
2191− "use strict";
2192− var $foreign = PS["Partial.Unsafe"];
2193− var Partial = PS["Partial"];
2194− var unsafeCrashWith = function (msg) {
2195− return $foreign.unsafePartial(function (dictPartial) {
2196− return Partial.crashWith(dictPartial)(msg);
2197− });
2198− };
2199− exports["unsafeCrashWith"] = unsafeCrashWith;
2200−})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
2201−(function(exports) {
2202− // Generated by purs version 0.11.7
2203− "use strict";
2204− var $foreign = PS["Control.Monad.Aff"];
2205− var Control_Alt = PS["Control.Alt"];
2206− var Control_Alternative = PS["Control.Alternative"];
2207− var Control_Applicative = PS["Control.Applicative"];
2208− var Control_Apply = PS["Control.Apply"];
2209− var Control_Bind = PS["Control.Bind"];
2210− var Control_Monad = PS["Control.Monad"];
2211− var Control_Monad_Eff = PS["Control.Monad.Eff"];
2212− var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
2213− var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
2214− var Control_Monad_Eff_Unsafe = PS["Control.Monad.Eff.Unsafe"];
2215− var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
2216− var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
2217− var Control_Parallel = PS["Control.Parallel"];
2218− var Control_Parallel_Class = PS["Control.Parallel.Class"];
2219− var Control_Plus = PS["Control.Plus"];
2220− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2221− var Data_Either = PS["Data.Either"];
2222− var Data_Foldable = PS["Data.Foldable"];
2223− var Data_Function = PS["Data.Function"];
2224− var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
2225− var Data_Functor = PS["Data.Functor"];
2226− var Data_Monoid = PS["Data.Monoid"];
2227− var Data_Newtype = PS["Data.Newtype"];
2228− var Data_Semigroup = PS["Data.Semigroup"];
2229− var Data_Time_Duration = PS["Data.Time.Duration"];
2230− var Data_Unit = PS["Data.Unit"];
2231− var Partial_Unsafe = PS["Partial.Unsafe"];
2232− var Prelude = PS["Prelude"];
2233− var Unsafe_Coerce = PS["Unsafe.Coerce"];
2234− var functorAff = new Data_Functor.Functor($foreign._map);
2235− var ffiUtil = (function () {
2236− var unsafeFromRight = function (v) {
2237− if (v instanceof Data_Either.Right) {
2238− return v.value0;
2239− };
2240− if (v instanceof Data_Either.Left) {
2241− return Partial_Unsafe.unsafeCrashWith("unsafeFromRight: Left");
2242− };
2243− throw new Error("Failed pattern match at Control.Monad.Aff line 398, column 21 - line 400, column 31: " + [ v.constructor.name ]);
2244− };
2245− var unsafeFromLeft = function (v) {
2246− if (v instanceof Data_Either.Left) {
2247− return v.value0;
2248− };
2249− if (v instanceof Data_Either.Right) {
2250− return Partial_Unsafe.unsafeCrashWith("unsafeFromLeft: Right");
2251− };
2252− throw new Error("Failed pattern match at Control.Monad.Aff line 393, column 20 - line 397, column 3: " + [ v.constructor.name ]);
2253− };
2254− var isLeft = function (v) {
2255− if (v instanceof Data_Either.Left) {
2256− return true;
2257− };
2258− if (v instanceof Data_Either.Right) {
2259− return false;
2260− };
2261− throw new Error("Failed pattern match at Control.Monad.Aff line 388, column 12 - line 390, column 20: " + [ v.constructor.name ]);
2262− };
2263− return {
2264− isLeft: isLeft,
2265− fromLeft: unsafeFromLeft,
2266− fromRight: unsafeFromRight,
2267− left: Data_Either.Left.create,
2268− right: Data_Either.Right.create
2269− };
2270− })();
2271− var makeFiber = function (aff) {
2272− return $foreign._makeFiber(ffiUtil, aff);
2273− };
2274− var launchAff = function (aff) {
2275− return function __do() {
2276− var v = makeFiber(aff)();
2277− v.run();
2278− return v;
2279− };
2280− };
2281− var monadAff = new Control_Monad.Monad(function () {
2282− return applicativeAff;
2283− }, function () {
2284− return bindAff;
2285− });
2286− var bindAff = new Control_Bind.Bind(function () {
2287− return applyAff;
2288− }, $foreign._bind);
2289− var applyAff = new Control_Apply.Apply(function () {
2290− return functorAff;
2291− }, Control_Monad.ap(monadAff));
2292− var applicativeAff = new Control_Applicative.Applicative(function () {
2293− return applyAff;
2294− }, $foreign._pure);
2295− var monadThrowAff = new Control_Monad_Error_Class.MonadThrow(function () {
2296− return monadAff;
2297− }, $foreign._throwError);
2298− var nonCanceler = Data_Function["const"](Control_Applicative.pure(applicativeAff)(Data_Unit.unit));
2299− exports["launchAff"] = launchAff;
2300− exports["nonCanceler"] = nonCanceler;
2301− exports["functorAff"] = functorAff;
2302− exports["applyAff"] = applyAff;
2303− exports["applicativeAff"] = applicativeAff;
2304− exports["bindAff"] = bindAff;
2305− exports["monadAff"] = monadAff;
2306− exports["monadThrowAff"] = monadThrowAff;
2307− exports["makeAff"] = $foreign.makeAff;
2308−})(PS["Control.Monad.Aff"] = PS["Control.Monad.Aff"] || {});
2309−(function(exports) {
2310− "use strict";
2311−
2312− exports.mkEffFn1 = function mkEffFn1(fn) {
2313− return function(x) {
2314− return fn(x)();
2315− };
2316− };
2317−
2318− exports.runEffFn2 = function runEffFn2(fn) {
2319− return function(a) {
2320− return function(b) {
2321− return function() {
2322− return fn(a, b);
2323− };
2324− };
2325− };
2326− };
2327−
2328− exports.runEffFn3 = function runEffFn3(fn) {
2329− return function(a) {
2330− return function(b) {
2331− return function(c) {
2332− return function() {
2333− return fn(a, b, c);
2334− };
2335− };
2336− };
2337− };
2338− };
2339−})(PS["Control.Monad.Eff.Uncurried"] = PS["Control.Monad.Eff.Uncurried"] || {});
2340−(function(exports) {
2341− // Generated by purs version 0.11.7
2342− "use strict";
2343− var $foreign = PS["Control.Monad.Eff.Uncurried"];
2344− var Control_Monad_Eff = PS["Control.Monad.Eff"];
2345− exports["mkEffFn1"] = $foreign.mkEffFn1;
2346− exports["runEffFn2"] = $foreign.runEffFn2;
2347− exports["runEffFn3"] = $foreign.runEffFn3;
2348−})(PS["Control.Monad.Eff.Uncurried"] = PS["Control.Monad.Eff.Uncurried"] || {});
2349−(function(exports) {
2350− // Generated by purs version 0.11.7
2351− "use strict";
2352− var Control_Applicative = PS["Control.Applicative"];
2353− var Control_Bind = PS["Control.Bind"];
2354− var Control_Monad_Aff = PS["Control.Monad.Aff"];
2355− var Control_Monad_Eff = PS["Control.Monad.Eff"];
2356− var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
2357− var Control_Monad_Eff_Uncurried = PS["Control.Monad.Eff.Uncurried"];
2358− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2359− var Data_Either = PS["Data.Either"];
2360− var Data_Function = PS["Data.Function"];
2361− var Prelude = PS["Prelude"];
2362− var fromEffFnAff = function (v) {
2363− return Control_Monad_Aff.makeAff(function (k) {
2364− return function __do() {
2365− var v1 = Control_Monad_Eff_Uncurried.runEffFn2(v)(Control_Monad_Eff_Uncurried.mkEffFn1(function ($4) {
2366− return k(Data_Either.Left.create($4));
2367− }))(Control_Monad_Eff_Uncurried.mkEffFn1(function ($5) {
2368− return k(Data_Either.Right.create($5));
2369− }))();
2370− return function (e) {
2371− return Control_Monad_Aff.makeAff(function (k2) {
2372− return function __do() {
2373− Control_Monad_Eff_Uncurried.runEffFn3(v1)(e)(Control_Monad_Eff_Uncurried.mkEffFn1(function ($6) {
2374− return k2(Data_Either.Left.create($6));
2375− }))(Control_Monad_Eff_Uncurried.mkEffFn1(function ($7) {
2376− return k2(Data_Either.Right.create($7));
2377− }))();
2378− return Control_Monad_Aff.nonCanceler;
2379− };
2380− });
2381− };
2382− };
2383− });
2384− };
2385− exports["fromEffFnAff"] = fromEffFnAff;
2386−})(PS["Control.Monad.Aff.Compat"] = PS["Control.Monad.Aff.Compat"] || {});
2387−(function(exports) {
2388− // Generated by purs version 0.11.7
2389− "use strict";
2390− var Control_Applicative = PS["Control.Applicative"];
2391− var Control_Apply = PS["Control.Apply"];
2392− var Control_Biapplicative = PS["Control.Biapplicative"];
2393− var Control_Biapply = PS["Control.Biapply"];
2394− var Control_Bind = PS["Control.Bind"];
2395− var Control_Comonad = PS["Control.Comonad"];
2396− var Control_Extend = PS["Control.Extend"];
2397− var Control_Lazy = PS["Control.Lazy"];
2398− var Control_Monad = PS["Control.Monad"];
2399− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2400− var Data_Bifoldable = PS["Data.Bifoldable"];
2401− var Data_Bifunctor = PS["Data.Bifunctor"];
2402− var Data_Bitraversable = PS["Data.Bitraversable"];
2403− var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
2404− var Data_Bounded = PS["Data.Bounded"];
2405− var Data_CommutativeRing = PS["Data.CommutativeRing"];
2406− var Data_Distributive = PS["Data.Distributive"];
2407− var Data_Eq = PS["Data.Eq"];
2408− var Data_Foldable = PS["Data.Foldable"];
2409− var Data_Function = PS["Data.Function"];
2410− var Data_Functor = PS["Data.Functor"];
2411− var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
2412− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
2413− var Data_Maybe = PS["Data.Maybe"];
2414− var Data_Maybe_First = PS["Data.Maybe.First"];
2415− var Data_Monoid = PS["Data.Monoid"];
2416− var Data_Newtype = PS["Data.Newtype"];
2417− var Data_Ord = PS["Data.Ord"];
2418− var Data_Ordering = PS["Data.Ordering"];
2419− var Data_Ring = PS["Data.Ring"];
2420− var Data_Semigroup = PS["Data.Semigroup"];
2421− var Data_Semiring = PS["Data.Semiring"];
2422− var Data_Show = PS["Data.Show"];
2423− var Data_Traversable = PS["Data.Traversable"];
2424− var Data_Unit = PS["Data.Unit"];
2425− var Prelude = PS["Prelude"];
2426− var Type_Equality = PS["Type.Equality"];
2427− var Tuple = (function () {
2428− function Tuple(value0, value1) {
2429− this.value0 = value0;
2430− this.value1 = value1;
2431− };
2432− Tuple.create = function (value0) {
2433− return function (value1) {
2434− return new Tuple(value0, value1);
2435− };
2436− };
2437− return Tuple;
2438− })();
2439− var uncurry = function (f) {
2440− return function (v) {
2441− return f(v.value0)(v.value1);
2442− };
2443− };
2444− var snd = function (v) {
2445− return v.value1;
2446− };
2447− var fst = function (v) {
2448− return v.value0;
2449− };
2450− exports["Tuple"] = Tuple;
2451− exports["fst"] = fst;
2452− exports["snd"] = snd;
2453− exports["uncurry"] = uncurry;
2454−})(PS["Data.Tuple"] = PS["Data.Tuple"] || {});
2455−(function(exports) {
2456− // Generated by purs version 0.11.7
2457− "use strict";
2458− var Control_Alt = PS["Control.Alt"];
2459− var Control_Alternative = PS["Control.Alternative"];
2460− var Control_Applicative = PS["Control.Applicative"];
2461− var Control_Apply = PS["Control.Apply"];
2462− var Control_Bind = PS["Control.Bind"];
2463− var Control_Category = PS["Control.Category"];
2464− var Control_Monad = PS["Control.Monad"];
2465− var Control_Monad_Cont_Class = PS["Control.Monad.Cont.Class"];
2466− var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
2467− var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
2468− var Control_Monad_Reader_Class = PS["Control.Monad.Reader.Class"];
2469− var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
2470− var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
2471− var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
2472− var Control_Monad_Writer_Class = PS["Control.Monad.Writer.Class"];
2473− var Control_MonadPlus = PS["Control.MonadPlus"];
2474− var Control_MonadZero = PS["Control.MonadZero"];
2475− var Control_Plus = PS["Control.Plus"];
2476− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2477− var Data_Either = PS["Data.Either"];
2478− var Data_Function = PS["Data.Function"];
2479− var Data_Functor = PS["Data.Functor"];
2480− var Data_Monoid = PS["Data.Monoid"];
2481− var Data_Newtype = PS["Data.Newtype"];
2482− var Data_Semigroup = PS["Data.Semigroup"];
2483− var Data_Tuple = PS["Data.Tuple"];
2484− var Prelude = PS["Prelude"];
2485− var ExceptT = function (x) {
2486− return x;
2487− };
2488− var runExceptT = function (v) {
2489− return v;
2490− };
2491− var mapExceptT = function (f) {
2492− return function (v) {
2493− return f(v);
2494− };
2495− };
2496− var functorExceptT = function (dictFunctor) {
2497− return new Data_Functor.Functor(function (f) {
2498− return mapExceptT(Data_Functor.map(dictFunctor)(Data_Functor.map(Data_Either.functorEither)(f)));
2499− });
2500− };
2501− var monadExceptT = function (dictMonad) {
2502− return new Control_Monad.Monad(function () {
2503− return applicativeExceptT(dictMonad);
2504− }, function () {
2505− return bindExceptT(dictMonad);
2506− });
2507− };
2508− var bindExceptT = function (dictMonad) {
2509− return new Control_Bind.Bind(function () {
2510− return applyExceptT(dictMonad);
2511− }, function (v) {
2512− return function (k) {
2513− return Control_Bind.bind(dictMonad.Bind1())(v)(Data_Either.either(function ($97) {
2514− return Control_Applicative.pure(dictMonad.Applicative0())(Data_Either.Left.create($97));
2515− })(function (a) {
2516− var v1 = k(a);
2517− return v1;
2518− }));
2519− };
2520− });
2521− };
2522− var applyExceptT = function (dictMonad) {
2523− return new Control_Apply.Apply(function () {
2524− return functorExceptT(((dictMonad.Bind1()).Apply0()).Functor0());
2525− }, Control_Monad.ap(monadExceptT(dictMonad)));
2526− };
2527− var applicativeExceptT = function (dictMonad) {
2528− return new Control_Applicative.Applicative(function () {
2529− return applyExceptT(dictMonad);
2530− }, function ($98) {
2531− return ExceptT(Control_Applicative.pure(dictMonad.Applicative0())(Data_Either.Right.create($98)));
2532− });
2533− };
2534− var monadThrowExceptT = function (dictMonad) {
2535− return new Control_Monad_Error_Class.MonadThrow(function () {
2536− return monadExceptT(dictMonad);
2537− }, function ($102) {
2538− return ExceptT(Control_Applicative.pure(dictMonad.Applicative0())(Data_Either.Left.create($102)));
2539− });
2540− };
2541− exports["ExceptT"] = ExceptT;
2542− exports["runExceptT"] = runExceptT;
2543− exports["mapExceptT"] = mapExceptT;
2544− exports["functorExceptT"] = functorExceptT;
2545− exports["applyExceptT"] = applyExceptT;
2546− exports["applicativeExceptT"] = applicativeExceptT;
2547− exports["bindExceptT"] = bindExceptT;
2548− exports["monadExceptT"] = monadExceptT;
2549− exports["monadThrowExceptT"] = monadThrowExceptT;
2550−})(PS["Control.Monad.Except.Trans"] = PS["Control.Monad.Except.Trans"] || {});
2551−(function(exports) {
2552− // Generated by purs version 0.11.7
2553− "use strict";
2554− var Control_Alt = PS["Control.Alt"];
2555− var Control_Applicative = PS["Control.Applicative"];
2556− var Control_Apply = PS["Control.Apply"];
2557− var Control_Bind = PS["Control.Bind"];
2558− var Control_Comonad = PS["Control.Comonad"];
2559− var Control_Extend = PS["Control.Extend"];
2560− var Control_Lazy = PS["Control.Lazy"];
2561− var Control_Monad = PS["Control.Monad"];
2562− var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
2563− var Data_Bounded = PS["Data.Bounded"];
2564− var Data_CommutativeRing = PS["Data.CommutativeRing"];
2565− var Data_Eq = PS["Data.Eq"];
2566− var Data_EuclideanRing = PS["Data.EuclideanRing"];
2567− var Data_Field = PS["Data.Field"];
2568− var Data_Foldable = PS["Data.Foldable"];
2569− var Data_Functor = PS["Data.Functor"];
2570− var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
2571− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
2572− var Data_Monoid = PS["Data.Monoid"];
2573− var Data_Newtype = PS["Data.Newtype"];
2574− var Data_Ord = PS["Data.Ord"];
2575− var Data_Ring = PS["Data.Ring"];
2576− var Data_Semigroup = PS["Data.Semigroup"];
2577− var Data_Semiring = PS["Data.Semiring"];
2578− var Data_Show = PS["Data.Show"];
2579− var Data_Traversable = PS["Data.Traversable"];
2580− var Prelude = PS["Prelude"];
2581− var Identity = function (x) {
2582− return x;
2583− };
2584− var newtypeIdentity = new Data_Newtype.Newtype(function (n) {
2585− return n;
2586− }, Identity);
2587− var functorIdentity = new Data_Functor.Functor(function (f) {
2588− return function (v) {
2589− return f(v);
2590− };
2591− });
2592− var applyIdentity = new Control_Apply.Apply(function () {
2593− return functorIdentity;
2594− }, function (v) {
2595− return function (v1) {
2596− return v(v1);
2597− };
2598− });
2599− var bindIdentity = new Control_Bind.Bind(function () {
2600− return applyIdentity;
2601− }, function (v) {
2602− return function (f) {
2603− return f(v);
2604− };
2605− });
2606− var applicativeIdentity = new Control_Applicative.Applicative(function () {
2607− return applyIdentity;
2608− }, Identity);
2609− var monadIdentity = new Control_Monad.Monad(function () {
2610− return applicativeIdentity;
2611− }, function () {
2612− return bindIdentity;
2613− });
2614− exports["Identity"] = Identity;
2615− exports["newtypeIdentity"] = newtypeIdentity;
2616− exports["functorIdentity"] = functorIdentity;
2617− exports["applyIdentity"] = applyIdentity;
2618− exports["applicativeIdentity"] = applicativeIdentity;
2619− exports["bindIdentity"] = bindIdentity;
2620− exports["monadIdentity"] = monadIdentity;
2621−})(PS["Data.Identity"] = PS["Data.Identity"] || {});
2622−(function(exports) {
2623− // Generated by purs version 0.11.7
2624− "use strict";
2625− var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
2626− var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
2627− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2628− var Data_Either = PS["Data.Either"];
2629− var Data_Identity = PS["Data.Identity"];
2630− var Data_Newtype = PS["Data.Newtype"];
2631− var Prelude = PS["Prelude"];
2632− var runExcept = function ($0) {
2633− return Data_Newtype.unwrap(Data_Identity.newtypeIdentity)(Control_Monad_Except_Trans.runExceptT($0));
2634− };
2635− exports["runExcept"] = runExcept;
2636−})(PS["Control.Monad.Except"] = PS["Control.Monad.Except"] || {});
2637−(function(exports) {
2638− "use strict";
2639−
2640− function id(x) {
2641− return x;
2642− }
2643− exports.fromString = id;
2644− exports.fromObject = id;
2645−
2646− exports.stringify = function (j) {
2647− return JSON.stringify(j);
2648− };
2649−
2650− var objToString = Object.prototype.toString;
2651−
2652− function isArray(a) {
2653− return objToString.call(a) === "[object Array]";
2654− }
2655−
2656− exports._foldJson = function (isNull, isBool, isNum, isStr, isArr, isObj, j) {
2657− if (j == null) return isNull(null);
2658− else if (typeof j === "boolean") return isBool(j);
2659− else if (typeof j === "number") return isNum(j);
2660− else if (typeof j === "string") return isStr(j);
2661− else if (objToString.call(j) === "[object Array]")
2662− return isArr(j);
2663− else return isObj(j);
2664− };
2665−})(PS["Data.Argonaut.Core"] = PS["Data.Argonaut.Core"] || {});
2666−(function(exports) {
2667− "use strict";
2668−
2669− exports._copyEff = function (m) {
2670− return function () {
2671− var r = {};
2672− for (var k in m) {
2673− if (hasOwnProperty.call(m, k)) {
2674− r[k] = m[k];
2675− }
2676− }
2677− return r;
2678− };
2679− };
2680−
2681− exports.empty = {};
2682−
2683− exports.runST = function (f) {
2684− return f;
2685− };
2686−
2687− exports._fmapStrMap = function (m0, f) {
2688− var m = {};
2689− for (var k in m0) {
2690− if (hasOwnProperty.call(m0, k)) {
2691− m[k] = f(m0[k]);
2692− }
2693− }
2694− return m;
2695− };
2696−
2697− exports._mapWithKey = function (m0, f) {
2698− var m = {};
2699− for (var k in m0) {
2700− if (hasOwnProperty.call(m0, k)) {
2701− m[k] = f(k)(m0[k]);
2702− }
2703− }
2704− return m;
2705− };
2706−
2707− exports._foldM = function (bind) {
2708− return function (f) {
2709− return function (mz) {
2710− return function (m) {
2711− var acc = mz;
2712− function g(k) {
2713− return function (z) {
2714− return f(z)(k)(m[k]);
2715− };
2716− }
2717− for (var k in m) {
2718− if (hasOwnProperty.call(m, k)) {
2719− acc = bind(acc)(g(k));
2720− }
2721− }
2722− return acc;
2723− };
2724− };
2725− };
2726− };
2727−
2728− exports._lookup = function (no, yes, k, m) {
2729− return k in m ? yes(m[k]) : no;
2730− };
2731−
2732− function toArrayWithKey(f) {
2733− return function (m) {
2734− var r = [];
2735− for (var k in m) {
2736− if (hasOwnProperty.call(m, k)) {
2737− r.push(f(k)(m[k]));
2738− }
2739− }
2740− return r;
2741− };
2742− }
2743−
2744− exports.toArrayWithKey = toArrayWithKey;
2745−})(PS["Data.StrMap"] = PS["Data.StrMap"] || {});
2746−(function(exports) {
2747− "use strict";
2748−
2749− exports.fromFoldableImpl = (function () {
2750− function Cons(head, tail) {
2751− this.head = head;
2752− this.tail = tail;
2753− }
2754− var emptyList = {};
2755−
2756− function curryCons(head) {
2757− return function (tail) {
2758− return new Cons(head, tail);
2759− };
2760− }
2761−
2762− function listToArray(list) {
2763− var result = [];
2764− var count = 0;
2765− var xs = list;
2766− while (xs !== emptyList) {
2767− result[count++] = xs.head;
2768− xs = xs.tail;
2769− }
2770− return result;
2771− }
2772−
2773− return function (foldr) {
2774− return function (xs) {
2775− return listToArray(foldr(curryCons)(emptyList)(xs));
2776− };
2777− };
2778− })();
2779−
2780− exports.snoc = function (l) {
2781− return function (e) {
2782− var l1 = l.slice();
2783− l1.push(e);
2784− return l1;
2785− };
2786− };
2787−
2788− //------------------------------------------------------------------------------
2789− // Subarrays -------------------------------------------------------------------
2790− //------------------------------------------------------------------------------
2791−
2792− exports.slice = function (s) {
2793− return function (e) {
2794− return function (l) {
2795− return l.slice(s, e);
2796− };
2797− };
2798− };
2799−})(PS["Data.Array"] = PS["Data.Array"] || {});
2800−(function(exports) {
2801− // Generated by purs version 0.11.7
2802− "use strict";
2803− var $foreign = PS["Data.FunctorWithIndex"];
2804− var Data_Function = PS["Data.Function"];
2805− var Data_Functor = PS["Data.Functor"];
2806− var Data_Maybe = PS["Data.Maybe"];
2807− var Data_Maybe_First = PS["Data.Maybe.First"];
2808− var Data_Maybe_Last = PS["Data.Maybe.Last"];
2809− var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
2810− var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
2811− var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
2812− var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
2813− var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
2814− var Data_Unit = PS["Data.Unit"];
2815− var Prelude = PS["Prelude"];
2816− var FunctorWithIndex = function (Functor0, mapWithIndex) {
2817− this.Functor0 = Functor0;
2818− this.mapWithIndex = mapWithIndex;
2819− };
2820− var mapWithIndex = function (dict) {
2821− return dict.mapWithIndex;
2822− };
2823− exports["FunctorWithIndex"] = FunctorWithIndex;
2824− exports["mapWithIndex"] = mapWithIndex;
2825−})(PS["Data.FunctorWithIndex"] = PS["Data.FunctorWithIndex"] || {});
2826−(function(exports) {
2827− // Generated by purs version 0.11.7
2828− "use strict";
2829− var Control_Applicative = PS["Control.Applicative"];
2830− var Control_Apply = PS["Control.Apply"];
2831− var Control_Bind = PS["Control.Bind"];
2832− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2833− var Data_Foldable = PS["Data.Foldable"];
2834− var Data_Function = PS["Data.Function"];
2835− var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
2836− var Data_Maybe = PS["Data.Maybe"];
2837− var Data_Maybe_First = PS["Data.Maybe.First"];
2838− var Data_Maybe_Last = PS["Data.Maybe.Last"];
2839− var Data_Monoid = PS["Data.Monoid"];
2840− var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
2841− var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
2842− var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
2843− var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
2844− var Data_Monoid_Endo = PS["Data.Monoid.Endo"];
2845− var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
2846− var Data_Newtype = PS["Data.Newtype"];
2847− var Data_Semigroup = PS["Data.Semigroup"];
2848− var Data_Unit = PS["Data.Unit"];
2849− var Prelude = PS["Prelude"];
2850− var FoldableWithIndex = function (Foldable0, foldMapWithIndex, foldlWithIndex, foldrWithIndex) {
2851− this.Foldable0 = Foldable0;
2852− this.foldMapWithIndex = foldMapWithIndex;
2853− this.foldlWithIndex = foldlWithIndex;
2854− this.foldrWithIndex = foldrWithIndex;
2855− };
2856− var foldrWithIndex = function (dict) {
2857− return dict.foldrWithIndex;
2858− };
2859− var foldlWithIndex = function (dict) {
2860− return dict.foldlWithIndex;
2861− };
2862− var foldMapWithIndex = function (dict) {
2863− return dict.foldMapWithIndex;
2864− };
2865− exports["FoldableWithIndex"] = FoldableWithIndex;
2866− exports["foldrWithIndex"] = foldrWithIndex;
2867− exports["foldlWithIndex"] = foldlWithIndex;
2868− exports["foldMapWithIndex"] = foldMapWithIndex;
2869−})(PS["Data.FoldableWithIndex"] = PS["Data.FoldableWithIndex"] || {});
2870−(function(exports) {
2871− // Generated by purs version 0.11.7
2872− "use strict";
2873− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2874− var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
2875− var Data_Function = PS["Data.Function"];
2876− var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
2877− var Data_Maybe = PS["Data.Maybe"];
2878− var Data_Maybe_First = PS["Data.Maybe.First"];
2879− var Data_Maybe_Last = PS["Data.Maybe.Last"];
2880− var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
2881− var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
2882− var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
2883− var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
2884− var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
2885− var Data_Traversable = PS["Data.Traversable"];
2886− var Data_Traversable_Accum = PS["Data.Traversable.Accum"];
2887− var Data_Traversable_Accum_Internal = PS["Data.Traversable.Accum.Internal"];
2888− var Data_Unit = PS["Data.Unit"];
2889− var Prelude = PS["Prelude"];
2890− var TraversableWithIndex = function (FoldableWithIndex1, FunctorWithIndex0, Traversable2, traverseWithIndex) {
2891− this.FoldableWithIndex1 = FoldableWithIndex1;
2892− this.FunctorWithIndex0 = FunctorWithIndex0;
2893− this.Traversable2 = Traversable2;
2894− this.traverseWithIndex = traverseWithIndex;
2895− };
2896− var traverseWithIndex = function (dict) {
2897− return dict.traverseWithIndex;
2898− };
2899− exports["TraversableWithIndex"] = TraversableWithIndex;
2900− exports["traverseWithIndex"] = traverseWithIndex;
2901−})(PS["Data.TraversableWithIndex"] = PS["Data.TraversableWithIndex"] || {});
2902−(function(exports) {
2903− // Generated by purs version 0.11.7
2904− "use strict";
2905− var Control_Alt = PS["Control.Alt"];
2906− var Control_Alternative = PS["Control.Alternative"];
2907− var Control_Applicative = PS["Control.Applicative"];
2908− var Control_Apply = PS["Control.Apply"];
2909− var Control_Category = PS["Control.Category"];
2910− var Control_Plus = PS["Control.Plus"];
2911− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2912− var Data_Eq = PS["Data.Eq"];
2913− var Data_Foldable = PS["Data.Foldable"];
2914− var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
2915− var Data_Functor = PS["Data.Functor"];
2916− var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
2917− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
2918− var Data_Maybe = PS["Data.Maybe"];
2919− var Data_Ord = PS["Data.Ord"];
2920− var Data_Ordering = PS["Data.Ordering"];
2921− var Data_Semigroup = PS["Data.Semigroup"];
2922− var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
2923− var Data_Show = PS["Data.Show"];
2924− var Data_Traversable = PS["Data.Traversable"];
2925− var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
2926− var Prelude = PS["Prelude"];
2927− var NonEmpty = (function () {
2928− function NonEmpty(value0, value1) {
2929− this.value0 = value0;
2930− this.value1 = value1;
2931− };
2932− NonEmpty.create = function (value0) {
2933− return function (value1) {
2934− return new NonEmpty(value0, value1);
2935− };
2936− };
2937− return NonEmpty;
2938− })();
2939− var singleton = function (dictPlus) {
2940− return function (a) {
2941− return new NonEmpty(a, Control_Plus.empty(dictPlus));
2942− };
2943− };
2944− var showNonEmpty = function (dictShow) {
2945− return function (dictShow1) {
2946− return new Data_Show.Show(function (v) {
2947− return "(NonEmpty " + (Data_Show.show(dictShow)(v.value0) + (" " + (Data_Show.show(dictShow1)(v.value1) + ")")));
2948− });
2949− };
2950− };
2951− exports["NonEmpty"] = NonEmpty;
2952− exports["singleton"] = singleton;
2953− exports["showNonEmpty"] = showNonEmpty;
2954−})(PS["Data.NonEmpty"] = PS["Data.NonEmpty"] || {});
2955−(function(exports) {
2956− // Generated by purs version 0.11.7
2957− "use strict";
2958− var $foreign = PS["Data.Array"];
2959− var Control_Alt = PS["Control.Alt"];
2960− var Control_Alternative = PS["Control.Alternative"];
2961− var Control_Applicative = PS["Control.Applicative"];
2962− var Control_Apply = PS["Control.Apply"];
2963− var Control_Bind = PS["Control.Bind"];
2964− var Control_Category = PS["Control.Category"];
2965− var Control_Lazy = PS["Control.Lazy"];
2966− var Control_Monad_Eff = PS["Control.Monad.Eff"];
2967− var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
2968− var Control_Monad_ST = PS["Control.Monad.ST"];
2969− var Control_Semigroupoid = PS["Control.Semigroupoid"];
2970− var Data_Array_ST = PS["Data.Array.ST"];
2971− var Data_Array_ST_Iterator = PS["Data.Array.ST.Iterator"];
2972− var Data_Boolean = PS["Data.Boolean"];
2973− var Data_Eq = PS["Data.Eq"];
2974− var Data_Foldable = PS["Data.Foldable"];
2975− var Data_Function = PS["Data.Function"];
2976− var Data_Functor = PS["Data.Functor"];
2977− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
2978− var Data_Maybe = PS["Data.Maybe"];
2979− var Data_NonEmpty = PS["Data.NonEmpty"];
2980− var Data_Ord = PS["Data.Ord"];
2981− var Data_Ordering = PS["Data.Ordering"];
2982− var Data_Ring = PS["Data.Ring"];
2983− var Data_Semigroup = PS["Data.Semigroup"];
2984− var Data_Semiring = PS["Data.Semiring"];
2985− var Data_Traversable = PS["Data.Traversable"];
2986− var Data_Tuple = PS["Data.Tuple"];
2987− var Data_Unfoldable = PS["Data.Unfoldable"];
2988− var Partial_Unsafe = PS["Partial.Unsafe"];
2989− var Prelude = PS["Prelude"];
2990− var fromFoldable = function (dictFoldable) {
2991− return $foreign.fromFoldableImpl(Data_Foldable.foldr(dictFoldable));
2992− };
2993− exports["fromFoldable"] = fromFoldable;
2994− exports["snoc"] = $foreign.snoc;
2995−})(PS["Data.Array"] = PS["Data.Array"] || {});
2996−(function(exports) {
2997− "use strict";
2998−
2999− exports["new"] = function () {
3000− return {};
3001− };
3002−
3003− exports.poke = function (m) {
3004− return function (k) {
3005− return function (v) {
3006− return function () {
3007− m[k] = v;
3008− return m;
3009− };
3010− };
3011− };
3012− };
3013−})(PS["Data.StrMap.ST"] = PS["Data.StrMap.ST"] || {});
3014−(function(exports) {
3015− // Generated by purs version 0.11.7
3016− "use strict";
3017− var $foreign = PS["Data.StrMap.ST"];
3018− var Control_Monad_Eff = PS["Control.Monad.Eff"];
3019− var Control_Monad_ST = PS["Control.Monad.ST"];
3020− var Data_Maybe = PS["Data.Maybe"];
3021− exports["new"] = $foreign["new"];
3022− exports["poke"] = $foreign.poke;
3023−})(PS["Data.StrMap.ST"] = PS["Data.StrMap.ST"] || {});
3024−(function(exports) {
3025− // Generated by purs version 0.11.7
3026− "use strict";
3027− var $foreign = PS["Data.StrMap"];
3028− var Control_Applicative = PS["Control.Applicative"];
3029− var Control_Apply = PS["Control.Apply"];
3030− var Control_Bind = PS["Control.Bind"];
3031− var Control_Category = PS["Control.Category"];
3032− var Control_Monad_Eff = PS["Control.Monad.Eff"];
3033− var Control_Monad_ST = PS["Control.Monad.ST"];
3034− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3035− var Data_Array = PS["Data.Array"];
3036− var Data_Eq = PS["Data.Eq"];
3037− var Data_Foldable = PS["Data.Foldable"];
3038− var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
3039− var Data_Function = PS["Data.Function"];
3040− var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
3041− var Data_Functor = PS["Data.Functor"];
3042− var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
3043− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
3044− var Data_Maybe = PS["Data.Maybe"];
3045− var Data_Monoid = PS["Data.Monoid"];
3046− var Data_Ord = PS["Data.Ord"];
3047− var Data_Semigroup = PS["Data.Semigroup"];
3048− var Data_Show = PS["Data.Show"];
3049− var Data_StrMap_ST = PS["Data.StrMap.ST"];
3050− var Data_Traversable = PS["Data.Traversable"];
3051− var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
3052− var Data_Tuple = PS["Data.Tuple"];
3053− var Data_Unfoldable = PS["Data.Unfoldable"];
3054− var Prelude = PS["Prelude"];
3055− var values = $foreign.toArrayWithKey(function (v) {
3056− return function (v1) {
3057− return v1;
3058− };
3059− });
3060− var thawST = $foreign._copyEff;
3061− var pureST = function (f) {
3062− return Control_Monad_Eff.runPure($foreign.runST(f));
3063− };
3064− var mutate = function (f) {
3065− return function (m) {
3066− return pureST(function __do() {
3067− var v = thawST(m)();
3068− var v1 = f(v)();
3069− return v;
3070− });
3071− };
3072− };
3073− var mapWithKey = function (f) {
3074− return function (m) {
3075− return $foreign._mapWithKey(m, f);
3076− };
3077− };
3078− var lookup = Data_Function_Uncurried.runFn4($foreign._lookup)(Data_Maybe.Nothing.value)(Data_Maybe.Just.create);
3079− var insert = function (k) {
3080− return function (v) {
3081− return mutate(function (s) {
3082− return Data_Functor["void"](Control_Monad_Eff.functorEff)(Data_StrMap_ST.poke(s)(k)(v));
3083− });
3084− };
3085− };
3086− var functorStrMap = new Data_Functor.Functor(function (f) {
3087− return function (m) {
3088− return $foreign._fmapStrMap(m, f);
3089− };
3090− });
3091− var functorWithIndexStrMap = new Data_FunctorWithIndex.FunctorWithIndex(function () {
3092− return functorStrMap;
3093− }, mapWithKey);
3094− var fromFoldable = function (dictFoldable) {
3095− return function (l) {
3096− return pureST(function __do() {
3097− var v = Data_StrMap_ST["new"]();
3098− Control_Monad_Eff.foreachE(Data_Array.fromFoldable(dictFoldable)(l))(function (v1) {
3099− return Data_Functor["void"](Control_Monad_Eff.functorEff)(Data_StrMap_ST.poke(v)(v1.value0)(v1.value1));
3100− })();
3101− return v;
3102− });
3103− };
3104− };
3105− var fold = $foreign._foldM(Data_Function.applyFlipped);
3106− var foldMap = function (dictMonoid) {
3107− return function (f) {
3108− return fold(function (acc) {
3109− return function (k) {
3110− return function (v) {
3111− return Data_Semigroup.append(dictMonoid.Semigroup0())(acc)(f(k)(v));
3112− };
3113− };
3114− })(Data_Monoid.mempty(dictMonoid));
3115− };
3116− };
3117− var foldableStrMap = new Data_Foldable.Foldable(function (dictMonoid) {
3118− return function (f) {
3119− return foldMap(dictMonoid)(Data_Function["const"](f));
3120− };
3121− }, function (f) {
3122− return fold(function (z) {
3123− return function (v) {
3124− return f(z);
3125− };
3126− });
3127− }, function (f) {
3128− return function (z) {
3129− return function (m) {
3130− return Data_Foldable.foldr(Data_Foldable.foldableArray)(f)(z)(values(m));
3131− };
3132− };
3133− });
3134− var foldableWithIndexStrMap = new Data_FoldableWithIndex.FoldableWithIndex(function () {
3135− return foldableStrMap;
3136− }, function (dictMonoid) {
3137− return foldMap(dictMonoid);
3138− }, function (f) {
3139− return fold(Data_Function.flip(f));
3140− }, function (f) {
3141− return function (z) {
3142− return function (m) {
3143− return Data_Foldable.foldr(Data_Foldable.foldableArray)(Data_Tuple.uncurry(f))(z)($foreign.toArrayWithKey(Data_Tuple.Tuple.create)(m));
3144− };
3145− };
3146− });
3147− var traversableWithIndexStrMap = new Data_TraversableWithIndex.TraversableWithIndex(function () {
3148− return foldableWithIndexStrMap;
3149− }, function () {
3150− return functorWithIndexStrMap;
3151− }, function () {
3152− return traversableStrMap;
3153− }, function (dictApplicative) {
3154− return function (f) {
3155− return function (ms) {
3156− return fold(function (acc) {
3157− return function (k) {
3158− return function (v) {
3159− return Control_Apply.apply(dictApplicative.Apply0())(Data_Functor.map((dictApplicative.Apply0()).Functor0())(Data_Function.flip(insert(k)))(acc))(f(k)(v));
3160− };
3161− };
3162− })(Control_Applicative.pure(dictApplicative)($foreign.empty))(ms);
3163− };
3164− };
3165− });
3166− var traversableStrMap = new Data_Traversable.Traversable(function () {
3167− return foldableStrMap;
3168− }, function () {
3169− return functorStrMap;
3170− }, function (dictApplicative) {
3171− return Data_Traversable.traverse(traversableStrMap)(dictApplicative)(Control_Category.id(Control_Category.categoryFn));
3172− }, function (dictApplicative) {
3173− return function ($48) {
3174− return Data_TraversableWithIndex.traverseWithIndex(traversableWithIndexStrMap)(dictApplicative)(Data_Function["const"]($48));
3175− };
3176− });
3177− exports["insert"] = insert;
3178− exports["lookup"] = lookup;
3179− exports["fromFoldable"] = fromFoldable;
3180− exports["mapWithKey"] = mapWithKey;
3181− exports["values"] = values;
3182− exports["fold"] = fold;
3183− exports["foldMap"] = foldMap;
3184− exports["thawST"] = thawST;
3185− exports["pureST"] = pureST;
3186− exports["functorStrMap"] = functorStrMap;
3187− exports["functorWithIndexStrMap"] = functorWithIndexStrMap;
3188− exports["foldableStrMap"] = foldableStrMap;
3189− exports["foldableWithIndexStrMap"] = foldableWithIndexStrMap;
3190− exports["traversableStrMap"] = traversableStrMap;
3191− exports["traversableWithIndexStrMap"] = traversableWithIndexStrMap;
3192−})(PS["Data.StrMap"] = PS["Data.StrMap"] || {});
3193−(function(exports) {
3194− // Generated by purs version 0.11.7
3195− "use strict";
3196− var $foreign = PS["Data.Argonaut.Core"];
3197− var Data_Eq = PS["Data.Eq"];
3198− var Data_Function = PS["Data.Function"];
3199− var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
3200− var Data_Maybe = PS["Data.Maybe"];
3201− var Data_Ord = PS["Data.Ord"];
3202− var Data_Ordering = PS["Data.Ordering"];
3203− var Data_Show = PS["Data.Show"];
3204− var Data_StrMap = PS["Data.StrMap"];
3205− var Data_Tuple = PS["Data.Tuple"];
3206− var Prelude = PS["Prelude"];
3207− var Unsafe_Coerce = PS["Unsafe.Coerce"];
3208− var verbJsonType = function (def) {
3209− return function (f) {
3210− return function (fold) {
3211− return fold(def)(f);
3212− };
3213− };
3214− };
3215− var toJsonType = verbJsonType(Data_Maybe.Nothing.value)(Data_Maybe.Just.create);
3216− var showJson = new Data_Show.Show($foreign.stringify);
3217− var foldJsonString = function (d) {
3218− return function (f) {
3219− return function (j) {
3220− return $foreign._foldJson(Data_Function["const"](d), Data_Function["const"](d), Data_Function["const"](d), f, Data_Function["const"](d), Data_Function["const"](d), j);
3221− };
3222− };
3223− };
3224− var foldJsonObject = function (d) {
3225− return function (f) {
3226− return function (j) {
3227− return $foreign._foldJson(Data_Function["const"](d), Data_Function["const"](d), Data_Function["const"](d), Data_Function["const"](d), Data_Function["const"](d), f, j);
3228− };
3229− };
3230− };
3231− var toObject = toJsonType(foldJsonObject);
3232− exports["foldJsonString"] = foldJsonString;
3233− exports["foldJsonObject"] = foldJsonObject;
3234− exports["toObject"] = toObject;
3235− exports["showJson"] = showJson;
3236− exports["fromString"] = $foreign.fromString;
3237− exports["fromObject"] = $foreign.fromObject;
3238−})(PS["Data.Argonaut.Core"] = PS["Data.Argonaut.Core"] || {});
3239−(function(exports) {
3240− // Generated by purs version 0.11.7
3241− "use strict";
3242− var Control_Alt = PS["Control.Alt"];
3243− var Control_Alternative = PS["Control.Alternative"];
3244− var Control_Applicative = PS["Control.Applicative"];
3245− var Control_Apply = PS["Control.Apply"];
3246− var Control_Bind = PS["Control.Bind"];
3247− var Control_Category = PS["Control.Category"];
3248− var Control_Comonad = PS["Control.Comonad"];
3249− var Control_Extend = PS["Control.Extend"];
3250− var Control_Monad = PS["Control.Monad"];
3251− var Control_MonadPlus = PS["Control.MonadPlus"];
3252− var Control_MonadZero = PS["Control.MonadZero"];
3253− var Control_Plus = PS["Control.Plus"];
3254− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3255− var Data_Eq = PS["Data.Eq"];
3256− var Data_Foldable = PS["Data.Foldable"];
3257− var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
3258− var Data_Function = PS["Data.Function"];
3259− var Data_Functor = PS["Data.Functor"];
3260− var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
3261− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
3262− var Data_Maybe = PS["Data.Maybe"];
3263− var Data_Monoid = PS["Data.Monoid"];
3264− var Data_Newtype = PS["Data.Newtype"];
3265− var Data_NonEmpty = PS["Data.NonEmpty"];
3266− var Data_Ord = PS["Data.Ord"];
3267− var Data_Ordering = PS["Data.Ordering"];
3268− var Data_Ring = PS["Data.Ring"];
3269− var Data_Semigroup = PS["Data.Semigroup"];
3270− var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
3271− var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
3272− var Data_Semiring = PS["Data.Semiring"];
3273− var Data_Show = PS["Data.Show"];
3274− var Data_Traversable = PS["Data.Traversable"];
3275− var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
3276− var Data_Tuple = PS["Data.Tuple"];
3277− var Data_Unfoldable = PS["Data.Unfoldable"];
3278− var Prelude = PS["Prelude"];
3279− var Nil = (function () {
3280− function Nil() {
3281−
3282− };
3283− Nil.value = new Nil();
3284− return Nil;
3285− })();
3286− var Cons = (function () {
3287− function Cons(value0, value1) {
3288− this.value0 = value0;
3289− this.value1 = value1;
3290− };
3291− Cons.create = function (value0) {
3292− return function (value1) {
3293− return new Cons(value0, value1);
3294− };
3295− };
3296− return Cons;
3297− })();
3298− var NonEmptyList = function (x) {
3299− return x;
3300− };
3301− var foldableList = new Data_Foldable.Foldable(function (dictMonoid) {
3302− return function (f) {
3303− return Data_Foldable.foldl(foldableList)(function (acc) {
3304− return function ($158) {
3305− return Data_Semigroup.append(dictMonoid.Semigroup0())(acc)(f($158));
3306− };
3307− })(Data_Monoid.mempty(dictMonoid));
3308− };
3309− }, function (f) {
3310− var go = function ($copy_b) {
3311− return function ($copy_v) {
3312− var $tco_var_b = $copy_b;
3313− var $tco_done = false;
3314− var $tco_result;
3315− function $tco_loop(b, v) {
3316− if (v instanceof Nil) {
3317− $tco_done = true;
3318− return b;
3319− };
3320− if (v instanceof Cons) {
3321− $tco_var_b = f(b)(v.value0);
3322− $copy_v = v.value1;
3323− return;
3324− };
3325− throw new Error("Failed pattern match at Data.List.Types line 81, column 12 - line 83, column 30: " + [ v.constructor.name ]);
3326− };
3327− while (!$tco_done) {
3328− $tco_result = $tco_loop($tco_var_b, $copy_v);
3329− };
3330− return $tco_result;
3331− };
3332− };
3333− return go;
3334− }, function (f) {
3335− return function (b) {
3336− var rev = Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value);
3337− return function ($159) {
3338− return Data_Foldable.foldl(foldableList)(Data_Function.flip(f))(b)(rev($159));
3339− };
3340− };
3341− });
3342− var functorList = new Data_Functor.Functor(function (f) {
3343− return Data_Foldable.foldr(foldableList)(function (x) {
3344− return function (acc) {
3345− return new Cons(f(x), acc);
3346− };
3347− })(Nil.value);
3348− });
3349− var semigroupList = new Data_Semigroup.Semigroup(function (xs) {
3350− return function (ys) {
3351− return Data_Foldable.foldr(foldableList)(Cons.create)(ys)(xs);
3352− };
3353− });
3354− var showList = function (dictShow) {
3355− return new Data_Show.Show(function (v) {
3356− if (v instanceof Nil) {
3357− return "Nil";
3358− };
3359− return "(" + (Data_Foldable.intercalate(foldableList)(Data_Monoid.monoidString)(" : ")(Data_Functor.map(functorList)(Data_Show.show(dictShow))(v)) + " : Nil)");
3360− });
3361− };
3362− var showNonEmptyList = function (dictShow) {
3363− return new Data_Show.Show(function (v) {
3364− return "(NonEmptyList " + (Data_Show.show(Data_NonEmpty.showNonEmpty(dictShow)(showList(dictShow)))(v) + ")");
3365− });
3366− };
3367− var altList = new Control_Alt.Alt(function () {
3368− return functorList;
3369− }, Data_Semigroup.append(semigroupList));
3370− var plusList = new Control_Plus.Plus(function () {
3371− return altList;
3372− }, Nil.value);
3373− exports["Nil"] = Nil;
3374− exports["Cons"] = Cons;
3375− exports["NonEmptyList"] = NonEmptyList;
3376− exports["showList"] = showList;
3377− exports["semigroupList"] = semigroupList;
3378− exports["functorList"] = functorList;
3379− exports["foldableList"] = foldableList;
3380− exports["altList"] = altList;
3381− exports["plusList"] = plusList;
3382− exports["showNonEmptyList"] = showNonEmptyList;
3383−})(PS["Data.List.Types"] = PS["Data.List.Types"] || {});
3384−(function(exports) {
3385− // Generated by purs version 0.11.7
3386− "use strict";
3387− var Control_Applicative = PS["Control.Applicative"];
3388− var Control_Apply = PS["Control.Apply"];
3389− var Control_Bind = PS["Control.Bind"];
3390− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3391− var Data_Argonaut_Core = PS["Data.Argonaut.Core"];
3392− var Data_Bifunctor = PS["Data.Bifunctor"];
3393− var Data_Boolean = PS["Data.Boolean"];
3394− var Data_Either = PS["Data.Either"];
3395− var Data_Foldable = PS["Data.Foldable"];
3396− var Data_Function = PS["Data.Function"];
3397− var Data_Functor = PS["Data.Functor"];
3398− var Data_Int = PS["Data.Int"];
3399− var Data_List = PS["Data.List"];
3400− var Data_List_Types = PS["Data.List.Types"];
3401− var Data_Map = PS["Data.Map"];
3402− var Data_Maybe = PS["Data.Maybe"];
3403− var Data_Semigroup = PS["Data.Semigroup"];
3404− var Data_Show = PS["Data.Show"];
3405− var Data_StrMap = PS["Data.StrMap"];
3406− var Data_String = PS["Data.String"];
3407− var Data_Traversable = PS["Data.Traversable"];
3408− var Data_Tuple = PS["Data.Tuple"];
3409− var Data_Unit = PS["Data.Unit"];
3410− var Prelude = PS["Prelude"];
3411− var DecodeJson = function (decodeJson) {
3412− this.decodeJson = decodeJson;
3413− };
3414− var decodeJsonString = new DecodeJson(Data_Argonaut_Core.foldJsonString(new Data_Either.Left("Value is not a String"))(Data_Either.Right.create));
3415− var decodeJsonJson = new DecodeJson(Data_Either.Right.create);
3416− var decodeJson = function (dict) {
3417− return dict.decodeJson;
3418− };
3419− var decodeJObject = function ($33) {
3420− return Data_Maybe.maybe(new Data_Either.Left("Value is not an Object"))(Data_Either.Right.create)(Data_Argonaut_Core.toObject($33));
3421− };
3422− var decodeStrMap = function (dictDecodeJson) {
3423− return new DecodeJson(function ($34) {
3424− return Data_Bifunctor.lmap(Data_Either.bifunctorEither)(function (v) {
3425− return "Couldn't decode StrMap: " + v;
3426− })(Control_Bind.composeKleisliFlipped(Data_Either.bindEither)(Data_Traversable.traverse(Data_StrMap.traversableStrMap)(Data_Either.applicativeEither)(decodeJson(dictDecodeJson)))(decodeJObject)($34));
3427− });
3428− };
3429− exports["DecodeJson"] = DecodeJson;
3430− exports["decodeJson"] = decodeJson;
3431− exports["decodeJsonString"] = decodeJsonString;
3432− exports["decodeJsonJson"] = decodeJsonJson;
3433− exports["decodeStrMap"] = decodeStrMap;
3434−})(PS["Data.Argonaut.Decode.Class"] = PS["Data.Argonaut.Decode.Class"] || {});
3435−(function(exports) {
3436− // Generated by purs version 0.11.7
3437− "use strict";
3438− var Control_Applicative = PS["Control.Applicative"];
3439− var Data_Argonaut_Core = PS["Data.Argonaut.Core"];
3440− var Data_Argonaut_Decode_Class = PS["Data.Argonaut.Decode.Class"];
3441− var Data_Either = PS["Data.Either"];
3442− var Data_Function = PS["Data.Function"];
3443− var Data_Functor = PS["Data.Functor"];
3444− var Data_Maybe = PS["Data.Maybe"];
3445− var Data_Semigroup = PS["Data.Semigroup"];
3446− var Data_Show = PS["Data.Show"];
3447− var Data_StrMap = PS["Data.StrMap"];
3448− var Prelude = PS["Prelude"];
3449− var getField = function (dictDecodeJson) {
3450− return function (o) {
3451− return function (s) {
3452− return Data_Maybe.maybe(Data_Either.Left.create("Expected field " + Data_Show.show(Data_Show.showString)(s)))(Data_Argonaut_Decode_Class.decodeJson(dictDecodeJson))(Data_StrMap.lookup(s)(o));
3453− };
3454− };
3455− };
3456− exports["getField"] = getField;
3457−})(PS["Data.Argonaut.Decode.Combinators"] = PS["Data.Argonaut.Decode.Combinators"] || {});
3458−(function(exports) {
3459− // Generated by purs version 0.11.7
3460− "use strict";
3461− var Control_Category = PS["Control.Category"];
3462− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3463− var Data_Argonaut_Core = PS["Data.Argonaut.Core"];
3464− var Data_Either = PS["Data.Either"];
3465− var Data_Function = PS["Data.Function"];
3466− var Data_Functor = PS["Data.Functor"];
3467− var Data_Int = PS["Data.Int"];
3468− var Data_List = PS["Data.List"];
3469− var Data_List_Types = PS["Data.List.Types"];
3470− var Data_Map = PS["Data.Map"];
3471− var Data_Maybe = PS["Data.Maybe"];
3472− var Data_StrMap = PS["Data.StrMap"];
3473− var Data_String = PS["Data.String"];
3474− var Data_Tuple = PS["Data.Tuple"];
3475− var Data_Unfoldable = PS["Data.Unfoldable"];
3476− var Data_Void = PS["Data.Void"];
3477− var Prelude = PS["Prelude"];
3478− var EncodeJson = function (encodeJson) {
3479− this.encodeJson = encodeJson;
3480− };
3481− var encodeJsonJString = new EncodeJson(Data_Argonaut_Core.fromString);
3482− var encodeJson = function (dict) {
3483− return dict.encodeJson;
3484− };
3485− var encodeStrMap = function (dictEncodeJson) {
3486− return new EncodeJson(function ($23) {
3487− return Data_Argonaut_Core.fromObject(Data_Functor.map(Data_StrMap.functorStrMap)(encodeJson(dictEncodeJson))($23));
3488− });
3489− };
3490− exports["encodeJson"] = encodeJson;
3491− exports["EncodeJson"] = EncodeJson;
3492− exports["encodeJsonJString"] = encodeJsonJString;
3493− exports["encodeStrMap"] = encodeStrMap;
3494−})(PS["Data.Argonaut.Encode.Class"] = PS["Data.Argonaut.Encode.Class"] || {});
3495−(function(exports) {
3496− "use strict";
3497−
3498− exports._jsonParser = function (fail, succ, s) {
3499− try {
3500− return succ(JSON.parse(s));
3501− }
3502− catch (e) {
3503− return fail(e.message);
3504− }
3505− };
3506−})(PS["Data.Argonaut.Parser"] = PS["Data.Argonaut.Parser"] || {});
3507−(function(exports) {
3508− // Generated by purs version 0.11.7
3509− "use strict";
3510− var $foreign = PS["Data.Argonaut.Parser"];
3511− var Data_Argonaut_Core = PS["Data.Argonaut.Core"];
3512− var Data_Either = PS["Data.Either"];
3513− var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
3514− var jsonParser = function (j) {
3515− return $foreign._jsonParser(Data_Either.Left.create, Data_Either.Right.create, j);
3516− };
3517− exports["jsonParser"] = jsonParser;
3518−})(PS["Data.Argonaut.Parser"] = PS["Data.Argonaut.Parser"] || {});
3519−(function(exports) {
3520− "use strict";
3521−
3522− exports.toForeign = function (value) {
3523− return value;
3524− };
3525−
3526− exports.unsafeFromForeign = function (value) {
3527− return value;
3528− };
3529−
3530− exports.tagOf = function (value) {
3531− return Object.prototype.toString.call(value).slice(8, -1);
3532− };
3533−})(PS["Data.Foreign"] = PS["Data.Foreign"] || {});
3534−(function(exports) {
3535− // Generated by purs version 0.11.7
3536− "use strict";
3537− var Control_Bind = PS["Control.Bind"];
3538− var Control_Category = PS["Control.Category"];
3539− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3540− var Data_Boolean = PS["Data.Boolean"];
3541− var Data_Eq = PS["Data.Eq"];
3542− var Data_Foldable = PS["Data.Foldable"];
3543− var Data_Function = PS["Data.Function"];
3544− var Data_Functor = PS["Data.Functor"];
3545− var Data_List = PS["Data.List"];
3546− var Data_List_Types = PS["Data.List.Types"];
3547− var Data_Maybe = PS["Data.Maybe"];
3548− var Data_NonEmpty = PS["Data.NonEmpty"];
3549− var Data_Ord = PS["Data.Ord"];
3550− var Data_Ring = PS["Data.Ring"];
3551− var Data_Semigroup = PS["Data.Semigroup"];
3552− var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
3553− var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
3554− var Data_Semiring = PS["Data.Semiring"];
3555− var Data_Traversable = PS["Data.Traversable"];
3556− var Data_Tuple = PS["Data.Tuple"];
3557− var Data_Unfoldable = PS["Data.Unfoldable"];
3558− var Partial_Unsafe = PS["Partial.Unsafe"];
3559− var Prelude = PS["Prelude"];
3560− var singleton = function ($160) {
3561− return Data_List_Types.NonEmptyList(Data_NonEmpty.singleton(Data_List_Types.plusList)($160));
3562− };
3563− exports["singleton"] = singleton;
3564−})(PS["Data.List.NonEmpty"] = PS["Data.List.NonEmpty"] || {});
3565−(function(exports) {
3566− // Generated by purs version 0.11.7
3567− "use strict";
3568− var $foreign = PS["Data.Foreign"];
3569− var Control_Applicative = PS["Control.Applicative"];
3570− var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
3571− var Control_Monad_Except = PS["Control.Monad.Except"];
3572− var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
3573− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3574− var Data_Boolean = PS["Data.Boolean"];
3575− var Data_Either = PS["Data.Either"];
3576− var Data_Eq = PS["Data.Eq"];
3577− var Data_Function = PS["Data.Function"];
3578− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
3579− var Data_Identity = PS["Data.Identity"];
3580− var Data_Int = PS["Data.Int"];
3581− var Data_List_NonEmpty = PS["Data.List.NonEmpty"];
3582− var Data_Maybe = PS["Data.Maybe"];
3583− var Data_Ord = PS["Data.Ord"];
3584− var Data_Ordering = PS["Data.Ordering"];
3585− var Data_Semigroup = PS["Data.Semigroup"];
3586− var Data_Show = PS["Data.Show"];
3587− var Data_String = PS["Data.String"];
3588− var Prelude = PS["Prelude"];
3589− var ForeignError = (function () {
3590− function ForeignError(value0) {
3591− this.value0 = value0;
3592− };
3593− ForeignError.create = function (value0) {
3594− return new ForeignError(value0);
3595− };
3596− return ForeignError;
3597− })();
3598− var TypeMismatch = (function () {
3599− function TypeMismatch(value0, value1) {
3600− this.value0 = value0;
3601− this.value1 = value1;
3602− };
3603− TypeMismatch.create = function (value0) {
3604− return function (value1) {
3605− return new TypeMismatch(value0, value1);
3606− };
3607− };
3608− return TypeMismatch;
3609− })();
3610− var ErrorAtIndex = (function () {
3611− function ErrorAtIndex(value0, value1) {
3612− this.value0 = value0;
3613− this.value1 = value1;
3614− };
3615− ErrorAtIndex.create = function (value0) {
3616− return function (value1) {
3617− return new ErrorAtIndex(value0, value1);
3618− };
3619− };
3620− return ErrorAtIndex;
3621− })();
3622− var ErrorAtProperty = (function () {
3623− function ErrorAtProperty(value0, value1) {
3624− this.value0 = value0;
3625− this.value1 = value1;
3626− };
3627− ErrorAtProperty.create = function (value0) {
3628− return function (value1) {
3629− return new ErrorAtProperty(value0, value1);
3630− };
3631− };
3632− return ErrorAtProperty;
3633− })();
3634− var JSONError = (function () {
3635− function JSONError(value0) {
3636− this.value0 = value0;
3637− };
3638− JSONError.create = function (value0) {
3639− return new JSONError(value0);
3640− };
3641− return JSONError;
3642− })();
3643− var showForeignError = new Data_Show.Show(function (v) {
3644− if (v instanceof ForeignError) {
3645− return "(ForeignError " + (Data_Show.show(Data_Show.showString)(v.value0) + ")");
3646− };
3647− if (v instanceof ErrorAtIndex) {
3648− return "(ErrorAtIndex " + (Data_Show.show(Data_Show.showInt)(v.value0) + (" " + (Data_Show.show(showForeignError)(v.value1) + ")")));
3649− };
3650− if (v instanceof ErrorAtProperty) {
3651− return "(ErrorAtProperty " + (Data_Show.show(Data_Show.showString)(v.value0) + (" " + (Data_Show.show(showForeignError)(v.value1) + ")")));
3652− };
3653− if (v instanceof JSONError) {
3654− return "(JSONError " + (Data_Show.show(Data_Show.showString)(v.value0) + ")");
3655− };
3656− if (v instanceof TypeMismatch) {
3657− return "(TypeMismatch " + (Data_Show.show(Data_Show.showString)(v.value0) + (" " + (Data_Show.show(Data_Show.showString)(v.value1) + ")")));
3658− };
3659− throw new Error("Failed pattern match at Data.Foreign line 64, column 1 - line 64, column 47: " + [ v.constructor.name ]);
3660− });
3661− var fail = function ($121) {
3662− return Control_Monad_Error_Class.throwError(Control_Monad_Except_Trans.monadThrowExceptT(Data_Identity.monadIdentity))(Data_List_NonEmpty.singleton($121));
3663− };
3664− var unsafeReadTagged = function (tag) {
3665− return function (value) {
3666− if ($foreign.tagOf(value) === tag) {
3667− return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))($foreign.unsafeFromForeign(value));
3668− };
3669− if (Data_Boolean.otherwise) {
3670− return fail(new TypeMismatch(tag, $foreign.tagOf(value)));
3671− };
3672− throw new Error("Failed pattern match at Data.Foreign line 104, column 1 - line 104, column 55: " + [ tag.constructor.name, value.constructor.name ]);
3673− };
3674− };
3675− var readString = unsafeReadTagged("String");
3676− exports["ForeignError"] = ForeignError;
3677− exports["TypeMismatch"] = TypeMismatch;
3678− exports["ErrorAtIndex"] = ErrorAtIndex;
3679− exports["ErrorAtProperty"] = ErrorAtProperty;
3680− exports["JSONError"] = JSONError;
3681− exports["unsafeReadTagged"] = unsafeReadTagged;
3682− exports["readString"] = readString;
3683− exports["fail"] = fail;
3684− exports["showForeignError"] = showForeignError;
3685− exports["toForeign"] = $foreign.toForeign;
3686−})(PS["Data.Foreign"] = PS["Data.Foreign"] || {});
3687−(function(exports) {
3688− // Generated by purs version 0.11.7
3689− "use strict";
3690− var Control_Apply = PS["Control.Apply"];
3691− var Data_Either = PS["Data.Either"];
3692− var Data_Eq = PS["Data.Eq"];
3693− var Data_Generic = PS["Data.Generic"];
3694− var Data_Maybe = PS["Data.Maybe"];
3695− var Data_Ord = PS["Data.Ord"];
3696− var Data_Ordering = PS["Data.Ordering"];
3697− var Data_Semigroup = PS["Data.Semigroup"];
3698− var Data_Show = PS["Data.Show"];
3699− var Data_String = PS["Data.String"];
3700− var Data_Unit = PS["Data.Unit"];
3701− var Prelude = PS["Prelude"];
3702− var OPTIONS = (function () {
3703− function OPTIONS() {
3704−
3705− };
3706− OPTIONS.value = new OPTIONS();
3707− return OPTIONS;
3708− })();
3709− var GET = (function () {
3710− function GET() {
3711−
3712− };
3713− GET.value = new GET();
3714− return GET;
3715− })();
3716− var HEAD = (function () {
3717− function HEAD() {
3718−
3719− };
3720− HEAD.value = new HEAD();
3721− return HEAD;
3722− })();
3723− var POST = (function () {
3724− function POST() {
3725−
3726− };
3727− POST.value = new POST();
3728− return POST;
3729− })();
3730− var PUT = (function () {
3731− function PUT() {
3732−
3733− };
3734− PUT.value = new PUT();
3735− return PUT;
3736− })();
3737− var DELETE = (function () {
3738− function DELETE() {
3739−
3740− };
3741− DELETE.value = new DELETE();
3742− return DELETE;
3743− })();
3744− var TRACE = (function () {
3745− function TRACE() {
3746−
3747− };
3748− TRACE.value = new TRACE();
3749− return TRACE;
3750− })();
3751− var CONNECT = (function () {
3752− function CONNECT() {
3753−
3754− };
3755− CONNECT.value = new CONNECT();
3756− return CONNECT;
3757− })();
3758− var PROPFIND = (function () {
3759− function PROPFIND() {
3760−
3761− };
3762− PROPFIND.value = new PROPFIND();
3763− return PROPFIND;
3764− })();
3765− var PROPPATCH = (function () {
3766− function PROPPATCH() {
3767−
3768− };
3769− PROPPATCH.value = new PROPPATCH();
3770− return PROPPATCH;
3771− })();
3772− var MKCOL = (function () {
3773− function MKCOL() {
3774−
3775− };
3776− MKCOL.value = new MKCOL();
3777− return MKCOL;
3778− })();
3779− var COPY = (function () {
3780− function COPY() {
3781−
3782− };
3783− COPY.value = new COPY();
3784− return COPY;
3785− })();
3786− var MOVE = (function () {
3787− function MOVE() {
3788−
3789− };
3790− MOVE.value = new MOVE();
3791− return MOVE;
3792− })();
3793− var LOCK = (function () {
3794− function LOCK() {
3795−
3796− };
3797− LOCK.value = new LOCK();
3798− return LOCK;
3799− })();
3800− var UNLOCK = (function () {
3801− function UNLOCK() {
3802−
3803− };
3804− UNLOCK.value = new UNLOCK();
3805− return UNLOCK;
3806− })();
3807− var PATCH = (function () {
3808− function PATCH() {
3809−
3810− };
3811− PATCH.value = new PATCH();
3812− return PATCH;
3813− })();
3814− var unCustomMethod = function (v) {
3815− return v;
3816− };
3817− var showMethod = new Data_Show.Show(function (v) {
3818− if (v instanceof OPTIONS) {
3819− return "OPTIONS";
3820− };
3821− if (v instanceof GET) {
3822− return "GET";
3823− };
3824− if (v instanceof HEAD) {
3825− return "HEAD";
3826− };
3827− if (v instanceof POST) {
3828− return "POST";
3829− };
3830− if (v instanceof PUT) {
3831− return "PUT";
3832− };
3833− if (v instanceof DELETE) {
3834− return "DELETE";
3835− };
3836− if (v instanceof TRACE) {
3837− return "TRACE";
3838− };
3839− if (v instanceof CONNECT) {
3840− return "CONNECT";
3841− };
3842− if (v instanceof PROPFIND) {
3843− return "PROPFIND";
3844− };
3845− if (v instanceof PROPPATCH) {
3846− return "PROPPATCH";
3847− };
3848− if (v instanceof MKCOL) {
3849− return "MKCOL";
3850− };
3851− if (v instanceof COPY) {
3852− return "COPY";
3853− };
3854− if (v instanceof MOVE) {
3855− return "MOVE";
3856− };
3857− if (v instanceof LOCK) {
3858− return "LOCK";
3859− };
3860− if (v instanceof UNLOCK) {
3861− return "UNLOCK";
3862− };
3863− if (v instanceof PATCH) {
3864− return "PATCH";
3865− };
3866− throw new Error("Failed pattern match at Data.HTTP.Method line 42, column 1 - line 42, column 35: " + [ v.constructor.name ]);
3867− });
3868− var print = Data_Either.either(Data_Show.show(showMethod))(unCustomMethod);
3869− exports["OPTIONS"] = OPTIONS;
3870− exports["GET"] = GET;
3871− exports["HEAD"] = HEAD;
3872− exports["POST"] = POST;
3873− exports["PUT"] = PUT;
3874− exports["DELETE"] = DELETE;
3875− exports["TRACE"] = TRACE;
3876− exports["CONNECT"] = CONNECT;
3877− exports["PROPFIND"] = PROPFIND;
3878− exports["PROPPATCH"] = PROPPATCH;
3879− exports["MKCOL"] = MKCOL;
3880− exports["COPY"] = COPY;
3881− exports["MOVE"] = MOVE;
3882− exports["LOCK"] = LOCK;
3883− exports["UNLOCK"] = UNLOCK;
3884− exports["PATCH"] = PATCH;
3885− exports["unCustomMethod"] = unCustomMethod;
3886− exports["print"] = print;
3887− exports["showMethod"] = showMethod;
3888−})(PS["Data.HTTP.Method"] = PS["Data.HTTP.Method"] || {});
3889−(function(exports) {
3890− // Generated by purs version 0.11.7
3891− "use strict";
3892− var Control_Apply = PS["Control.Apply"];
3893− var Data_Eq = PS["Data.Eq"];
3894− var Data_Generic = PS["Data.Generic"];
3895− var Data_Maybe = PS["Data.Maybe"];
3896− var Data_Newtype = PS["Data.Newtype"];
3897− var Data_Ord = PS["Data.Ord"];
3898− var Data_Semigroup = PS["Data.Semigroup"];
3899− var Data_Show = PS["Data.Show"];
3900− var Data_Unit = PS["Data.Unit"];
3901− var Prelude = PS["Prelude"];
3902− var MediaType = function (x) {
3903− return x;
3904− };
3905− var newtypeMediaType = new Data_Newtype.Newtype(function (n) {
3906− return n;
3907− }, MediaType);
3908− exports["MediaType"] = MediaType;
3909− exports["newtypeMediaType"] = newtypeMediaType;
3910−})(PS["Data.MediaType"] = PS["Data.MediaType"] || {});
3911−(function(exports) {
3912− // Generated by purs version 0.11.7
3913− "use strict";
3914− var Data_MediaType = PS["Data.MediaType"];
3915− var applicationJSON = "application/json";
3916− exports["applicationJSON"] = applicationJSON;
3917−})(PS["Data.MediaType.Common"] = PS["Data.MediaType.Common"] || {});
3918−(function(exports) {
3919− "use strict";
3920−
3921− exports["null"] = null;
3922−
3923− exports.notNull = function (x) {
3924− return x;
3925− };
3926−})(PS["Data.Nullable"] = PS["Data.Nullable"] || {});
3927−(function(exports) {
3928− // Generated by purs version 0.11.7
3929− "use strict";
3930− var $foreign = PS["Data.Nullable"];
3931− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3932− var Data_Eq = PS["Data.Eq"];
3933− var Data_Function = PS["Data.Function"];
3934− var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
3935− var Data_Maybe = PS["Data.Maybe"];
3936− var Data_Ord = PS["Data.Ord"];
3937− var Data_Show = PS["Data.Show"];
3938− var Prelude = PS["Prelude"];
3939− var toNullable = Data_Maybe.maybe($foreign["null"])($foreign.notNull);
3940− exports["toNullable"] = toNullable;
3941−})(PS["Data.Nullable"] = PS["Data.Nullable"] || {});
3942−(function(exports) {
3943− "use strict";
3944−
3945− // Alias require to prevent webpack or browserify from actually requiring.
3946− var req = typeof module === "undefined" ? undefined : module.require;
3947− var util = req === undefined ? undefined : req("util");
3948−
3949− exports.traceAny = function () {
3950− return function (x) {
3951− return function (k) {
3952− // node only recurses two levels into an object before printing
3953− // "[object]" for further objects when using console.log()
3954− if (util !== undefined) {
3955− console.log(util.inspect(x, { depth: null, colors: true }));
3956− } else {
3957− console.log(x);
3958− }
3959− return k({});
3960− };
3961− };
3962− };
3963−})(PS["Debug.Trace"] = PS["Debug.Trace"] || {});
3964−(function(exports) {
3965− // Generated by purs version 0.11.7
3966− "use strict";
3967− var $foreign = PS["Debug.Trace"];
3968− var Control_Applicative = PS["Control.Applicative"];
3969− var Control_Semigroupoid = PS["Control.Semigroupoid"];
3970− var Data_Show = PS["Data.Show"];
3971− var Data_Unit = PS["Data.Unit"];
3972− var Prelude = PS["Prelude"];
3973− var DebugWarning = {};
3974− var warn = function (dictWarn) {
3975− return DebugWarning;
3976− };
3977− var traceAnyA = function (dictDebugWarning) {
3978− return function (dictApplicative) {
3979− return function (s) {
3980− return $foreign.traceAny(dictDebugWarning)(s)(function (v) {
3981− return Control_Applicative.pure(dictApplicative)(Data_Unit.unit);
3982− });
3983− };
3984− };
3985− };
3986− exports["DebugWarning"] = DebugWarning;
3987− exports["traceAnyA"] = traceAnyA;
3988− exports["warn"] = warn;
3989−})(PS["Debug.Trace"] = PS["Debug.Trace"] || {});
3990−(function(exports) {
3991− /* global exports */
3992− /* global XMLHttpRequest */
3993− /* global module */
3994− /* global process */
3995− "use strict";
3996−
3997− exports._ajax = function () {
3998− var platformSpecific = { };
3999− if (typeof module !== "undefined" && module.require && !(typeof process !== "undefined" && process.versions["electron"])) {
4000− // We are on node.js
4001− platformSpecific.newXHR = function () {
4002− var XHR = module.require("xhr2");
4003− return new XHR();
4004− };
4005−
4006− platformSpecific.fixupUrl = function (url) {
4007− var urllib = module.require("url");
4008− var u = urllib.parse(url);
4009− u.protocol = u.protocol || "http:";
4010− u.hostname = u.hostname || "localhost";
4011− return urllib.format(u);
4012− };
4013−
4014− platformSpecific.getResponse = function (xhr) {
4015− return xhr.response;
4016− };
4017− } else {
4018− // We are in the browser
4019− platformSpecific.newXHR = function () {
4020− return new XMLHttpRequest();
4021− };
4022−
4023− platformSpecific.fixupUrl = function (url) {
4024− return url || "/";
4025− };
4026−
4027− platformSpecific.getResponse = function (xhr) {
4028− return xhr.response;
4029− };
4030− }
4031−
4032− return function (mkHeader, options) {
4033− return function (errback, callback) {
4034− var xhr = platformSpecific.newXHR();
4035− var fixedUrl = platformSpecific.fixupUrl(options.url);
4036− xhr.open(options.method || "GET", fixedUrl, true, options.username, options.password);
4037− if (options.headers) {
4038− try {
4039− for (var i = 0, header; (header = options.headers[i]) != null; i++) {
4040− xhr.setRequestHeader(header.field, header.value);
4041− }
4042− } catch (e) {
4043− errback(e);
4044− }
4045− }
4046− xhr.onerror = function () {
4047− errback(new Error("AJAX request failed: " + options.method + " " + options.url));
4048− };
4049− xhr.onload = function () {
4050− callback({
4051− status: xhr.status,
4052− headers: xhr.getAllResponseHeaders().split("\r\n")
4053− .filter(function (header) {
4054− return header.length > 0;
4055− })
4056− .map(function (header) {
4057− var i = header.indexOf(":");
4058− return mkHeader(header.substring(0, i))(header.substring(i + 2));
4059− }),
4060− response: platformSpecific.getResponse(xhr)
4061− });
4062− };
4063− xhr.responseType = options.responseType;
4064− xhr.withCredentials = options.withCredentials;
4065− xhr.send(options.content);
4066−
4067− return function (/* error */) {
4068− return function (cancelErrback, cancelCallback) {
4069− try {
4070− xhr.abort();
4071− } catch (e) {
4072− return cancelErrback(e);
4073− }
4074− return cancelCallback();
4075− };
4076− };
4077− };
4078− };
4079− }();
4080−})(PS["Network.HTTP.Affjax"] = PS["Network.HTTP.Affjax"] || {});
4081−(function(exports) {
4082− // Generated by purs version 0.11.7
4083− "use strict";
4084− var Control_Semigroupoid = PS["Control.Semigroupoid"];
4085− var DOM_File_Types = PS["DOM.File.Types"];
4086− var DOM_Node_Types = PS["DOM.Node.Types"];
4087− var DOM_XHR_Types = PS["DOM.XHR.Types"];
4088− var Data_Argonaut_Core = PS["Data.Argonaut.Core"];
4089− var Data_ArrayBuffer_Types = PS["Data.ArrayBuffer.Types"];
4090− var Data_FormURLEncoded = PS["Data.FormURLEncoded"];
4091− var Data_Maybe = PS["Data.Maybe"];
4092− var Data_MediaType = PS["Data.MediaType"];
4093− var Data_MediaType_Common = PS["Data.MediaType.Common"];
4094− var Data_Show = PS["Data.Show"];
4095− var Data_Tuple = PS["Data.Tuple"];
4096− var Prelude = PS["Prelude"];
4097− var Unsafe_Coerce = PS["Unsafe.Coerce"];
4098− var Requestable = function (toRequest) {
4099− this.toRequest = toRequest;
4100− };
4101− var toRequest = function (dict) {
4102− return dict.toRequest;
4103− };
4104− var requestableJson = new Requestable(function (json) {
4105− return new Data_Tuple.Tuple(new Data_Maybe.Just(Data_MediaType_Common.applicationJSON), Data_Show.show(Data_Argonaut_Core.showJson)(json));
4106− });
4107− var defaultToRequest = function ($0) {
4108− return Data_Tuple.Tuple.create(Data_Maybe.Nothing.value)($0);
4109− };
4110− var requestableUnit = new Requestable(defaultToRequest);
4111− exports["Requestable"] = Requestable;
4112− exports["toRequest"] = toRequest;
4113− exports["requestableJson"] = requestableJson;
4114− exports["requestableUnit"] = requestableUnit;
4115−})(PS["Network.HTTP.Affjax.Request"] = PS["Network.HTTP.Affjax.Request"] || {});
4116−(function(exports) {
4117− // Generated by purs version 0.11.7
4118− "use strict";
4119− var Control_Applicative = PS["Control.Applicative"];
4120− var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
4121− var Control_Semigroupoid = PS["Control.Semigroupoid"];
4122− var DOM_File_Types = PS["DOM.File.Types"];
4123− var DOM_Node_Types = PS["DOM.Node.Types"];
4124− var Data_Argonaut_Core = PS["Data.Argonaut.Core"];
4125− var Data_ArrayBuffer_Types = PS["Data.ArrayBuffer.Types"];
4126− var Data_Eq = PS["Data.Eq"];
4127− var Data_Foreign = PS["Data.Foreign"];
4128− var Data_Function = PS["Data.Function"];
4129− var Data_Identity = PS["Data.Identity"];
4130− var Data_Maybe = PS["Data.Maybe"];
4131− var Data_MediaType = PS["Data.MediaType"];
4132− var Data_MediaType_Common = PS["Data.MediaType.Common"];
4133− var Data_Show = PS["Data.Show"];
4134− var Data_Tuple = PS["Data.Tuple"];
4135− var Data_Unit = PS["Data.Unit"];
4136− var Prelude = PS["Prelude"];
4137− var Unsafe_Coerce = PS["Unsafe.Coerce"];
4138− var ArrayBufferResponse = (function () {
4139− function ArrayBufferResponse() {
4140−
4141− };
4142− ArrayBufferResponse.value = new ArrayBufferResponse();
4143− return ArrayBufferResponse;
4144− })();
4145− var BlobResponse = (function () {
4146− function BlobResponse() {
4147−
4148− };
4149− BlobResponse.value = new BlobResponse();
4150− return BlobResponse;
4151− })();
4152− var DocumentResponse = (function () {
4153− function DocumentResponse() {
4154−
4155− };
4156− DocumentResponse.value = new DocumentResponse();
4157− return DocumentResponse;
4158− })();
4159− var JSONResponse = (function () {
4160− function JSONResponse() {
4161−
4162− };
4163− JSONResponse.value = new JSONResponse();
4164− return JSONResponse;
4165− })();
4166− var StringResponse = (function () {
4167− function StringResponse() {
4168−
4169− };
4170− StringResponse.value = new StringResponse();
4171− return StringResponse;
4172− })();
4173− var Respondable = function (fromResponse, responseType) {
4174− this.fromResponse = fromResponse;
4175− this.responseType = responseType;
4176− };
4177− var responseTypeToString = function (v) {
4178− if (v instanceof ArrayBufferResponse) {
4179− return "arraybuffer";
4180− };
4181− if (v instanceof BlobResponse) {
4182− return "blob";
4183− };
4184− if (v instanceof DocumentResponse) {
4185− return "document";
4186− };
4187− if (v instanceof JSONResponse) {
4188− return "text";
4189− };
4190− if (v instanceof StringResponse) {
4191− return "text";
4192− };
4193− throw new Error("Failed pattern match at Network.HTTP.Affjax.Response line 48, column 1 - line 48, column 61: " + [ v.constructor.name ]);
4194− };
4195− var responseType = function (dict) {
4196− return dict.responseType;
4197− };
4198− var responsableString = new Respondable(Data_Foreign.readString, new Data_Tuple.Tuple(Data_Maybe.Nothing.value, StringResponse.value));
4199− var responsableJson = new Respondable(function ($8) {
4200− return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))($8);
4201− }, new Data_Tuple.Tuple(new Data_Maybe.Just(Data_MediaType_Common.applicationJSON), JSONResponse.value));
4202− var fromResponse = function (dict) {
4203− return dict.fromResponse;
4204− };
4205− exports["ArrayBufferResponse"] = ArrayBufferResponse;
4206− exports["BlobResponse"] = BlobResponse;
4207− exports["DocumentResponse"] = DocumentResponse;
4208− exports["JSONResponse"] = JSONResponse;
4209− exports["StringResponse"] = StringResponse;
4210− exports["responseTypeToString"] = responseTypeToString;
4211− exports["Respondable"] = Respondable;
4212− exports["responseType"] = responseType;
4213− exports["fromResponse"] = fromResponse;
4214− exports["responsableString"] = responsableString;
4215− exports["responsableJson"] = responsableJson;
4216−})(PS["Network.HTTP.Affjax.Response"] = PS["Network.HTTP.Affjax.Response"] || {});
4217−(function(exports) {
4218− // Generated by purs version 0.11.7
4219− "use strict";
4220− var Data_Eq = PS["Data.Eq"];
4221− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
4222− var Data_MediaType = PS["Data.MediaType"];
4223− var Data_Newtype = PS["Data.Newtype"];
4224− var Data_Semigroup = PS["Data.Semigroup"];
4225− var Data_Show = PS["Data.Show"];
4226− var Prelude = PS["Prelude"];
4227− var Accept = (function () {
4228− function Accept(value0) {
4229− this.value0 = value0;
4230− };
4231− Accept.create = function (value0) {
4232− return new Accept(value0);
4233− };
4234− return Accept;
4235− })();
4236− var ContentType = (function () {
4237− function ContentType(value0) {
4238− this.value0 = value0;
4239− };
4240− ContentType.create = function (value0) {
4241− return new ContentType(value0);
4242− };
4243− return ContentType;
4244− })();
4245− var RequestHeader = (function () {
4246− function RequestHeader(value0, value1) {
4247− this.value0 = value0;
4248− this.value1 = value1;
4249− };
4250− RequestHeader.create = function (value0) {
4251− return function (value1) {
4252− return new RequestHeader(value0, value1);
4253− };
4254− };
4255− return RequestHeader;
4256− })();
4257− var requestHeaderValue = function (v) {
4258− if (v instanceof Accept) {
4259− return Data_Newtype.unwrap(Data_MediaType.newtypeMediaType)(v.value0);
4260− };
4261− if (v instanceof ContentType) {
4262− return Data_Newtype.unwrap(Data_MediaType.newtypeMediaType)(v.value0);
4263− };
4264− if (v instanceof RequestHeader) {
4265− return v.value1;
4266− };
4267− throw new Error("Failed pattern match at Network.HTTP.RequestHeader line 29, column 1 - line 29, column 46: " + [ v.constructor.name ]);
4268− };
4269− var requestHeaderName = function (v) {
4270− if (v instanceof Accept) {
4271− return "Accept";
4272− };
4273− if (v instanceof ContentType) {
4274− return "Content-Type";
4275− };
4276− if (v instanceof RequestHeader) {
4277− return v.value0;
4278− };
4279− throw new Error("Failed pattern match at Network.HTTP.RequestHeader line 24, column 1 - line 24, column 45: " + [ v.constructor.name ]);
4280− };
4281− exports["Accept"] = Accept;
4282− exports["ContentType"] = ContentType;
4283− exports["RequestHeader"] = RequestHeader;
4284− exports["requestHeaderName"] = requestHeaderName;
4285− exports["requestHeaderValue"] = requestHeaderValue;
4286−})(PS["Network.HTTP.RequestHeader"] = PS["Network.HTTP.RequestHeader"] || {});
4287−(function(exports) {
4288− // Generated by purs version 0.11.7
4289− "use strict";
4290− var Control_Apply = PS["Control.Apply"];
4291− var Data_Eq = PS["Data.Eq"];
4292− var Data_Generic = PS["Data.Generic"];
4293− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
4294− var Data_Maybe = PS["Data.Maybe"];
4295− var Data_Semigroup = PS["Data.Semigroup"];
4296− var Data_Show = PS["Data.Show"];
4297− var Data_Unit = PS["Data.Unit"];
4298− var Prelude = PS["Prelude"];
4299− var ResponseHeader = (function () {
4300− function ResponseHeader(value0, value1) {
4301− this.value0 = value0;
4302− this.value1 = value1;
4303− };
4304− ResponseHeader.create = function (value0) {
4305− return function (value1) {
4306− return new ResponseHeader(value0, value1);
4307− };
4308− };
4309− return ResponseHeader;
4310− })();
4311− var responseHeader = function (field) {
4312− return function (value) {
4313− return new ResponseHeader(field, value);
4314− };
4315− };
4316− exports["responseHeader"] = responseHeader;
4317−})(PS["Network.HTTP.ResponseHeader"] = PS["Network.HTTP.ResponseHeader"] || {});
4318−(function(exports) {
4319− // Generated by purs version 0.11.7
4320− "use strict";
4321− var $foreign = PS["Network.HTTP.Affjax"];
4322− var Control_Applicative = PS["Control.Applicative"];
4323− var Control_Bind = PS["Control.Bind"];
4324− var Control_Monad_Aff = PS["Control.Monad.Aff"];
4325− var Control_Monad_Aff_Compat = PS["Control.Monad.Aff.Compat"];
4326− var Control_Monad_Eff = PS["Control.Monad.Eff"];
4327− var Control_Monad_Eff_Class = PS["Control.Monad.Eff.Class"];
4328− var Control_Monad_Eff_Exception = PS["Control.Monad.Eff.Exception"];
4329− var Control_Monad_Eff_Ref = PS["Control.Monad.Eff.Ref"];
4330− var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
4331− var Control_Monad_Except = PS["Control.Monad.Except"];
4332− var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
4333− var Control_Parallel = PS["Control.Parallel"];
4334− var Control_Semigroupoid = PS["Control.Semigroupoid"];
4335− var Data_Argonaut_Parser = PS["Data.Argonaut.Parser"];
4336− var Data_Array = PS["Data.Array"];
4337− var Data_Either = PS["Data.Either"];
4338− var Data_Eq = PS["Data.Eq"];
4339− var Data_Foldable = PS["Data.Foldable"];
4340− var Data_Foreign = PS["Data.Foreign"];
4341− var Data_Function = PS["Data.Function"];
4342− var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
4343− var Data_Functor = PS["Data.Functor"];
4344− var Data_HTTP_Method = PS["Data.HTTP.Method"];
4345− var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
4346− var Data_Identity = PS["Data.Identity"];
4347− var Data_Int = PS["Data.Int"];
4348− var Data_List_Types = PS["Data.List.Types"];
4349− var Data_Maybe = PS["Data.Maybe"];
4350− var Data_MediaType = PS["Data.MediaType"];
4351− var Data_Nullable = PS["Data.Nullable"];
4352− var Data_Ring = PS["Data.Ring"];
4353− var Data_Semiring = PS["Data.Semiring"];
4354− var Data_Show = PS["Data.Show"];
4355− var Data_Time_Duration = PS["Data.Time.Duration"];
4356− var Data_Tuple = PS["Data.Tuple"];
4357− var $$Math = PS["Math"];
4358− var Network_HTTP_Affjax_Request = PS["Network.HTTP.Affjax.Request"];
4359− var Network_HTTP_Affjax_Response = PS["Network.HTTP.Affjax.Response"];
4360− var Network_HTTP_RequestHeader = PS["Network.HTTP.RequestHeader"];
4361− var Network_HTTP_ResponseHeader = PS["Network.HTTP.ResponseHeader"];
4362− var Network_HTTP_StatusCode = PS["Network.HTTP.StatusCode"];
4363− var Prelude = PS["Prelude"];
4364− var defaultRequest = {
4365− method: new Data_Either.Left(Data_HTTP_Method.GET.value),
4366− url: "/",
4367− headers: [ ],
4368− content: Data_Maybe.Nothing.value,
4369− username: Data_Maybe.Nothing.value,
4370− password: Data_Maybe.Nothing.value,
4371− withCredentials: false
4372− };
4373− var affjax = function (dictRequestable) {
4374− return function (dictRespondable) {
4375− return function (req) {
4376− var responseSettings = Network_HTTP_Affjax_Response.responseType(dictRespondable);
4377− var requestSettings = (function () {
4378− var v = Data_Functor.map(Data_Maybe.functorMaybe)(Network_HTTP_Affjax_Request.toRequest(dictRequestable))(req.content);
4379− if (v instanceof Data_Maybe.Nothing) {
4380− return new Data_Tuple.Tuple(Data_Maybe.Nothing.value, Data_Maybe.Nothing.value);
4381− };
4382− if (v instanceof Data_Maybe.Just) {
4383− return new Data_Tuple.Tuple(v.value0.value0, new Data_Maybe.Just(v.value0.value1));
4384− };
4385− throw new Error("Failed pattern match at Network.HTTP.Affjax line 250, column 21 - line 252, column 49: " + [ v.constructor.name ]);
4386− })();
4387− var parseJSON = function ($98) {
4388− return Data_Either.either(function ($99) {
4389− return Data_Foreign.fail(Data_Foreign.JSONError.create($99));
4390− })(function ($100) {
4391− return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(Data_Foreign.toForeign($100));
4392− })(Data_Argonaut_Parser.jsonParser($98));
4393− };
4394− var fromResponse$prime = (function () {
4395− var v = Data_Tuple.snd(responseSettings);
4396− if (v instanceof Network_HTTP_Affjax_Response.JSONResponse) {
4397− return Control_Bind.composeKleisliFlipped(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Network_HTTP_Affjax_Response.fromResponse(dictRespondable))(Control_Bind.composeKleisliFlipped(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(parseJSON)(Data_Foreign.readString));
4398− };
4399− return Network_HTTP_Affjax_Response.fromResponse(dictRespondable);
4400− })();
4401− var addHeader = function (mh) {
4402− return function (hs) {
4403− if (mh instanceof Data_Maybe.Just && !Data_Foldable.any(Data_Foldable.foldableArray)(Data_HeytingAlgebra.heytingAlgebraBoolean)(Data_Function.on(Data_Eq.eq(Data_Eq.eqString))(Network_HTTP_RequestHeader.requestHeaderName)(mh.value0))(hs)) {
4404− return Data_Array.snoc(hs)(mh.value0);
4405− };
4406− return hs;
4407− };
4408− };
4409− var headers = addHeader(Data_Functor.map(Data_Maybe.functorMaybe)(Network_HTTP_RequestHeader.ContentType.create)(Data_Tuple.fst(requestSettings)))(addHeader(Data_Functor.map(Data_Maybe.functorMaybe)(Network_HTTP_RequestHeader.Accept.create)(Data_Tuple.fst(responseSettings)))(req.headers));
4410− var req$prime = {
4411− method: Data_HTTP_Method.print(req.method),
4412− url: req.url,
4413− headers: Data_Functor.map(Data_Functor.functorArray)(function (h) {
4414− return {
4415− field: Network_HTTP_RequestHeader.requestHeaderName(h),
4416− value: Network_HTTP_RequestHeader.requestHeaderValue(h)
4417− };
4418− })(headers),
4419− content: Data_Nullable.toNullable(Data_Tuple.snd(requestSettings)),
4420− responseType: Network_HTTP_Affjax_Response.responseTypeToString(Data_Tuple.snd(responseSettings)),
4421− username: Data_Nullable.toNullable(req.username),
4422− password: Data_Nullable.toNullable(req.password),
4423− withCredentials: req.withCredentials
4424− };
4425− return Control_Bind.bind(Control_Monad_Aff.bindAff)(Control_Monad_Aff_Compat.fromEffFnAff($foreign._ajax(Network_HTTP_ResponseHeader.responseHeader, req$prime)))(function (v) {
4426− var v1 = Data_Functor.map(Data_Either.functorEither)(function (v2) {
4427− var $68 = {};
4428− for (var $69 in v) {
4429− if ({}.hasOwnProperty.call(v, $69)) {
4430− $68[$69] = v[$69];
4431− };
4432− };
4433− $68.response = v2;
4434− return $68;
4435− })(Control_Monad_Except.runExcept(fromResponse$prime(v.response)));
4436− if (v1 instanceof Data_Either.Left) {
4437− return Control_Monad_Error_Class.throwError(Control_Monad_Aff.monadThrowAff)(Control_Monad_Eff_Exception.error(Data_Show.show(Data_List_Types.showNonEmptyList(Data_Foreign.showForeignError))(v1.value0)));
4438− };
4439− if (v1 instanceof Data_Either.Right) {
4440− return Control_Applicative.pure(Control_Monad_Aff.applicativeAff)(v1.value0);
4441− };
4442− throw new Error("Failed pattern match at Network.HTTP.Affjax line 232, column 3 - line 234, column 28: " + [ v1.constructor.name ]);
4443− });
4444− };
4445− };
4446− };
4447− var $$delete = function (dictRespondable) {
4448− return function (u) {
4449− return affjax(Network_HTTP_Affjax_Request.requestableUnit)(dictRespondable)((function () {
4450− var $74 = {};
4451− for (var $75 in defaultRequest) {
4452− if ({}.hasOwnProperty.call(defaultRequest, $75)) {
4453− $74[$75] = defaultRequest[$75];
4454− };
4455− };
4456− $74.method = new Data_Either.Left(Data_HTTP_Method.DELETE.value);
4457− $74.url = u;
4458− return $74;
4459− })());
4460− };
4461− };
4462− var get = function (dictRespondable) {
4463− return function (u) {
4464− return affjax(Network_HTTP_Affjax_Request.requestableUnit)(dictRespondable)((function () {
4465− var $77 = {};
4466− for (var $78 in defaultRequest) {
4467− if ({}.hasOwnProperty.call(defaultRequest, $78)) {
4468− $77[$78] = defaultRequest[$78];
4469− };
4470− };
4471− $77.url = u;
4472− return $77;
4473− })());
4474− };
4475− };
4476− var post = function (dictRequestable) {
4477− return function (dictRespondable) {
4478− return function (u) {
4479− return function (c) {
4480− return affjax(dictRequestable)(dictRespondable)((function () {
4481− var $86 = {};
4482− for (var $87 in defaultRequest) {
4483− if ({}.hasOwnProperty.call(defaultRequest, $87)) {
4484− $86[$87] = defaultRequest[$87];
4485− };
4486− };
4487− $86.method = new Data_Either.Left(Data_HTTP_Method.POST.value);
4488− $86.url = u;
4489− $86.content = new Data_Maybe.Just(c);
4490− return $86;
4491− })());
4492− };
4493− };
4494− };
4495− };
4496− exports["defaultRequest"] = defaultRequest;
4497− exports["affjax"] = affjax;
4498− exports["get"] = get;
4499− exports["post"] = post;
4500− exports["delete"] = $$delete;
4501−})(PS["Network.HTTP.Affjax"] = PS["Network.HTTP.Affjax"] || {});
4502−(function(exports) {
4503− "use strict";
4504− var Control_Bind = PS["Control.Bind"];
4505− var Control_Monad_Aff = PS["Control.Monad.Aff"];
4506− var Control_Monad_Eff = PS["Control.Monad.Eff"];
4507− var Data_Argonaut = PS["Data.Argonaut"];
4508− var Data_Argonaut_Decode_Class = PS["Data.Argonaut.Decode.Class"];
4509− var Data_Argonaut_Decode_Combinators = PS["Data.Argonaut.Decode.Combinators"];
4510− var Data_Argonaut_Encode_Class = PS["Data.Argonaut.Encode.Class"];
4511− var Data_Either = PS["Data.Either"];
4512− var Data_Foldable = PS["Data.Foldable"];
4513− var Data_Function = PS["Data.Function"];
4514− var Data_Functor = PS["Data.Functor"];
4515− var Data_Semigroup = PS["Data.Semigroup"];
4516− var Data_StrMap = PS["Data.StrMap"];
4517− var Data_Tuple = PS["Data.Tuple"];
4518− var Debug_Trace = PS["Debug.Trace"];
4519− var Network_HTTP_Affjax = PS["Network.HTTP.Affjax"];
4520− var Network_HTTP_Affjax_Request = PS["Network.HTTP.Affjax.Request"];
4521− var Network_HTTP_Affjax_Response = PS["Network.HTTP.Affjax.Response"];
4522− var Prelude = PS["Prelude"];
4523− var main = Data_Functor["void"](Control_Monad_Eff.functorEff)(Control_Monad_Aff.launchAff(Control_Bind.bind(Control_Monad_Aff.bindAff)(Network_HTTP_Affjax.get(Network_HTTP_Affjax_Response.responsableString)("http://localhost:4444/wd/hub/status"))(function (v) {
4524− return Control_Bind.bind(Control_Monad_Aff.bindAff)(Network_HTTP_Affjax.post(Network_HTTP_Affjax_Request.requestableJson)(Network_HTTP_Affjax_Response.responsableJson)("http://localhost:4444/wd/hub/session")(Data_Argonaut_Encode_Class.encodeJson(Data_Argonaut_Encode_Class.encodeStrMap(Data_Argonaut_Encode_Class.encodeStrMap(Data_Argonaut_Encode_Class.encodeJsonJString)))(Data_StrMap.fromFoldable(Data_Foldable.foldableArray)([ Data_Tuple.Tuple.create("desiredCapabilities")(Data_StrMap.fromFoldable(Data_Foldable.foldableArray)([ new Data_Tuple.Tuple("browserName", "MicrosoftEdge") ])) ]))))(function (v1) {
4525− var eitherSessionId = Control_Bind.bind(Data_Either.bindEither)(Data_Argonaut_Decode_Class.decodeJson(Data_Argonaut_Decode_Class.decodeStrMap(Data_Argonaut_Decode_Class.decodeJsonJson))(v1.response))(function (v2) {
4526− return Data_Argonaut_Decode_Combinators.getField(Data_Argonaut_Decode_Class.decodeJsonString)(v2)("sessionId");
4527− });
4528− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Data_Foldable.for_(Control_Monad_Aff.applicativeAff)(Data_Either.foldableEither)(eitherSessionId)(function (sessId) {
4529− return Control_Bind.bind(Control_Monad_Aff.bindAff)(Network_HTTP_Affjax.post(Network_HTTP_Affjax_Request.requestableJson)(Network_HTTP_Affjax_Response.responsableJson)("http://localhost:4444/wd/hub/session/" + (sessId + "/url"))(Data_Argonaut_Encode_Class.encodeJson(Data_Argonaut_Encode_Class.encodeStrMap(Data_Argonaut_Encode_Class.encodeJsonJString))(Data_StrMap.fromFoldable(Data_Foldable.foldableArray)([ new Data_Tuple.Tuple("url", "https://www.w3.org/TR/webdriver/") ]))))(function (v2) {
4530− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v2))(function () {
4531− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v2.response))(function () {
4532− return Control_Bind.bind(Control_Monad_Aff.bindAff)(Network_HTTP_Affjax.post(Network_HTTP_Affjax_Request.requestableJson)(Network_HTTP_Affjax_Response.responsableJson)("http://localhost:4444/wd/hub/session/" + (sessId + "/element"))(Data_Argonaut_Encode_Class.encodeJson(Data_Argonaut_Encode_Class.encodeStrMap(Data_Argonaut_Encode_Class.encodeJsonJString))(Data_StrMap.fromFoldable(Data_Foldable.foldableArray)([ new Data_Tuple.Tuple("using", "css selector"), new Data_Tuple.Tuple("value", "#respecDocument") ]))))(function (v3) {
4533− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)("ELEMENT "))(function () {
4534− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v3.response))(function () {
4535− return Control_Bind.bind(Control_Monad_Aff.bindAff)(Network_HTTP_Affjax.post(Network_HTTP_Affjax_Request.requestableJson)(Network_HTTP_Affjax_Response.responsableJson)("http://localhost:4444/wd/hub/session/" + (sessId + "/element"))(Data_Argonaut_Encode_Class.encodeJson(Data_Argonaut_Encode_Class.encodeStrMap(Data_Argonaut_Encode_Class.encodeJsonJString))(Data_StrMap.fromFoldable(Data_Foldable.foldableArray)([ new Data_Tuple.Tuple("using", "css selector"), new Data_Tuple.Tuple("value", "title ") ]))))(function (v4) {
4536− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)("ELEMENT "))(function () {
4537− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v4.response))(function () {
4538− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)("========================================"))(function () {
4539− return Control_Bind.bind(Control_Monad_Aff.bindAff)(Network_HTTP_Affjax["delete"](Network_HTTP_Affjax_Response.responsableJson)("http://localhost:4444/wd/hub/session/" + sessId))(function (v5) {
4540− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v5))(function () {
4541− return Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v5.response);
4542− });
4543− });
4544− });
4545− });
4546− });
4547− });
4548− });
4549− });
4550− });
4551− });
4552− });
4553− });
4554− }))(function () {
4555− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v))(function () {
4556− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v.response))(function () {
4557− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v1))(function () {
4558− return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Aff.bindAff)(Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)(v1.response))(function () {
4559− return Debug_Trace.traceAnyA(Debug_Trace.warn())(Control_Monad_Aff.applicativeAff)("HEHEY!");
4560− });
4561− });
4562− });
4563− });
4564− });
4565− });
4566− })));
4567− exports["main"] = main;
4568−})(PS["Main"] = PS["Main"] || {});
4569−PS["Main"].main();
package.jsondeleted−22
@@ -1,22 +0,0 @@
1−{
2− "name": "purescript-lunapark",
3− "version": "1.0.0",
4− "description": "",
5− "main": "index.js",
6− "scripts": {
7− "build": "pulp build -- --censor-lib --strict --stash",
8− "build:non-strict": "pulp build",
9− "bundle": "purs bundle \"output/**/*.js\" --output ./index.js --main Main --module Main",
10− "ide": "purs ide server"
11− },
12− "author": "",
13− "license": "ISC",
14− "dependencies": {
15− "chromedriver": "^2.37.0",
16− "pulp": "^12.0.1",
17− "purescript": "^0.11.7",
18− "purescript-psa": "^0.6.0",
19− "selenium-webdriver": "^4.0.0-alpha.1",
20− "xhr2": "^0.1.4"
21− }
22−}
selenium-3.11.0.jardeleted

Binary file not shown.

spago.locknew file+1712
@@ -0,0 +1,1712 @@
1+{
2+ "workspace": {
3+ "packages": {
4+ "lunapark": {
5+ "path": "./",
6+ "core": {
7+ "dependencies": [
8+ "aff",
9+ "affjax",
10+ "affjax-node",
11+ "argonaut-codecs",
12+ "argonaut-core",
13+ "arrays",
14+ "bifunctors",
15+ "control",
16+ "css",
17+ "datetime",
18+ "effect",
19+ "either",
20+ "foldable-traversable",
21+ "foreign-object",
22+ "lists",
23+ "maybe",
24+ "newtype",
25+ "node-buffer",
26+ "node-fs",
27+ "node-path",
28+ "ordered-collections",
29+ "prelude",
30+ "refs",
31+ "run",
32+ "strings",
33+ "tailrec",
34+ "tuples",
35+ "typelevel-prelude",
36+ "unsafe-coerce",
37+ "variant"
38+ ],
39+ "build_plan": [
40+ "aff",
41+ "affjax",
42+ "affjax-node",
43+ "argonaut-codecs",
44+ "argonaut-core",
45+ "arraybuffer-types",
46+ "arrays",
47+ "bifunctors",
48+ "catenable-lists",
49+ "colors",
50+ "console",
51+ "const",
52+ "contravariant",
53+ "control",
54+ "css",
55+ "datetime",
56+ "distributive",
57+ "effect",
58+ "either",
59+ "enums",
60+ "exceptions",
61+ "exists",
62+ "foldable-traversable",
63+ "foreign",
64+ "foreign-object",
65+ "form-urlencoded",
66+ "free",
67+ "functions",
68+ "functors",
69+ "gen",
70+ "http-methods",
71+ "identity",
72+ "integers",
73+ "invariant",
74+ "js-date",
75+ "js-uri",
76+ "lazy",
77+ "lcg",
78+ "lists",
79+ "maybe",
80+ "media-types",
81+ "newtype",
82+ "node-buffer",
83+ "node-event-emitter",
84+ "node-fs",
85+ "node-path",
86+ "node-streams",
87+ "nonempty",
88+ "now",
89+ "nullable",
90+ "numbers",
91+ "ordered-collections",
92+ "orders",
93+ "parallel",
94+ "partial",
95+ "prelude",
96+ "profunctor",
97+ "quickcheck",
98+ "quickcheck-laws",
99+ "random",
100+ "record",
101+ "refs",
102+ "run",
103+ "safe-coerce",
104+ "st",
105+ "strings",
106+ "tailrec",
107+ "these",
108+ "transformers",
109+ "tuples",
110+ "type-equality",
111+ "typelevel-prelude",
112+ "unfoldable",
113+ "unsafe-coerce",
114+ "variant",
115+ "web-dom",
116+ "web-events",
117+ "web-file",
118+ "web-html",
119+ "web-storage",
120+ "web-xhr"
121+ ]
122+ },
123+ "test": {
124+ "dependencies": [
125+ "console"
126+ ],
127+ "build_plan": [
128+ "console",
129+ "effect",
130+ "prelude"
131+ ]
132+ }
133+ }
134+ },
135+ "package_set": {
136+ "address": {
137+ "registry": "60.4.0"
138+ },
139+ "compiler": ">=0.15.15 <0.16.0",
140+ "content": {
141+ "abc-parser": "2.0.1",
142+ "ace": "9.1.0",
143+ "address-rfc2821": "0.1.1",
144+ "aff": "8.0.0",
145+ "aff-bus": "6.0.0",
146+ "aff-coroutines": "9.0.0",
147+ "aff-promise": "4.0.0",
148+ "aff-retry": "2.0.0",
149+ "affjax": "13.0.0",
150+ "affjax-node": "1.0.0",
151+ "affjax-web": "1.0.0",
152+ "ansi": "7.0.0",
153+ "apexcharts": "0.5.0",
154+ "applicative-phases": "1.0.0",
155+ "argonaut": "9.0.0",
156+ "argonaut-aeson-generic": "0.4.1",
157+ "argonaut-codecs": "9.1.0",
158+ "argonaut-core": "7.0.0",
159+ "argonaut-generic": "8.0.0",
160+ "argonaut-traversals": "10.0.0",
161+ "argparse-basic": "2.0.0",
162+ "array-builder": "0.1.2",
163+ "array-search": "0.6.0",
164+ "arraybuffer": "13.2.0",
165+ "arraybuffer-builder": "3.1.0",
166+ "arraybuffer-types": "3.0.2",
167+ "arrays": "7.3.0",
168+ "arrays-extra": "0.6.1",
169+ "arrays-zipper": "2.0.1",
170+ "ask": "1.0.0",
171+ "assert": "6.0.0",
172+ "assert-multiple": "0.4.0",
173+ "avar": "5.0.0",
174+ "b64": "0.0.8",
175+ "barbies": "1.0.1",
176+ "barlow-lens": "0.9.0",
177+ "bifunctors": "6.0.0",
178+ "bigints": "7.0.1",
179+ "bolson": "0.3.9",
180+ "bookhound": "0.1.7",
181+ "bower-json": "3.0.0",
182+ "call-by-name": "4.0.1",
183+ "canvas": "6.0.0",
184+ "canvas-action": "9.0.0",
185+ "cartesian": "1.0.6",
186+ "catenable-lists": "7.0.0",
187+ "cbor-stream": "1.3.0",
188+ "chameleon": "1.0.0",
189+ "chameleon-halogen": "1.0.3",
190+ "chameleon-react-basic": "1.1.0",
191+ "chameleon-styled": "2.5.0",
192+ "chameleon-transformers": "1.0.0",
193+ "channel": "1.0.0",
194+ "checked-exceptions": "3.1.1",
195+ "choku": "1.0.1",
196+ "classless": "0.1.1",
197+ "classless-arbitrary": "0.1.1",
198+ "classless-decode-json": "0.1.1",
199+ "classless-encode-json": "0.1.3",
200+ "classnames": "2.0.0",
201+ "codec": "6.1.0",
202+ "codec-argonaut": "10.0.0",
203+ "codec-json": "2.0.0",
204+ "colors": "7.0.1",
205+ "concur-core": "0.5.0",
206+ "concur-react": "0.5.0",
207+ "concurrent-queues": "3.0.0",
208+ "console": "6.1.0",
209+ "const": "6.0.0",
210+ "contravariant": "6.0.0",
211+ "control": "6.0.0",
212+ "convertable-options": "1.0.0",
213+ "coroutines": "7.0.0",
214+ "css": "6.0.0",
215+ "css-frameworks": "1.0.1",
216+ "csv-stream": "2.3.0",
217+ "data-mvc": "0.0.2",
218+ "datetime": "6.1.0",
219+ "datetime-parsing": "0.2.0",
220+ "debounce": "0.1.0",
221+ "debug": "6.0.2",
222+ "decimals": "7.1.0",
223+ "default-values": "1.0.1",
224+ "deku": "0.9.23",
225+ "deno": "0.0.5",
226+ "dissect": "1.0.0",
227+ "distributive": "6.0.0",
228+ "dom-filereader": "7.0.0",
229+ "dom-indexed": "12.0.0",
230+ "dom-simple": "0.4.0",
231+ "dotenv": "4.0.3",
232+ "droplet": "0.6.0",
233+ "dts": "1.0.0",
234+ "dual-numbers": "1.0.3",
235+ "dynamic-buffer": "3.0.1",
236+ "echarts-simple": "0.0.1",
237+ "effect": "4.0.0",
238+ "either": "6.1.0",
239+ "elmish": "0.13.0",
240+ "elmish-enzyme": "0.1.1",
241+ "elmish-hooks": "0.10.3",
242+ "elmish-html": "0.9.0",
243+ "elmish-testing-library": "0.3.2",
244+ "email-validate": "7.0.0",
245+ "encoding": "0.0.9",
246+ "enums": "6.0.1",
247+ "env-names": "0.4.0",
248+ "error": "2.0.0",
249+ "eta-conversion": "0.3.2",
250+ "exceptions": "6.1.0",
251+ "exists": "6.0.0",
252+ "exitcodes": "4.0.0",
253+ "expect-inferred": "3.0.0",
254+ "ezfetch": "1.0.0",
255+ "fahrtwind": "2.0.0",
256+ "fallback": "0.1.0",
257+ "fast-vect": "1.2.0",
258+ "fetch": "4.1.0",
259+ "fetch-argonaut": "1.0.1",
260+ "fetch-core": "5.1.0",
261+ "fetch-yoga-json": "1.1.0",
262+ "ffi-simple": "0.5.1",
263+ "fft-js": "0.1.0",
264+ "filterable": "5.0.0",
265+ "fix-functor": "0.1.0",
266+ "fixed-points": "7.0.0",
267+ "fixed-precision": "5.0.0",
268+ "flame": "1.3.0",
269+ "float32": "2.0.0",
270+ "fmt": "0.2.1",
271+ "foldable-traversable": "6.0.0",
272+ "foldable-traversable-extra": "0.0.6",
273+ "foreign": "7.0.0",
274+ "foreign-object": "4.1.0",
275+ "foreign-readwrite": "3.4.0",
276+ "forgetmenot": "0.1.0",
277+ "fork": "6.0.0",
278+ "form-urlencoded": "7.0.0",
279+ "formatters": "7.0.0",
280+ "framer-motion": "1.0.1",
281+ "free": "7.1.0",
282+ "freeap": "7.0.0",
283+ "freer-free": "0.0.1",
284+ "freet": "7.0.0",
285+ "functions": "6.0.0",
286+ "functor1": "3.0.0",
287+ "functors": "5.0.0",
288+ "fuzzy": "0.4.0",
289+ "gen": "4.0.0",
290+ "generate-values": "1.0.1",
291+ "generic-router": "0.0.1",
292+ "geojson": "0.0.5",
293+ "geometria": "2.2.0",
294+ "gojs": "0.1.1",
295+ "grain": "3.0.0",
296+ "grain-router": "3.0.0",
297+ "grain-virtualized": "3.0.0",
298+ "graphs": "8.1.0",
299+ "group": "4.1.1",
300+ "halogen": "7.0.0",
301+ "halogen-bootstrap5": "5.3.2",
302+ "halogen-canvas": "1.0.0",
303+ "halogen-css": "10.0.0",
304+ "halogen-echarts-simple": "0.0.4",
305+ "halogen-formless": "4.0.3",
306+ "halogen-helix": "1.0.1",
307+ "halogen-hooks": "0.6.3",
308+ "halogen-hooks-extra": "0.9.0",
309+ "halogen-infinite-scroll": "1.1.0",
310+ "halogen-store": "0.5.4",
311+ "halogen-storybook": "2.0.0",
312+ "halogen-subscriptions": "2.0.0",
313+ "halogen-svg-elems": "8.0.0",
314+ "halogen-typewriter": "1.0.4",
315+ "halogen-vdom": "8.0.0",
316+ "halogen-vdom-string-renderer": "0.5.0",
317+ "halogen-xterm": "2.0.0",
318+ "heckin": "2.0.1",
319+ "heterogeneous": "0.6.0",
320+ "homogeneous": "0.4.0",
321+ "http-methods": "6.0.0",
322+ "httpurple": "4.0.0",
323+ "huffman": "0.4.0",
324+ "humdrum": "0.0.1",
325+ "hyrule": "2.3.8",
326+ "identity": "6.0.0",
327+ "identy": "4.0.1",
328+ "indexed-db": "1.0.0",
329+ "indexed-monad": "3.0.0",
330+ "int64": "3.0.0",
331+ "integers": "6.0.0",
332+ "interpolate": "5.0.2",
333+ "intersection-observer": "1.0.1",
334+ "invariant": "6.0.0",
335+ "jarilo": "1.0.1",
336+ "jelly": "0.10.0",
337+ "jelly-router": "0.3.0",
338+ "jelly-signal": "0.4.0",
339+ "jest": "1.0.0",
340+ "js-abort-controller": "1.0.0",
341+ "js-bigints": "2.2.1",
342+ "js-date": "8.0.0",
343+ "js-fetch": "0.2.1",
344+ "js-fileio": "3.0.0",
345+ "js-intl": "1.0.4",
346+ "js-iterators": "0.1.1",
347+ "js-maps": "0.1.2",
348+ "js-promise": "1.0.0",
349+ "js-promise-aff": "1.0.0",
350+ "js-timers": "6.1.0",
351+ "js-uri": "3.1.0",
352+ "json": "1.1.0",
353+ "json-codecs": "5.0.0",
354+ "justifill": "0.5.0",
355+ "jwt": "0.0.9",
356+ "labeled-data": "0.2.0",
357+ "language-cst-parser": "0.14.0",
358+ "lazy": "6.0.0",
359+ "lazy-joe": "1.0.0",
360+ "lcg": "4.0.0",
361+ "leibniz": "5.0.0",
362+ "leveldb": "1.0.1",
363+ "liminal": "1.0.1",
364+ "linalg": "6.0.0",
365+ "lists": "7.0.0",
366+ "literals": "1.0.2",
367+ "logging": "3.0.0",
368+ "logging-journald": "0.4.0",
369+ "lumi-components": "18.0.0",
370+ "machines": "7.0.0",
371+ "maps-eager": "0.5.0",
372+ "marionette": "1.0.0",
373+ "marionette-react-basic-hooks": "0.1.1",
374+ "marked": "0.1.0",
375+ "matrices": "5.0.1",
376+ "matryoshka": "1.0.0",
377+ "maybe": "6.0.0",
378+ "media-types": "6.0.0",
379+ "meowclient": "1.0.0",
380+ "midi": "4.0.0",
381+ "milkis": "9.0.0",
382+ "minibench": "4.0.1",
383+ "mmorph": "7.0.0",
384+ "monad-control": "5.0.0",
385+ "monad-logger": "1.3.1",
386+ "monad-loops": "0.5.0",
387+ "monad-unlift": "1.0.1",
388+ "monoid-extras": "0.0.1",
389+ "monoidal": "0.16.0",
390+ "morello": "0.4.0",
391+ "mote": "3.0.0",
392+ "motsunabe": "2.0.0",
393+ "mvc": "0.0.1",
394+ "mysql": "6.0.1",
395+ "n3": "0.1.0",
396+ "nano-id": "1.1.0",
397+ "nanoid": "0.1.0",
398+ "naturals": "3.0.0",
399+ "nested-functor": "0.2.1",
400+ "newtype": "5.0.0",
401+ "nextjs": "0.1.1",
402+ "nextui": "0.2.0",
403+ "node-buffer": "9.0.0",
404+ "node-child-process": "11.1.0",
405+ "node-event-emitter": "3.0.0",
406+ "node-execa": "5.0.0",
407+ "node-fs": "9.2.0",
408+ "node-glob-basic": "1.3.0",
409+ "node-http": "9.1.0",
410+ "node-http2": "1.1.1",
411+ "node-human-signals": "1.0.0",
412+ "node-net": "5.1.0",
413+ "node-os": "5.1.0",
414+ "node-path": "5.0.0",
415+ "node-process": "11.2.0",
416+ "node-readline": "8.1.1",
417+ "node-sqlite3": "8.0.0",
418+ "node-stream-pipes": "2.1.6",
419+ "node-streams": "9.0.0",
420+ "node-tls": "0.3.1",
421+ "node-url": "7.0.1",
422+ "node-zlib": "0.4.0",
423+ "nonempty": "7.0.0",
424+ "now": "6.0.0",
425+ "npm-package-json": "2.0.0",
426+ "nullable": "6.0.0",
427+ "numberfield": "0.2.2",
428+ "numbers": "9.0.1",
429+ "oak": "3.1.1",
430+ "oak-debug": "1.2.2",
431+ "object-maps": "0.3.0",
432+ "ocarina": "1.5.4",
433+ "oooooooooorrrrrrrmm-lib": "0.0.1",
434+ "open-colors-scales-and-schemes": "1.0.0",
435+ "open-folds": "6.4.0",
436+ "open-foreign-generic": "11.0.3",
437+ "open-memoize": "6.2.0",
438+ "open-mkdirp-aff": "1.2.0",
439+ "open-pairing": "6.2.0",
440+ "open-smolder": "12.0.2",
441+ "options": "7.0.0",
442+ "optparse": "5.0.1",
443+ "ordered-collections": "3.2.0",
444+ "ordered-set": "0.4.0",
445+ "orders": "6.0.0",
446+ "owoify": "1.2.0",
447+ "pairs": "9.0.1",
448+ "parallel": "7.0.0",
449+ "parsing": "10.2.0",
450+ "parsing-dataview": "3.2.4",
451+ "partial": "4.0.0",
452+ "pathy": "9.0.0",
453+ "pha": "0.13.0",
454+ "phaser": "0.7.0",
455+ "phylio": "1.1.2",
456+ "pipes": "8.0.0",
457+ "pirates-charm": "0.0.1",
458+ "pmock": "0.9.0",
459+ "point-free": "1.0.0",
460+ "pointed-list": "0.5.1",
461+ "polymorphic-vectors": "4.0.0",
462+ "posix-types": "6.0.0",
463+ "postgresql": "2.0.19",
464+ "precise": "6.0.0",
465+ "precise-datetime": "7.0.0",
466+ "prelude": "6.0.1",
467+ "prettier-printer": "3.0.0",
468+ "priority-queue": "0.1.2",
469+ "profunctor": "6.0.1",
470+ "profunctor-lenses": "8.0.0",
471+ "protobuf": "4.3.0",
472+ "psa-utils": "8.0.0",
473+ "psci-support": "6.0.0",
474+ "punycode": "1.0.0",
475+ "qualified-do": "2.2.0",
476+ "quantities": "12.2.0",
477+ "quickcheck": "8.0.1",
478+ "quickcheck-combinators": "0.1.3",
479+ "quickcheck-laws": "7.0.0",
480+ "quickcheck-utf8": "0.0.0",
481+ "random": "6.0.0",
482+ "rationals": "6.0.0",
483+ "rdf": "0.1.0",
484+ "react": "11.0.0",
485+ "react-aria": "0.2.0",
486+ "react-basic": "17.0.0",
487+ "react-basic-classic": "3.0.0",
488+ "react-basic-dnd": "10.1.0",
489+ "react-basic-dom": "6.1.0",
490+ "react-basic-dom-beta": "0.1.1",
491+ "react-basic-emotion": "7.1.0",
492+ "react-basic-hooks": "8.2.0",
493+ "react-basic-storybook": "2.0.0",
494+ "react-dom": "8.0.0",
495+ "react-halo": "3.0.0",
496+ "react-icons": "1.1.5",
497+ "react-markdown": "0.1.0",
498+ "react-testing-library": "4.0.1",
499+ "react-virtuoso": "1.0.0",
500+ "reactix": "0.6.1",
501+ "read": "1.0.1",
502+ "recharts": "1.1.0",
503+ "record": "4.0.0",
504+ "record-extra": "5.0.1",
505+ "record-ptional-fields": "0.1.2",
506+ "record-studio": "1.0.4",
507+ "refs": "6.0.0",
508+ "remotedata": "5.0.1",
509+ "repr": "0.5.0",
510+ "resize-observer": "1.0.0",
511+ "resource": "2.0.1",
512+ "resourcet": "1.0.0",
513+ "result": "1.0.3",
514+ "return": "0.2.0",
515+ "ring-modules": "5.0.1",
516+ "rito": "0.3.4",
517+ "roman": "0.4.0",
518+ "rough-notation": "1.0.2",
519+ "routing": "11.0.0",
520+ "routing-duplex": "0.7.0",
521+ "run": "5.0.0",
522+ "safe-coerce": "2.0.0",
523+ "safely": "4.0.1",
524+ "school-of-music": "1.3.0",
525+ "selection-foldable": "0.2.0",
526+ "selective-functors": "1.0.1",
527+ "semirings": "7.0.0",
528+ "signal": "13.0.0",
529+ "simple-emitter": "3.0.1",
530+ "simple-i18n": "2.0.1",
531+ "simple-json": "9.0.0",
532+ "simple-json-generics": "0.2.1",
533+ "simple-ulid": "3.0.0",
534+ "sized-matrices": "1.0.0",
535+ "sized-vectors": "5.0.2",
536+ "slug": "3.1.0",
537+ "small-ffi": "4.0.1",
538+ "soundfonts": "4.1.0",
539+ "sparse-matrices": "2.0.1",
540+ "sparse-polynomials": "3.0.1",
541+ "spec": "8.1.0",
542+ "spec-discovery": "8.4.0",
543+ "spec-mocha": "5.1.1",
544+ "spec-node": "0.0.2",
545+ "spec-quickcheck": "5.0.2",
546+ "spec-reporter-xunit": "0.7.1",
547+ "splitmix": "2.1.0",
548+ "ssrs": "1.0.0",
549+ "st": "6.2.0",
550+ "statistics": "0.3.2",
551+ "strictlypositiveint": "1.0.1",
552+ "string-parsers": "8.0.0",
553+ "strings": "6.0.1",
554+ "strings-extra": "4.0.0",
555+ "stringutils": "0.0.12",
556+ "substitute": "0.2.3",
557+ "supply": "0.2.0",
558+ "svg-parser": "3.0.0",
559+ "systemd-journald": "0.3.0",
560+ "tagged": "4.0.2",
561+ "tailrec": "6.1.0",
562+ "tecton": "0.2.1",
563+ "tecton-halogen": "0.2.0",
564+ "test-unit": "17.0.0",
565+ "thermite": "6.3.1",
566+ "thermite-dom": "0.3.1",
567+ "these": "6.0.0",
568+ "threading": "0.0.3",
569+ "tldr": "0.0.0",
570+ "toestand": "0.9.0",
571+ "transformation-matrix": "1.0.1",
572+ "transformers": "6.1.0",
573+ "tree-rose": "4.0.2",
574+ "ts-bridge": "4.0.0",
575+ "tuples": "7.0.0",
576+ "two-or-more": "1.0.0",
577+ "type-equality": "4.0.1",
578+ "typedenv": "2.0.1",
579+ "typelevel": "6.0.0",
580+ "typelevel-lists": "2.1.0",
581+ "typelevel-peano": "1.0.1",
582+ "typelevel-prelude": "7.0.0",
583+ "typelevel-regex": "0.0.3",
584+ "typelevel-rows": "0.1.0",
585+ "typisch": "0.4.0",
586+ "uint": "7.0.0",
587+ "ulid": "3.0.1",
588+ "uncurried-transformers": "1.1.0",
589+ "undefined": "2.0.0",
590+ "undefined-is-not-a-problem": "1.1.0",
591+ "unfoldable": "6.0.0",
592+ "unicode": "6.0.0",
593+ "unique": "0.6.1",
594+ "unlift": "1.0.1",
595+ "unordered-collections": "3.1.0",
596+ "unsafe-coerce": "6.0.0",
597+ "unsafe-reference": "5.0.0",
598+ "untagged-to-tagged": "0.1.4",
599+ "untagged-union": "1.0.0",
600+ "uri": "9.0.0",
601+ "url-immutable": "1.0.0",
602+ "uuid": "9.0.0",
603+ "uuidv4": "1.0.0",
604+ "validation": "6.0.0",
605+ "variant": "8.0.0",
606+ "variant-encodings": "2.0.0",
607+ "vectorfield": "1.0.1",
608+ "vectors": "2.1.0",
609+ "versions": "7.0.0",
610+ "visx": "0.0.2",
611+ "web-clipboard": "6.0.0",
612+ "web-cssom": "2.0.0",
613+ "web-cssom-view": "0.1.0",
614+ "web-dom": "6.0.0",
615+ "web-dom-parser": "8.0.0",
616+ "web-dom-xpath": "3.0.0",
617+ "web-encoding": "3.0.0",
618+ "web-events": "4.0.0",
619+ "web-fetch": "4.0.1",
620+ "web-file": "4.0.0",
621+ "web-geometry": "0.1.0",
622+ "web-html": "4.1.0",
623+ "web-pointerevents": "2.0.0",
624+ "web-proletarian": "1.0.0",
625+ "web-promise": "3.2.0",
626+ "web-resize-observer": "2.1.0",
627+ "web-router": "1.0.0",
628+ "web-socket": "4.0.0",
629+ "web-storage": "5.0.0",
630+ "web-streams": "4.0.0",
631+ "web-touchevents": "4.0.0",
632+ "web-uievents": "5.0.0",
633+ "web-url": "2.0.0",
634+ "web-workers": "1.1.0",
635+ "web-xhr": "5.0.1",
636+ "webextension-polyfill": "0.1.0",
637+ "webgpu": "0.0.1",
638+ "which": "2.0.0",
639+ "xterm": "1.0.0",
640+ "yoga-fetch": "1.0.1",
641+ "yoga-json": "5.1.0",
642+ "yoga-om": "0.1.0",
643+ "yoga-postgres": "6.0.0",
644+ "yoga-tree": "1.0.0",
645+ "z3": "0.0.2",
646+ "zipperarray": "2.0.0"
647+ }
648+ },
649+ "extra_packages": {}
650+ },
651+ "packages": {
652+ "aff": {
653+ "type": "registry",
654+ "version": "8.0.0",
655+ "integrity": "sha256-5MmdI4+0RHBtSBy+YlU3/Cq4R5W2ih3OaRedJIrVHdk=",
656+ "dependencies": [
657+ "bifunctors",
658+ "control",
659+ "datetime",
660+ "effect",
661+ "either",
662+ "exceptions",
663+ "foldable-traversable",
664+ "functions",
665+ "maybe",
666+ "newtype",
667+ "parallel",
668+ "prelude",
669+ "refs",
670+ "tailrec",
671+ "transformers",
672+ "unsafe-coerce"
673+ ]
674+ },
675+ "affjax": {
676+ "type": "registry",
677+ "version": "13.0.0",
678+ "integrity": "sha256-blYfaoW4FYIrIdvmT4sB7nN7BathFaEfZuiVLPmHJOo=",
679+ "dependencies": [
680+ "aff",
681+ "argonaut-core",
682+ "arraybuffer-types",
683+ "foreign",
684+ "form-urlencoded",
685+ "http-methods",
686+ "integers",
687+ "media-types",
688+ "nullable",
689+ "refs",
690+ "unsafe-coerce",
691+ "web-xhr"
692+ ]
693+ },
694+ "affjax-node": {
695+ "type": "registry",
696+ "version": "1.0.0",
697+ "integrity": "sha256-NcmRTXJxJzgHuKoLh+36yA8UejkfouYcX3uevT+Trjc=",
698+ "dependencies": [
699+ "aff",
700+ "affjax",
701+ "either",
702+ "maybe",
703+ "prelude"
704+ ]
705+ },
706+ "argonaut-codecs": {
707+ "type": "registry",
708+ "version": "9.1.0",
709+ "integrity": "sha256-N6efXByUeg848ompEqJfVvZuZPfdRYDGlTDFn0G0Oh8=",
710+ "dependencies": [
711+ "argonaut-core",
712+ "arrays",
713+ "effect",
714+ "foreign-object",
715+ "identity",
716+ "integers",
717+ "maybe",
718+ "nonempty",
719+ "ordered-collections",
720+ "prelude",
721+ "record"
722+ ]
723+ },
724+ "argonaut-core": {
725+ "type": "registry",
726+ "version": "7.0.0",
727+ "integrity": "sha256-RC82GfAjItydxrO24cdX373KHVZiLqybu19b5X8u7B4=",
728+ "dependencies": [
729+ "arrays",
730+ "control",
731+ "either",
732+ "foreign-object",
733+ "functions",
734+ "gen",
735+ "maybe",
736+ "nonempty",
737+ "prelude",
738+ "strings",
739+ "tailrec"
740+ ]
741+ },
742+ "arraybuffer-types": {
743+ "type": "registry",
744+ "version": "3.0.2",
745+ "integrity": "sha256-mQKokysYVkooS4uXbO+yovmV/s8b138Ws3zQvOwIHRA=",
746+ "dependencies": []
747+ },
748+ "arrays": {
749+ "type": "registry",
750+ "version": "7.3.0",
751+ "integrity": "sha256-tmcklBlc/muUtUfr9RapdCPwnlQeB3aSrC4dK85gQlc=",
752+ "dependencies": [
753+ "bifunctors",
754+ "control",
755+ "foldable-traversable",
756+ "functions",
757+ "maybe",
758+ "nonempty",
759+ "partial",
760+ "prelude",
761+ "safe-coerce",
762+ "st",
763+ "tailrec",
764+ "tuples",
765+ "unfoldable",
766+ "unsafe-coerce"
767+ ]
768+ },
769+ "bifunctors": {
770+ "type": "registry",
771+ "version": "6.0.0",
772+ "integrity": "sha256-/gZwC9YhNxZNQpnHa5BIYerCGM2jeX9ukZiEvYxm5Nw=",
773+ "dependencies": [
774+ "const",
775+ "either",
776+ "newtype",
777+ "prelude",
778+ "tuples"
779+ ]
780+ },
781+ "catenable-lists": {
782+ "type": "registry",
783+ "version": "7.0.0",
784+ "integrity": "sha256-76vYENhwF4BWTBsjeLuErCH2jqVT4M3R1HX+4RwSftA=",
785+ "dependencies": [
786+ "control",
787+ "foldable-traversable",
788+ "lists",
789+ "maybe",
790+ "prelude",
791+ "tuples",
792+ "unfoldable"
793+ ]
794+ },
795+ "colors": {
796+ "type": "registry",
797+ "version": "7.0.1",
798+ "integrity": "sha256-udlg/y2PFsHYli8Tgz8BQGGrOjyGo0BcJj36IfgYADs=",
799+ "dependencies": [
800+ "arrays",
801+ "integers",
802+ "lists",
803+ "numbers",
804+ "partial",
805+ "strings"
806+ ]
807+ },
808+ "console": {
809+ "type": "registry",
810+ "version": "6.1.0",
811+ "integrity": "sha256-CxmAzjgyuGDmt9FZW51VhV6rBPwR6o0YeKUzA9rSzcM=",
812+ "dependencies": [
813+ "effect",
814+ "prelude"
815+ ]
816+ },
817+ "const": {
818+ "type": "registry",
819+ "version": "6.0.0",
820+ "integrity": "sha256-tNrxDW8D8H4jdHE2HiPzpLy08zkzJMmGHdRqt5BQuTc=",
821+ "dependencies": [
822+ "invariant",
823+ "newtype",
824+ "prelude"
825+ ]
826+ },
827+ "contravariant": {
828+ "type": "registry",
829+ "version": "6.0.0",
830+ "integrity": "sha256-TP+ooAp3vvmdjfQsQJSichF5B4BPDHp3wAJoWchip6c=",
831+ "dependencies": [
832+ "const",
833+ "either",
834+ "newtype",
835+ "prelude",
836+ "tuples"
837+ ]
838+ },
839+ "control": {
840+ "type": "registry",
841+ "version": "6.0.0",
842+ "integrity": "sha256-sH7Pg9E96JCPF9PIA6oQ8+BjTyO/BH1ZuE/bOcyj4Jk=",
843+ "dependencies": [
844+ "newtype",
845+ "prelude"
846+ ]
847+ },
848+ "css": {
849+ "type": "registry",
850+ "version": "6.0.0",
851+ "integrity": "sha256-zfSHxgiU4rSWuVxMjSKKh+s7j433wxmsr+CqI6hm9s4=",
852+ "dependencies": [
853+ "colors",
854+ "console",
855+ "effect",
856+ "nonempty",
857+ "profunctor",
858+ "strings",
859+ "these",
860+ "transformers"
861+ ]
862+ },
863+ "datetime": {
864+ "type": "registry",
865+ "version": "6.1.0",
866+ "integrity": "sha256-g/5X5BBegQWLpI9IWD+sY6mcaYpzzlW5lz5NBzaMtyI=",
867+ "dependencies": [
868+ "bifunctors",
869+ "control",
870+ "either",
871+ "enums",
872+ "foldable-traversable",
873+ "functions",
874+ "gen",
875+ "integers",
876+ "lists",
877+ "maybe",
878+ "newtype",
879+ "numbers",
880+ "ordered-collections",
881+ "partial",
882+ "prelude",
883+ "tuples"
884+ ]
885+ },
886+ "distributive": {
887+ "type": "registry",
888+ "version": "6.0.0",
889+ "integrity": "sha256-HTDdmEnzigMl+02SJB88j+gAXDx9VKsbvR4MJGDPbOQ=",
890+ "dependencies": [
891+ "identity",
892+ "newtype",
893+ "prelude",
894+ "tuples",
895+ "type-equality"
896+ ]
897+ },
898+ "effect": {
899+ "type": "registry",
900+ "version": "4.0.0",
901+ "integrity": "sha256-eBtZu+HZcMa5HilvI6kaDyVX3ji8p0W9MGKy2K4T6+M=",
902+ "dependencies": [
903+ "prelude"
904+ ]
905+ },
906+ "either": {
907+ "type": "registry",
908+ "version": "6.1.0",
909+ "integrity": "sha256-6hgTPisnMWVwQivOu2PKYcH8uqjEOOqDyaDQVUchTpY=",
910+ "dependencies": [
911+ "control",
912+ "invariant",
913+ "maybe",
914+ "prelude"
915+ ]
916+ },
917+ "enums": {
918+ "type": "registry",
919+ "version": "6.0.1",
920+ "integrity": "sha256-HWaD73JFLorc4A6trKIRUeDMdzE+GpkJaEOM1nTNkC8=",
921+ "dependencies": [
922+ "control",
923+ "either",
924+ "gen",
925+ "maybe",
926+ "newtype",
927+ "nonempty",
928+ "partial",
929+ "prelude",
930+ "tuples",
931+ "unfoldable"
932+ ]
933+ },
934+ "exceptions": {
935+ "type": "registry",
936+ "version": "6.1.0",
937+ "integrity": "sha256-K0T89IHtF3vBY7eSAO7eDOqSb2J9kZGAcDN5+IKsF8E=",
938+ "dependencies": [
939+ "effect",
940+ "either",
941+ "maybe",
942+ "prelude"
943+ ]
944+ },
945+ "exists": {
946+ "type": "registry",
947+ "version": "6.0.0",
948+ "integrity": "sha256-A0JQHpTfo1dNOj9U5/Fd3xndlRSE0g2IQWOGor2yXn8=",
949+ "dependencies": [
950+ "unsafe-coerce"
951+ ]
952+ },
953+ "foldable-traversable": {
954+ "type": "registry",
955+ "version": "6.0.0",
956+ "integrity": "sha256-fLeqRYM4jUrZD5H4WqcwUgzU7XfYkzO4zhgtNc3jcWM=",
957+ "dependencies": [
958+ "bifunctors",
959+ "const",
960+ "control",
961+ "either",
962+ "functors",
963+ "identity",
964+ "maybe",
965+ "newtype",
966+ "orders",
967+ "prelude",
968+ "tuples"
969+ ]
970+ },
971+ "foreign": {
972+ "type": "registry",
973+ "version": "7.0.0",
974+ "integrity": "sha256-1ORiqoS3HW+qfwSZAppHPWy4/6AQysxZ2t29jcdUMNA=",
975+ "dependencies": [
976+ "either",
977+ "functions",
978+ "identity",
979+ "integers",
980+ "lists",
981+ "maybe",
982+ "prelude",
983+ "strings",
984+ "transformers"
985+ ]
986+ },
987+ "foreign-object": {
988+ "type": "registry",
989+ "version": "4.1.0",
990+ "integrity": "sha256-q24okj6mT+yGHYQ+ei/pYPj5ih6sTbu7eDv/WU56JVo=",
991+ "dependencies": [
992+ "arrays",
993+ "foldable-traversable",
994+ "functions",
995+ "gen",
996+ "lists",
997+ "maybe",
998+ "prelude",
999+ "st",
1000+ "tailrec",
1001+ "tuples",
1002+ "typelevel-prelude",
1003+ "unfoldable"
1004+ ]
1005+ },
1006+ "form-urlencoded": {
1007+ "type": "registry",
1008+ "version": "7.0.0",
1009+ "integrity": "sha256-WUzk8DTjrbPVHKZ5w7XpPBO6ci6xFhvYguHp6RvX+18=",
1010+ "dependencies": [
1011+ "foldable-traversable",
1012+ "js-uri",
1013+ "maybe",
1014+ "newtype",
1015+ "prelude",
1016+ "strings",
1017+ "tuples"
1018+ ]
1019+ },
1020+ "free": {
1021+ "type": "registry",
1022+ "version": "7.1.0",
1023+ "integrity": "sha256-JAumgEsGSzJCNLD8AaFvuX7CpqS5yruCngi6yI7+V5k=",
1024+ "dependencies": [
1025+ "catenable-lists",
1026+ "control",
1027+ "distributive",
1028+ "either",
1029+ "exists",
1030+ "foldable-traversable",
1031+ "invariant",
1032+ "lazy",
1033+ "maybe",
1034+ "prelude",
1035+ "tailrec",
1036+ "transformers",
1037+ "tuples",
1038+ "unsafe-coerce"
1039+ ]
1040+ },
1041+ "functions": {
1042+ "type": "registry",
1043+ "version": "6.0.0",
1044+ "integrity": "sha256-adMyJNEnhGde2unHHAP79gPtlNjNqzgLB8arEOn9hLI=",
1045+ "dependencies": [
1046+ "prelude"
1047+ ]
1048+ },
1049+ "functors": {
1050+ "type": "registry",
1051+ "version": "5.0.0",
1052+ "integrity": "sha256-zfPWWYisbD84MqwpJSZFlvM6v86McM68ob8p9s27ywU=",
1053+ "dependencies": [
1054+ "bifunctors",
1055+ "const",
1056+ "contravariant",
1057+ "control",
1058+ "distributive",
1059+ "either",
1060+ "invariant",
1061+ "maybe",
1062+ "newtype",
1063+ "prelude",
1064+ "profunctor",
1065+ "tuples",
1066+ "unsafe-coerce"
1067+ ]
1068+ },
1069+ "gen": {
1070+ "type": "registry",
1071+ "version": "4.0.0",
1072+ "integrity": "sha256-f7yzAXWwr+xnaqEOcvyO3ezKdoes8+WXWdXIHDBCAPI=",
1073+ "dependencies": [
1074+ "either",
1075+ "foldable-traversable",
1076+ "identity",
1077+ "maybe",
1078+ "newtype",
1079+ "nonempty",
1080+ "prelude",
1081+ "tailrec",
1082+ "tuples",
1083+ "unfoldable"
1084+ ]
1085+ },
1086+ "http-methods": {
1087+ "type": "registry",
1088+ "version": "6.0.0",
1089+ "integrity": "sha256-Orr7rbDGcp7qoqmUMXPRMjBx+C4jqOQcFe9+gE3nMgU=",
1090+ "dependencies": [
1091+ "either",
1092+ "prelude",
1093+ "strings"
1094+ ]
1095+ },
1096+ "identity": {
1097+ "type": "registry",
1098+ "version": "6.0.0",
1099+ "integrity": "sha256-4wY0XZbAksjY6UAg99WkuKyJlQlWAfTi2ssadH0wVMY=",
1100+ "dependencies": [
1101+ "control",
1102+ "invariant",
1103+ "newtype",
1104+ "prelude"
1105+ ]
1106+ },
1107+ "integers": {
1108+ "type": "registry",
1109+ "version": "6.0.0",
1110+ "integrity": "sha256-sf+sK26R1hzwl3NhXR7WAu9zCDjQnfoXwcyGoseX158=",
1111+ "dependencies": [
1112+ "maybe",
1113+ "numbers",
1114+ "prelude"
1115+ ]
1116+ },
1117+ "invariant": {
1118+ "type": "registry",
1119+ "version": "6.0.0",
1120+ "integrity": "sha256-RGWWyYrz0Hs1KjPDA+87Kia67ZFBhfJ5lMGOMCEFoLo=",
1121+ "dependencies": [
1122+ "control",
1123+ "prelude"
1124+ ]
1125+ },
1126+ "js-date": {
1127+ "type": "registry",
1128+ "version": "8.0.0",
1129+ "integrity": "sha256-6TVF4DWg5JL+jRAsoMssYw8rgOVALMUHT1CuNZt8NRo=",
1130+ "dependencies": [
1131+ "datetime",
1132+ "effect",
1133+ "exceptions",
1134+ "foreign",
1135+ "integers",
1136+ "now"
1137+ ]
1138+ },
1139+ "js-uri": {
1140+ "type": "registry",
1141+ "version": "3.1.0",
1142+ "integrity": "sha256-3p0ynHveCJmC2CXze+eMBdW/2l5e953Q8XMAKz+jxUo=",
1143+ "dependencies": [
1144+ "functions",
1145+ "maybe"
1146+ ]
1147+ },
1148+ "lazy": {
1149+ "type": "registry",
1150+ "version": "6.0.0",
1151+ "integrity": "sha256-lMsfFOnlqfe4KzRRiW8ot5ge6HtcU3Eyh2XkXcP5IgU=",
1152+ "dependencies": [
1153+ "control",
1154+ "foldable-traversable",
1155+ "invariant",
1156+ "prelude"
1157+ ]
1158+ },
1159+ "lcg": {
1160+ "type": "registry",
1161+ "version": "4.0.0",
1162+ "integrity": "sha256-h7ME5cthLfbgJOJdsZcSfFpwXsx4rf8YmhebU+3iSYg=",
1163+ "dependencies": [
1164+ "effect",
1165+ "integers",
1166+ "maybe",
1167+ "partial",
1168+ "prelude",
1169+ "random"
1170+ ]
1171+ },
1172+ "lists": {
1173+ "type": "registry",
1174+ "version": "7.0.0",
1175+ "integrity": "sha256-EKF15qYqucuXP2lT/xPxhqy58f0FFT6KHdIB/yBOayI=",
1176+ "dependencies": [
1177+ "bifunctors",
1178+ "control",
1179+ "foldable-traversable",
1180+ "lazy",
1181+ "maybe",
1182+ "newtype",
1183+ "nonempty",
1184+ "partial",
1185+ "prelude",
1186+ "tailrec",
1187+ "tuples",
1188+ "unfoldable"
1189+ ]
1190+ },
1191+ "maybe": {
1192+ "type": "registry",
1193+ "version": "6.0.0",
1194+ "integrity": "sha256-5cCIb0wPwbat2PRkQhUeZO0jcAmf8jCt2qE0wbC3v2Q=",
1195+ "dependencies": [
1196+ "control",
1197+ "invariant",
1198+ "newtype",
1199+ "prelude"
1200+ ]
1201+ },
1202+ "media-types": {
1203+ "type": "registry",
1204+ "version": "6.0.0",
1205+ "integrity": "sha256-n/4FoGBasbVSYscGVRSyBunQ6CZbL3jsYL+Lp01mc9k=",
1206+ "dependencies": [
1207+ "newtype",
1208+ "prelude"
1209+ ]
1210+ },
1211+ "newtype": {
1212+ "type": "registry",
1213+ "version": "5.0.0",
1214+ "integrity": "sha256-gdrQu8oGe9eZE6L3wOI8ql/igOg+zEGB5ITh2g+uttw=",
1215+ "dependencies": [
1216+ "prelude",
1217+ "safe-coerce"
1218+ ]
1219+ },
1220+ "node-buffer": {
1221+ "type": "registry",
1222+ "version": "9.0.0",
1223+ "integrity": "sha256-PWE2DJ5ruBLCmeA/fUiuySEFmUJ/VuRfyrnCuVZBlu4=",
1224+ "dependencies": [
1225+ "arraybuffer-types",
1226+ "effect",
1227+ "maybe",
1228+ "nullable",
1229+ "st",
1230+ "unsafe-coerce"
1231+ ]
1232+ },
1233+ "node-event-emitter": {
1234+ "type": "registry",
1235+ "version": "3.0.0",
1236+ "integrity": "sha256-Qw0MjsT4xRH2j2i4K8JmRjcMKnH5z1Cw39t00q4LE4w=",
1237+ "dependencies": [
1238+ "effect",
1239+ "either",
1240+ "functions",
1241+ "maybe",
1242+ "nullable",
1243+ "prelude",
1244+ "unsafe-coerce"
1245+ ]
1246+ },
1247+ "node-fs": {
1248+ "type": "registry",
1249+ "version": "9.2.0",
1250+ "integrity": "sha256-Sg0vkXycEzkEerX6hLccz21Ygd9w1+QSk1thotRZPGI=",
1251+ "dependencies": [
1252+ "datetime",
1253+ "effect",
1254+ "either",
1255+ "enums",
1256+ "exceptions",
1257+ "functions",
1258+ "integers",
1259+ "js-date",
1260+ "maybe",
1261+ "node-buffer",
1262+ "node-path",
1263+ "node-streams",
1264+ "nullable",
1265+ "partial",
1266+ "prelude",
1267+ "strings",
1268+ "unsafe-coerce"
1269+ ]
1270+ },
1271+ "node-path": {
1272+ "type": "registry",
1273+ "version": "5.0.0",
1274+ "integrity": "sha256-pd82nQ+2l5UThzaxPdKttgDt7xlsgIDLpPG0yxDEdyE=",
1275+ "dependencies": [
1276+ "effect"
1277+ ]
1278+ },
1279+ "node-streams": {
1280+ "type": "registry",
1281+ "version": "9.0.0",
1282+ "integrity": "sha256-2n6dq7YWleTDmD1Kur/ul7Cn08IvWrScgPf+0PgX2TQ=",
1283+ "dependencies": [
1284+ "aff",
1285+ "effect",
1286+ "either",
1287+ "exceptions",
1288+ "node-buffer",
1289+ "node-event-emitter",
1290+ "nullable",
1291+ "prelude"
1292+ ]
1293+ },
1294+ "nonempty": {
1295+ "type": "registry",
1296+ "version": "7.0.0",
1297+ "integrity": "sha256-54ablJZUHGvvlTJzi3oXyPCuvY6zsrWJuH/dMJ/MFLs=",
1298+ "dependencies": [
1299+ "control",
1300+ "foldable-traversable",
1301+ "maybe",
1302+ "prelude",
1303+ "tuples",
1304+ "unfoldable"
1305+ ]
1306+ },
1307+ "now": {
1308+ "type": "registry",
1309+ "version": "6.0.0",
1310+ "integrity": "sha256-xZ7x37ZMREfs6GCDw/h+FaKHV/3sPWmtqBZRGTxybQY=",
1311+ "dependencies": [
1312+ "datetime",
1313+ "effect"
1314+ ]
1315+ },
1316+ "nullable": {
1317+ "type": "registry",
1318+ "version": "6.0.0",
1319+ "integrity": "sha256-yiGBVl3AD+Guy4kNWWeN+zl1gCiJK+oeIFtZtPCw4+o=",
1320+ "dependencies": [
1321+ "effect",
1322+ "functions",
1323+ "maybe"
1324+ ]
1325+ },
1326+ "numbers": {
1327+ "type": "registry",
1328+ "version": "9.0.1",
1329+ "integrity": "sha256-/9M6aeMDBdB4cwYDeJvLFprAHZ49EbtKQLIJsneXLIk=",
1330+ "dependencies": [
1331+ "functions",
1332+ "maybe"
1333+ ]
1334+ },
1335+ "ordered-collections": {
1336+ "type": "registry",
1337+ "version": "3.2.0",
1338+ "integrity": "sha256-o9jqsj5rpJmMdoe/zyufWHFjYYFTTsJpgcuCnqCO6PM=",
1339+ "dependencies": [
1340+ "arrays",
1341+ "foldable-traversable",
1342+ "gen",
1343+ "lists",
1344+ "maybe",
1345+ "partial",
1346+ "prelude",
1347+ "st",
1348+ "tailrec",
1349+ "tuples",
1350+ "unfoldable"
1351+ ]
1352+ },
1353+ "orders": {
1354+ "type": "registry",
1355+ "version": "6.0.0",
1356+ "integrity": "sha256-nBA0g3/ai0euH8q9pSbGqk53W2q6agm/dECZTHcoink=",
1357+ "dependencies": [
1358+ "newtype",
1359+ "prelude"
1360+ ]
1361+ },
1362+ "parallel": {
1363+ "type": "registry",
1364+ "version": "7.0.0",
1365+ "integrity": "sha256-gUC9i4Txnx9K9RcMLsjujbwZz6BB1bnE2MLvw4GIw5o=",
1366+ "dependencies": [
1367+ "control",
1368+ "effect",
1369+ "either",
1370+ "foldable-traversable",
1371+ "functors",
1372+ "maybe",
1373+ "newtype",
1374+ "prelude",
1375+ "profunctor",
1376+ "refs",
1377+ "transformers"
1378+ ]
1379+ },
1380+ "partial": {
1381+ "type": "registry",
1382+ "version": "4.0.0",
1383+ "integrity": "sha256-fwXerld6Xw1VkReh8yeQsdtLVrjfGiVuC5bA1Wyo/J4=",
1384+ "dependencies": []
1385+ },
1386+ "prelude": {
1387+ "type": "registry",
1388+ "version": "6.0.1",
1389+ "integrity": "sha256-o8p6SLYmVPqzXZhQFd2hGAWEwBoXl1swxLG/scpJ0V0=",
1390+ "dependencies": []
1391+ },
1392+ "profunctor": {
1393+ "type": "registry",
1394+ "version": "6.0.1",
1395+ "integrity": "sha256-E58hSYdJvF2Qjf9dnWLPlJKh2Z2fLfFLkQoYi16vsFk=",
1396+ "dependencies": [
1397+ "control",
1398+ "distributive",
1399+ "either",
1400+ "exists",
1401+ "invariant",
1402+ "newtype",
1403+ "prelude",
1404+ "tuples"
1405+ ]
1406+ },
1407+ "quickcheck": {
1408+ "type": "registry",
1409+ "version": "8.0.1",
1410+ "integrity": "sha256-ZvpccKQCvgslTXZCNmpYW4bUsFzhZd/kQUr2WmxFTGY=",
1411+ "dependencies": [
1412+ "arrays",
1413+ "console",
1414+ "control",
1415+ "effect",
1416+ "either",
1417+ "enums",
1418+ "exceptions",
1419+ "foldable-traversable",
1420+ "gen",
1421+ "identity",
1422+ "integers",
1423+ "lazy",
1424+ "lcg",
1425+ "lists",
1426+ "maybe",
1427+ "newtype",
1428+ "nonempty",
1429+ "numbers",
1430+ "partial",
1431+ "prelude",
1432+ "record",
1433+ "st",
1434+ "strings",
1435+ "tailrec",
1436+ "transformers",
1437+ "tuples",
1438+ "unfoldable"
1439+ ]
1440+ },
1441+ "quickcheck-laws": {
1442+ "type": "registry",
1443+ "version": "7.0.0",
1444+ "integrity": "sha256-rnzVTiDnymzYkvnhI8EvPwrmO8LgcTnrMTuiI172Tkc=",
1445+ "dependencies": [
1446+ "enums",
1447+ "quickcheck"
1448+ ]
1449+ },
1450+ "random": {
1451+ "type": "registry",
1452+ "version": "6.0.0",
1453+ "integrity": "sha256-CJ611a35MPCE7XQMp0rdC6MCn76znlhisiCRgboAG+Q=",
1454+ "dependencies": [
1455+ "effect",
1456+ "integers"
1457+ ]
1458+ },
1459+ "record": {
1460+ "type": "registry",
1461+ "version": "4.0.0",
1462+ "integrity": "sha256-Za5U85bTRJEfGK5Sk4hM41oXy84YQI0I8TL3WUn1Qzg=",
1463+ "dependencies": [
1464+ "functions",
1465+ "prelude",
1466+ "unsafe-coerce"
1467+ ]
1468+ },
1469+ "refs": {
1470+ "type": "registry",
1471+ "version": "6.0.0",
1472+ "integrity": "sha256-Vgwne7jIbD3ZMoLNNETLT8Litw6lIYo3MfYNdtYWj9s=",
1473+ "dependencies": [
1474+ "effect",
1475+ "prelude"
1476+ ]
1477+ },
1478+ "run": {
1479+ "type": "registry",
1480+ "version": "5.0.0",
1481+ "integrity": "sha256-uCCGBqPXOSTnQoVzQUoCcEYyGvi+dWZp+lLsxtNG6+U=",
1482+ "dependencies": [
1483+ "aff",
1484+ "effect",
1485+ "either",
1486+ "free",
1487+ "maybe",
1488+ "newtype",
1489+ "prelude",
1490+ "profunctor",
1491+ "tailrec",
1492+ "tuples",
1493+ "type-equality",
1494+ "typelevel-prelude",
1495+ "unsafe-coerce",
1496+ "variant"
1497+ ]
1498+ },
1499+ "safe-coerce": {
1500+ "type": "registry",
1501+ "version": "2.0.0",
1502+ "integrity": "sha256-a1ibQkiUcbODbLE/WAq7Ttbbh9ex+x33VCQ7GngKudU=",
1503+ "dependencies": [
1504+ "unsafe-coerce"
1505+ ]
1506+ },
1507+ "st": {
1508+ "type": "registry",
1509+ "version": "6.2.0",
1510+ "integrity": "sha256-z9X0WsOUlPwNx9GlCC+YccCyz8MejC8Wb0C4+9fiBRY=",
1511+ "dependencies": [
1512+ "partial",
1513+ "prelude",
1514+ "tailrec",
1515+ "unsafe-coerce"
1516+ ]
1517+ },
1518+ "strings": {
1519+ "type": "registry",
1520+ "version": "6.0.1",
1521+ "integrity": "sha256-WssD3DbX4OPzxSdjvRMX0yvc9+pS7n5gyPv5I2Trb7k=",
1522+ "dependencies": [
1523+ "arrays",
1524+ "control",
1525+ "either",
1526+ "enums",
1527+ "foldable-traversable",
1528+ "gen",
1529+ "integers",
1530+ "maybe",
1531+ "newtype",
1532+ "nonempty",
1533+ "partial",
1534+ "prelude",
1535+ "tailrec",
1536+ "tuples",
1537+ "unfoldable",
1538+ "unsafe-coerce"
1539+ ]
1540+ },
1541+ "tailrec": {
1542+ "type": "registry",
1543+ "version": "6.1.0",
1544+ "integrity": "sha256-Xx19ECVDRrDWpz9D2GxQHHV89vd61dnXxQm0IcYQHGk=",
1545+ "dependencies": [
1546+ "bifunctors",
1547+ "effect",
1548+ "either",
1549+ "identity",
1550+ "maybe",
1551+ "partial",
1552+ "prelude",
1553+ "refs"
1554+ ]
1555+ },
1556+ "these": {
1557+ "type": "registry",
1558+ "version": "6.0.0",
1559+ "integrity": "sha256-6poQvFzGw7Ir9mTDEbFV9N6+cUeSHe0FdzTR2ZK1o6g=",
1560+ "dependencies": [
1561+ "arrays",
1562+ "gen",
1563+ "lists",
1564+ "quickcheck",
1565+ "quickcheck-laws",
1566+ "tuples"
1567+ ]
1568+ },
1569+ "transformers": {
1570+ "type": "registry",
1571+ "version": "6.1.0",
1572+ "integrity": "sha256-3Bm+Z6tsC/paG888XkywDngJ2JMos+JfOhRlkVfb7gI=",
1573+ "dependencies": [
1574+ "control",
1575+ "distributive",
1576+ "effect",
1577+ "either",
1578+ "exceptions",
1579+ "foldable-traversable",
1580+ "identity",
1581+ "lazy",
1582+ "maybe",
1583+ "newtype",
1584+ "prelude",
1585+ "st",
1586+ "tailrec",
1587+ "tuples",
1588+ "unfoldable"
1589+ ]
1590+ },
1591+ "tuples": {
1592+ "type": "registry",
1593+ "version": "7.0.0",
1594+ "integrity": "sha256-1rXgTomes9105BjgXqIw0FL6Fz1lqqUTLWOumhWec1M=",
1595+ "dependencies": [
1596+ "control",
1597+ "invariant",
1598+ "prelude"
1599+ ]
1600+ },
1601+ "type-equality": {
1602+ "type": "registry",
1603+ "version": "4.0.1",
1604+ "integrity": "sha256-Hs9D6Y71zFi/b+qu5NSbuadUQXe5iv5iWx0226vOHUw=",
1605+ "dependencies": []
1606+ },
1607+ "typelevel-prelude": {
1608+ "type": "registry",
1609+ "version": "7.0.0",
1610+ "integrity": "sha256-uFF2ph+vHcQpfPuPf2a3ukJDFmLhApmkpTMviHIWgJM=",
1611+ "dependencies": [
1612+ "prelude",
1613+ "type-equality"
1614+ ]
1615+ },
1616+ "unfoldable": {
1617+ "type": "registry",
1618+ "version": "6.0.0",
1619+ "integrity": "sha256-JtikvJdktRap7vr/K4ITlxUX1QexpnqBq0G/InLr6eg=",
1620+ "dependencies": [
1621+ "foldable-traversable",
1622+ "maybe",
1623+ "partial",
1624+ "prelude",
1625+ "tuples"
1626+ ]
1627+ },
1628+ "unsafe-coerce": {
1629+ "type": "registry",
1630+ "version": "6.0.0",
1631+ "integrity": "sha256-IqIYW4Vkevn8sI+6aUwRGvd87tVL36BBeOr0cGAE7t0=",
1632+ "dependencies": []
1633+ },
1634+ "variant": {
1635+ "type": "registry",
1636+ "version": "8.0.0",
1637+ "integrity": "sha256-SR//zQDg2dnbB8ZHslcxieUkCeNlbMToapvmh9onTtw=",
1638+ "dependencies": [
1639+ "enums",
1640+ "lists",
1641+ "maybe",
1642+ "partial",
1643+ "prelude",
1644+ "record",
1645+ "tuples",
1646+ "unsafe-coerce"
1647+ ]
1648+ },
1649+ "web-dom": {
1650+ "type": "registry",
1651+ "version": "6.0.0",
1652+ "integrity": "sha256-1kSKWFDI4LupdmpjK01b1MMxDFW7jvatEgPgVmCmSBQ=",
1653+ "dependencies": [
1654+ "web-events"
1655+ ]
1656+ },
1657+ "web-events": {
1658+ "type": "registry",
1659+ "version": "4.0.0",
1660+ "integrity": "sha256-YDt8b6u1tzGtnWyNRodne57iO8FNSGPaTCVzBUyUn4k=",
1661+ "dependencies": [
1662+ "datetime",
1663+ "enums",
1664+ "foreign",
1665+ "nullable"
1666+ ]
1667+ },
1668+ "web-file": {
1669+ "type": "registry",
1670+ "version": "4.0.0",
1671+ "integrity": "sha256-1h5jPBkvjY71jLEdwVadXCx86/2inNoMBO//Rd3eCSU=",
1672+ "dependencies": [
1673+ "foreign",
1674+ "media-types",
1675+ "web-dom"
1676+ ]
1677+ },
1678+ "web-html": {
1679+ "type": "registry",
1680+ "version": "4.1.0",
1681+ "integrity": "sha256-ByqS/h1/yG+hjCOnOQp7L1QpIWzQENNKB1kaHtpEhlE=",
1682+ "dependencies": [
1683+ "js-date",
1684+ "web-dom",
1685+ "web-file",
1686+ "web-storage"
1687+ ]
1688+ },
1689+ "web-storage": {
1690+ "type": "registry",
1691+ "version": "5.0.0",
1692+ "integrity": "sha256-q+6lxcnfWxus0/nDeFVtF1V+tLehZvvXQ0cduYPLksY=",
1693+ "dependencies": [
1694+ "nullable",
1695+ "web-events"
1696+ ]
1697+ },
1698+ "web-xhr": {
1699+ "type": "registry",
1700+ "version": "5.0.1",
1701+ "integrity": "sha256-3dbIPVG66S+hPrgEVnpD78hrGjE7qlBbsReWOz89Ios=",
1702+ "dependencies": [
1703+ "arraybuffer-types",
1704+ "datetime",
1705+ "http-methods",
1706+ "web-dom",
1707+ "web-file",
1708+ "web-html"
1709+ ]
1710+ }
1711+ }
1712+}
spago.yamlnew file+41
@@ -0,0 +1,41 @@
1+package:
2+ name: lunapark
3+ dependencies:
4+ - aff: ">=8.0.0 <9.0.0"
5+ - affjax: ">=13.0.0 <14.0.0"
6+ - affjax-node: ">=1.0.0 <2.0.0"
7+ - argonaut-codecs: ">=9.1.0 <10.0.0"
8+ - argonaut-core: ">=7.0.0 <8.0.0"
9+ - arrays: ">=7.3.0 <8.0.0"
10+ - bifunctors: ">=6.0.0 <7.0.0"
11+ - control: ">=6.0.0 <7.0.0"
12+ - css: ">=6.0.0 <7.0.0"
13+ - datetime: ">=6.1.0 <7.0.0"
14+ - effect: ">=4.0.0 <5.0.0"
15+ - either: ">=6.1.0 <7.0.0"
16+ - foldable-traversable: ">=6.0.0 <7.0.0"
17+ - foreign-object: ">=4.1.0 <5.0.0"
18+ - lists: ">=7.0.0 <8.0.0"
19+ - maybe: ">=6.0.0 <7.0.0"
20+ - newtype: ">=5.0.0 <6.0.0"
21+ - node-buffer: ">=9.0.0 <10.0.0"
22+ - node-fs: ">=9.2.0 <10.0.0"
23+ - node-path: ">=5.0.0 <6.0.0"
24+ - ordered-collections: ">=3.2.0 <4.0.0"
25+ - prelude: ">=6.0.1 <7.0.0"
26+ - refs: ">=6.0.0 <7.0.0"
27+ - run: ">=5.0.0 <6.0.0"
28+ - strings: ">=6.0.1 <7.0.0"
29+ - tailrec: ">=6.1.0 <7.0.0"
30+ - tuples: ">=7.0.0 <8.0.0"
31+ - typelevel-prelude: ">=7.0.0 <8.0.0"
32+ - unsafe-coerce: ">=6.0.0 <7.0.0"
33+ - variant: ">=8.0.0 <9.0.0"
34+ test:
35+ main: Test.Main
36+ dependencies:
37+ - console
38+workspace:
39+ packageSet:
40+ registry: 60.4.0
41+ extraPackages: {}
src/Lunapark.purs+14−8
@@ -1,9 +1,15 @@
1−module Lunapark where
1+module Lunapark
2+ ( module Lunapark.API
3+ , module Lunapark.Error
4+ , module Lunapark.ActionF
5+ , module Lunapark.LunaparkF
6+ , module Lunapark.WebDriverError
7+ , module Lunapark.Types
8+ ) where
29
3−import Prelude
4−
5−import Control.Monad.Aff (Aff)
6−import Lunapark.Affjax as LA
7−import Lunapark.Error as LE
8−import Lunapark.Types as LT
9−import Network.HTTP.Affjax (AJAX)
10+import Lunapark.API (Lunapark, Interpreter(..), runInterpreter, BASE_EFFECTS, HandleLunaparkInput, handleLunapark, init, interpret, interpretW3CActions, jsonWireActions, runLunapark, runLunaparkActions, w3cActions)
11+import Lunapark.Error (Error(..), CachingError(..), printError)
12+import Lunapark.ActionF (ActionF(..), LUNAPARK_ACTIONS, TouchF(..), _lunaparkActions, buttonDown, buttonUp, click, doubleClick, doubleTap, flick, liftAction, longTap, moveTo, pause, scroll, sendKeys, tap, touchDown, touchUp)
13+import Lunapark.LunaparkF (ElementF(..), LUNAPARK, LunaparkF(..), _lunapark, acceptAlert, addCookie, back, childElement, childElements, clearElement, clickElement, closeWindow, deleteAllCookies, deleteCookie, dismissAlert, elementScreenshot, executeScript, executeScriptAsync, findElement, findElements, forward, fullscreenWindow, getAlertText, getAllCookies, getAttribute, getCookie, getCss, getProperty, getRectangle, getTagName, getText, getTimeouts, getTitle, getUrl, getWindowHandle, getWindowHandles, getWindowRectangle, go, isDisplayed, isEnabled, isSelected, liftLunapark, maximizeWindow, minimizeWindow, performActions, quit, refresh, releaseActions, screenshot, sendAlertText, sendKeysElement, setTimeouts, setWindowRectangle, status, submitElement, switchToFrame, switchToParentFrame, switchToWindow)
14+import Lunapark.WebDriverError (WebDriverError, WebDriverErrorType(..), fromJson, fromStringCode, toStringCode)
15+import Lunapark.Types (SessionId(..), WindowHandle(..), FrameId(..), Element(..), CreateSessionResponse, ServerStatus, Timeouts, Rectangle, RawLocator, Locator(..), Script, Cookie, Screenshot, Button(..), PointerMoveOrigin(..), PointerMove, Action, PointerType(..), ActionSequence(..), ActionRequest, BrowserType(..), DriverPaths, PageLoad(..), UnhandledPrompt(..), Platform(..), Capability(..), CapabilitiesRequest, MoveToRequest)
src/Lunapark/API.purs+478−837
@@ -2,336 +2,374 @@ module Lunapark.API where
22
33import Prelude
44
5−import Control.Monad.Aff (Aff)
6−import Control.Monad.Aff.Class (class MonadAff, liftAff)
7−import Control.Monad.Eff.Ref as Ref
8−import Control.Monad.Error.Class (class MonadThrow, class MonadError, throwError)
9−import Control.Monad.Reader.Class (class MonadAsk, ask)
10−import Control.Monad.State.Class (class MonadState)
115import Control.Monad.Rec.Class (class MonadRec)
12−import Control.Monad.Free (Free, foldFree)
13−import Data.Time.Duration (Milliseconds(..))
14−import Data.Argonaut as J
6+import Data.Argonaut.Decode.Class (decodeJson) as J
7+import Data.Argonaut.Encode.Class (encodeJson) as J
8+import Data.FoldableWithIndex as FI
9+import Data.Array as A
1510import Data.Bifunctor (lmap)
16−import Data.Either (Either(..), either)
11+import Data.Either (Either(..), isRight)
1712import Data.List (List(..), (:))
18−import Data.Maybe (Maybe(..))
13+import Data.List as L
1914import Data.Map as Map
20−import Data.Newtype (class Newtype, un, wrap)
15+import Data.Maybe (Maybe(..))
16+import Data.String.CodeUnits as Str
17+import Data.Time.Duration (Milliseconds(..))
2118import Data.Traversable as T
22−import Data.Symbol (SProxy(..))
23−import Data.StrMap as SM
24−import Lunapark.Affjax as LA
19+import Data.Variant as V
20+import Effect.Aff as Aff
21+import Effect.Aff.Class (class MonadAff, liftAff)
22+import Effect.Class (liftEffect)
23+import Effect.Ref as Ref
24+import Foreign.Object as FO
25+import Lunapark.ActionF (_lunaparkActions, ActionF(..), TouchF(..), LUNAPARK_ACTIONS)
26+import Lunapark.Endpoint as LP
2527import Lunapark.Error as LE
28+import Lunapark.LunaparkF (_lunapark, ElementF(..), LunaparkF(..), LUNAPARK, performActions, findElement)
2629import Lunapark.Types as LT
27−import Lunapark.Endpoint as LP
30+import Lunapark.Utils (liftAndRethrow, rethrowAsJsonDecodeError, catch)
2831import Node.Buffer as B
2932import Node.FS.Aff as FS
30−import Network.HTTP.Affjax (AJAX)
31−import Unsafe.Coerce (unsafeCoerce)
33+import Run (Run)
3234import Run as R
33−import Run.Except (EXCEPT, runExcept, throw)
35+import Run.Except (EXCEPT)
36+import Type.Row (type (+))
3437import Run.Except as RE
35−import Debug.Trace as DT
36−import Unsafe.Coerce (unsafeCoerce)
3738
38−type LunaparkEffects e =
39− ( ajax ∷ AJAX
40− , ref ∷ Ref.REF
41− , buffer ∷ B.BUFFER
42− , fs ∷ FS.FS
43− | e)
39+type Lunapark r a = Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) a
40+
41+newtype Interpreter r = Interpreter (Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) ~> Run (BASE_EFFECTS r))
42+
43+runInterpreter ∷ ∀ r. Interpreter r → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) ~> Run (BASE_EFFECTS r)
44+runInterpreter (Interpreter f) = f
4445
45−-- | Example
46−-- | ```purescript
47−-- | runLunapark ← init "http://localhost:4444/wd/hub" SM.empty
48−-- | result ← runLunapark do
49−-- | setTimeouts timeouts
50−-- | go "http://google.com"
51−-- | findElement ...
52−-- | ```
5346init
54− ∷ ∀ e m a
55− . MonadAff (LunaparkEffects e) m
47+ ∷ ∀ m r
48+ . MonadAff m
5649 ⇒ MonadRec m
5750 ⇒ String
5851 → LT.CapabilitiesRequest
59− → m (Lunapark e a → m (Either LE.Error a))
52+ → m (Either LE.Error (Interpreter r))
6053init uri caps = do
61− sessObj ← liftAff $ LP.post uri (LP.Session : Nil) $ LT.encodeCapabilitiesRequest caps
62− case lmap LE.unknownError <<< LT.decodeCreateSessionResponse =<< sessObj of
63− Left e → pure \_ → pure $ Left e
64− Right a → pure \actions → liftAff $ interpret uri a actions
65−
66−interpret ∷ ∀ a e. String → LT.CreateSessionResponse → Lunapark e a → Aff (LunaparkEffects e) (Either LE.Error a)
67−interpret uri {session, capabilities} actions = do
68− id
69− --expandEffectRows
70− $ R.runBaseAff'
71− $ runExcept
72− $ runLunapark uri session capabilities
73− $ un Lunapark actions
74−-- where
75− -- This is definitely safe, because more effects is not less effects
76−-- expandEffectRows ∷ ∀ m r0 r1 r. Union r0 r1 r ⇒ m r0 ~> m r
77−-- expandEffectRows = unsafeCoerce
78−
79−data LunaparkF a
80− = Quit a
81− | Status (LT.ServerStatus → a)
82− | GetTimeouts (LT.Timeouts → a)
83− | SetTimeouts LT.Timeouts a
84− | GoTo String a
85− | GetUrl (String → a)
86− | Forward a
87− | Back a
88− | Refresh a
89− | GetTitle (String → a)
90− | GetWindowHandle (LT.WindowHandle → a)
91− | GetWindowHandles (Array LT.WindowHandle → a)
92− | CloseWindow a
93− | SwitchToWindow LT.WindowHandle a
94− | SwitchToFrame LT.FrameId a
95− | SwitchToParentFrame a
96− | GetWindowRectangle (LT.Rectangle → a)
97− | SetWindowRectangle LT.Rectangle a
98− | MaximizeWindow a
99− | MinimizeWindow a
100− | FullscreenWindow a
101− | ExecuteScript LT.Script (J.Json → a)
102− | ExecuteScriptAsync LT.Script (J.Json → a)
103− | GetAllCookies (Array LT.Cookie → a)
104− | GetCookie String (LT.Cookie → a)
105− | DeleteCookie String a
106− | DeleteAllCookies a
107− | AddCookie LT.Cookie a
108− | DismissAlert a
109− | AcceptAlert a
110− | GetAlertText (String → a)
111− | SendAlertText String a
112− | Screenshot String a
113− | ElementScreenshot LT.Element String a
114− | FindElement LT.Locator (LT.Element → a)
115− | FindElements LT.Locator (Array LT.Element → a)
116− | FindElementInElement LT.Element LT.Locator (LT.Element → a)
117− | FindElementsInElement LT.Element LT.Locator (Array LT.Element → a)
118−
119−derive instance functorLunaparkF ∷ Functor LunaparkF
120−
121−type BaseRun r e = R.Run
122− ( except ∷ EXCEPT LE.Error
123− , aff ∷ R.AFF (LunaparkEffects e)
124− , eff ∷ R.EFF (LunaparkEffects e)
125− | r)
126−
127−type RunLunapark e = BaseRun (lunapark ∷ LUNAPARK) e
128−
129−newtype Lunapark e a = Lunapark (RunLunapark e a)
130−
131−_lunapark = SProxy ∷ SProxy "lunapark"
132−type LUNAPARK = R.FProxy LunaparkF
133−
134−liftLunapark ∷ ∀ a e. LunaparkF a → Lunapark e a
135−liftLunapark = Lunapark <<< R.lift _lunapark
136−
137−derive instance newtypeLunapark ∷ Newtype (Lunapark e a) _
138−derive newtype instance functorLunapark ∷ Functor (Lunapark e)
139−derive newtype instance applyLunapark ∷ Apply (Lunapark e)
140−derive newtype instance applicativeLunapark ∷ Applicative (Lunapark e)
141−derive newtype instance bindLunapark ∷ Bind (Lunapark e)
142−derive newtype instance monadLunapark ∷ Monad (Lunapark e)
143−
144−quit ∷ ∀ e. Lunapark e Unit
145−quit = liftLunapark $ Quit unit
146−
147−status ∷ ∀ e. Lunapark e LT.ServerStatus
148−status = liftLunapark $ Status id
149−
150−setTimeouts ∷ ∀ e. LT.Timeouts → Lunapark e Unit
151−setTimeouts ts = liftLunapark $ SetTimeouts ts unit
152−
153−getTimeouts ∷ ∀ e. Lunapark e LT.Timeouts
154−getTimeouts = liftLunapark $ GetTimeouts id
155−
156−go ∷ ∀ e. String → Lunapark e Unit
157−go uri = liftLunapark $ GoTo uri unit
158−
159−getUrl ∷ ∀ e. Lunapark e String
160−getUrl = liftLunapark $ GetUrl id
161−
162−forward ∷ ∀ e. Lunapark e Unit
163−forward = liftLunapark $ Forward unit
164−
165−back ∷ ∀ e. Lunapark e Unit
166−back = liftLunapark $ Back unit
167−
168−refresh ∷ ∀ e. Lunapark e Unit
169−refresh = liftLunapark $ Refresh unit
170−
171−getTitle ∷ ∀ e. Lunapark e String
172−getTitle = liftLunapark $ GetTitle id
173−
174−getWindowHandle ∷ ∀ e. Lunapark e LT.WindowHandle
175−getWindowHandle = liftLunapark $ GetWindowHandle id
176−
177−getWindowHandles ∷ ∀ e. Lunapark e (Array LT.WindowHandle)
178−getWindowHandles = liftLunapark $ GetWindowHandles id
179−
180−closeWindow ∷ ∀ e. Lunapark e Unit
181−closeWindow = liftLunapark $ CloseWindow unit
182−
183−switchToWindow ∷ ∀ e. LT.WindowHandle → Lunapark e Unit
184−switchToWindow w = liftLunapark $ SwitchToWindow w unit
185−
186−switchToFrame ∷ ∀ e. LT.FrameId → Lunapark e Unit
187−switchToFrame f = liftLunapark $ SwitchToFrame f unit
188−
189−switchToParentFrame ∷ ∀ e. Lunapark e Unit
190−switchToParentFrame = liftLunapark $ SwitchToParentFrame unit
191−
192−getWindowRectangle ∷ ∀ e. Lunapark e LT.Rectangle
193−getWindowRectangle = liftLunapark $ GetWindowRectangle id
194−
195−setWindowRectangle ∷ ∀ e. LT.Rectangle → Lunapark e Unit
196−setWindowRectangle r = liftLunapark $ SetWindowRectangle r unit
197−
198−maximizeWindow ∷ ∀ e. Lunapark e Unit
199−maximizeWindow = liftLunapark $ MaximizeWindow unit
200−
201−minimizeWindow ∷ ∀ e. Lunapark e Unit
202−minimizeWindow = liftLunapark $ MinimizeWindow unit
203−
204−fullscreenWindow ∷ ∀ e. Lunapark e Unit
205−fullscreenWindow = liftLunapark $ FullscreenWindow unit
206−
207−executeScript ∷ ∀ e. LT.Script → Lunapark e J.Json
208−executeScript script = liftLunapark $ ExecuteScript script id
209−
210−executeScriptAsync ∷ ∀ e. LT.Script → Lunapark e J.Json
211−executeScriptAsync script = liftLunapark $ ExecuteScriptAsync script id
212−
213−getAllCookies ∷ ∀ e. Lunapark e (Array LT.Cookie)
214−getAllCookies = liftLunapark $ GetAllCookies id
215−
216−getCookie ∷ ∀ e. String → Lunapark e LT.Cookie
217−getCookie name = liftLunapark $ GetCookie name id
218−
219−addCookie ∷ ∀ e. LT.Cookie → Lunapark e Unit
220−addCookie cookie = liftLunapark $ AddCookie cookie unit
221−
222−deleteCookie ∷ ∀ e. String → Lunapark e Unit
223−deleteCookie name = liftLunapark $ DeleteCookie name unit
224−
225−deleteAllCookies ∷ ∀ e. Lunapark e Unit
226−deleteAllCookies = liftLunapark $ DeleteAllCookies unit
227−
228−dismissAlert ∷ ∀ e. Lunapark e Unit
229−dismissAlert = liftLunapark $ DismissAlert unit
230−
231−acceptAlert ∷ ∀ e. Lunapark e Unit
232−acceptAlert = liftLunapark $ AcceptAlert unit
233−
234−getAlertText ∷ ∀ e. Lunapark e String
235−getAlertText = liftLunapark $ GetAlertText id
236−
237−sendAlertText ∷ ∀ e. String → Lunapark e Unit
238−sendAlertText txt = liftLunapark $ SendAlertText txt unit
239−
240−screenshot ∷ ∀ e. String → Lunapark e Unit
241−screenshot fp = liftLunapark $ Screenshot fp unit
242−
243−elementScreenshot ∷ ∀ e. LT.Element → String → Lunapark e Unit
244−elementScreenshot el fp = liftLunapark $ ElementScreenshot el fp unit
245−
246−findElement ∷ ∀ e. LT.Locator → Lunapark e LT.Element
247−findElement l = liftLunapark $ FindElement l id
248−
249−findElements ∷ ∀ e. LT.Locator → Lunapark e (Array LT.Element)
250−findElements l = liftLunapark $ FindElements l id
54+ res ←
55+ liftAff
56+ $ LP.post uri (LP.Session : Nil)
57+ $ LT.encodeCapabilitiesRequest caps
58+
59+ let
60+ sessionResponse = do
61+ sessObj ← res
62+ lmap LE.JsonDecodeError $ LT.decodeCreateSessionResponse sessObj
63+
64+ T.for sessionResponse \{ session, capabilities } → do
65+ timeoutsRef ←
66+ liftEffect $ Ref.new
67+ { implicit: Milliseconds 0.0
68+ , pageLoad: Milliseconds 300000.0
69+ , script: Milliseconds 30000.0
70+ }
25171
252−findElementInElement ∷ ∀ e. LT.Element → LT.Locator → Lunapark e LT.Element
253−findElementInElement el l = liftLunapark $ FindElementInElement el l id
72+ requestMapRef ← liftEffect $ Ref.new Map.empty
25473
255−findElementsInElement ∷ ∀ e. LT.Element → LT.Locator → Lunapark e (Array LT.Element)
256−findElementsInElement el l = liftLunapark $ FindElementsInElement el l id
74+ actionsEnabled ←
75+ map isRight
76+ $ liftAff
77+ $ LP.post uri (LP.InSession session : LP.Actions : Nil)
78+ $ LT.encodeActionRequest
79+ $ FO.singleton "action-test"
80+ $ LT.NoSource [ LT.pause $ Milliseconds 0.0 ]
25781
258−runLunapark ∷ ∀ e. String → LT.SessionId → Array LT.Capability → RunLunapark e ~> BaseRun () e
259−runLunapark uri session capabilities a = do
260− timeoutsRef ←
261− R.liftEff $ Ref.newRef
262− { implicit: Milliseconds 0.0
263− , pageLoad: Milliseconds 300000.0
264− , script: Milliseconds 30000.0
265− }
266− requestMapRef ← R.liftEff $ Ref.newRef Map.empty
267− let input =
82+ let
83+ input =
26884 { timeoutsRef
26985 , requestMapRef
27086 , uri
27187 , session
27288 , capabilities
89+ , actionsEnabled
27390 }
274− R.interpretRec (R.on _lunapark (handleLunapark input) R.send) a
91+
92+ pure $ Interpreter (interpret input)
93+
94+interpret
95+ ∷ ∀ r
96+ . HandleLunaparkInput
97+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r)
98+ ~> Run (BASE_EFFECTS r)
99+interpret input = runLunapark input <<< runLunaparkActions input
100+
101+type BASE_EFFECTS r = EXCEPT LE.Error + R.AFF + R.EFFECT + r
102+
103+runLunapark ∷ ∀ r. HandleLunaparkInput → Run (BASE_EFFECTS + LUNAPARK + r) ~> Run (BASE_EFFECTS r)
104+runLunapark input = do
105+ R.interpretRec (R.on _lunapark (handleLunapark input) R.send)
106+
107+runLunaparkActions
108+ ∷ ∀ r
109+ . HandleLunaparkInput
110+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r)
111+ ~> Run (BASE_EFFECTS + LUNAPARK + r)
112+runLunaparkActions input
113+ | input.actionsEnabled = interpretW3CActions Nil
114+ | otherwise = R.interpretRec (R.on _lunaparkActions (jsonWireActions input) R.send)
115+
116+interpretW3CActions
117+ ∷ ∀ r
118+ . List LT.ActionSequence
119+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r)
120+ ~> Run (BASE_EFFECTS + LUNAPARK + r)
121+interpretW3CActions acc as = case R.peel as of
122+ Left la → case tag la of
123+ Left a → w3cActions acc interpretW3CActions a
124+ Right others → do
125+ T.for_ (L.reverse acc) \s → performActions $ FO.singleton "dummy" s
126+ cont ← R.send others
127+ interpretW3CActions Nil cont
128+ Right a → pure a
129+ where
130+ tag = R.on _lunaparkActions Left Right
131+
132+w3cActions
133+ ∷ ∀ r a
134+ . List LT.ActionSequence
135+ → ( List LT.ActionSequence
136+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r)
137+ ~> Run (BASE_EFFECTS + LUNAPARK + r)
138+ )
139+ → ActionF (Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) a)
140+ → Run (BASE_EFFECTS + LUNAPARK + r) a
141+w3cActions acc loop = case _ of
142+ Click btn next →
143+ let
144+ seq = [ LT.pointerDown btn, LT.pointerUp btn ]
145+ in
146+ loop (inMouse seq) next
147+ ButtonDown btn next →
148+ let
149+ seq = [ LT.pointerDown btn ]
150+ in
151+ loop (inMouse seq) next
152+ ButtonUp btn next →
153+ let
154+ seq = [ LT.pointerUp btn ]
155+ in
156+ loop (inMouse seq) next
157+ DoubleClick btn next →
158+ let
159+ seq = [ LT.pointerDown btn, LT.pointerUp btn, LT.pointerDown btn, LT.pointerUp btn ]
160+ in
161+ loop (inMouse seq) next
162+ MoveTo move next →
163+ let
164+ seq = [ LT.pointerMove move ]
165+ in
166+ loop (inPointer seq) next
167+ SendKeys txt next →
168+ let
169+ seq = T.foldMap (\ch → [ LT.keyDown ch, LT.keyUp ch ]) $ Str.toCharArray txt
170+ in
171+ loop (inKeys seq) next
172+ Pause ms next →
173+ let
174+ seq = [ LT.pause ms ]
175+ in
176+ loop (anywhere seq) next
177+ InTouch tch → case tch of
178+ Tap next →
179+ let
180+ seq = [ LT.pointerDown LT.LeftBtn, LT.pointerUp LT.LeftBtn ]
181+ in
182+ loop (inTouch seq) next
183+ TouchDown next →
184+ let
185+ seq = [ LT.pointerDown LT.LeftBtn ]
186+ in
187+ loop (inTouch seq) next
188+ TouchUp next →
189+ let
190+ seq = [ LT.pointerUp LT.LeftBtn ]
191+ in
192+ loop (inTouch seq) next
193+ LongClick next →
194+ let
195+ seq = [ LT.pointerDown LT.LeftBtn, LT.pause (Milliseconds 3000.0), LT.pointerUp LT.LeftBtn ]
196+ in
197+ loop (inTouch seq) next
198+ Flick move next →
199+ let
200+ seq = [ LT.pointerMove move ]
201+ in
202+ loop (inTouch seq) next
203+ Scroll move next →
204+ let
205+ seq = [ LT.pointerMove move ]
206+ in
207+ loop (inTouch seq) next
208+ DoubleTap next →
209+ let
210+ seq = [ LT.pointerDown LT.LeftBtn, LT.pointerUp LT.LeftBtn, LT.pointerDown LT.LeftBtn, LT.pointerUp LT.LeftBtn ]
211+ in
212+ loop (inTouch seq) next
213+ where
214+ unconsed = L.uncons acc
215+
216+ inMouse seq = case unconsed of
217+ Just { head: (LT.Pointer LT.Mouse as), tail } →
218+ LT.Pointer LT.Mouse (as <> seq) : tail
219+ _ → LT.Pointer LT.Mouse seq : acc
220+
221+ inPointer seq = case unconsed of
222+ Just { head: (LT.Pointer ptr as), tail } →
223+ LT.Pointer ptr (as <> seq) : tail
224+ _ → LT.Pointer LT.Mouse seq : acc
225+
226+ inKeys seq = case unconsed of
227+ Just { head: LT.Key as, tail } →
228+ LT.Key (as <> seq) : tail
229+ _ → LT.Key seq : acc
230+
231+ inTouch seq = case unconsed of
232+ Just { head: (LT.Pointer LT.Touch as), tail } →
233+ LT.Pointer LT.Touch (as <> seq) : tail
234+ _ → LT.Pointer LT.Mouse seq : acc
235+
236+ anywhere ∷ Array (V.Variant (pause ∷ Milliseconds)) → L.List LT.ActionSequence
237+ anywhere seq = case unconsed of
238+ Nothing → L.singleton $ LT.NoSource seq
239+ Just { head, tail } → case head of
240+ LT.Pointer ptr as → LT.Pointer ptr (as <> map V.expand seq) : tail
241+ LT.Key as → LT.Key (as <> map V.expand seq) : tail
242+ LT.NoSource as → LT.NoSource (as <> seq) : tail
275243
276244type HandleLunaparkInput =
277245 { session ∷ LT.SessionId
278246 , timeoutsRef ∷ Ref.Ref LT.Timeouts
279− , requestMapRef ∷ Ref.Ref (Map.Map String Boolean)
247+ , requestMapRef ∷ Ref.Ref (Map.Map String Int)
280248 , uri ∷ String
281249 , capabilities ∷ Array LT.Capability
250+ , actionsEnabled ∷ Boolean
282251 }
283252
284−handleLunapark ∷ ∀ e. HandleLunaparkInput → LunaparkF ~> BaseRun () e
253+jsonWireActions ∷ ∀ r. HandleLunaparkInput → ActionF ~> Run (BASE_EFFECTS + LUNAPARK + r)
254+jsonWireActions inp = case _ of
255+ Click btn next → do
256+ _ ← post (LP.Click : Nil) (LT.encodeButton btn)
257+ pure next
258+ ButtonDown btn next → do
259+ _ ← post (LP.ButtonDown : Nil) (LT.encodeButton btn)
260+ pure next
261+ ButtonUp btn next → do
262+ _ ← post (LP.ButtonUp : Nil) (LT.encodeButton btn)
263+ pure next
264+ DoubleClick btn next → do
265+ _ ← case btn of
266+ LT.LeftBtn → post' (LP.DoubleClick : Nil)
267+ _ → do
268+ _ ← post (LP.Click : Nil) (LT.encodeButton btn)
269+ post (LP.Click : Nil) (LT.encodeButton btn)
270+ pure next
271+ SendKeys txt next → do
272+ _ ← post (LP.Keys : Nil) (LT.encodeSendKeysRequest txt)
273+ pure next
274+ MoveTo move next → do
275+ element ← case move.origin of
276+ LT.FromViewport → map Just $ findElement $ LT.ByTagName "body"
277+ LT.FromPointer → pure Nothing
278+ LT.FromElement el → pure $ Just el
279+ let req = { xoffset: move.x, yoffset: move.y, element }
280+ _ ← post (LP.MoveTo : Nil) (LT.encodeMoveToRequest req)
281+ pure next
282+ Pause ms next → do
283+ R.liftAff $ Aff.delay ms
284+ pure next
285+ InTouch tch → case tch of
286+ Tap next → do
287+ _ ← post' (LP.Touch : LP.Click : Nil)
288+ pure next
289+ TouchDown next → do
290+ _ ← post' (LP.Touch : LP.Down : Nil)
291+ pure next
292+ TouchUp next → do
293+ _ ← post' (LP.Touch : LP.Up : Nil)
294+ pure next
295+ LongClick next → do
296+ _ ← post' (LP.Touch : LP.LongClick : Nil)
297+ pure next
298+ Flick move next → do
299+ element ← case move.origin of
300+ LT.FromViewport → map Just $ findElement $ LT.ByTagName "body"
301+ LT.FromPointer → pure Nothing
302+ LT.FromElement el → pure $ Just el
303+ let req = { xoffset: move.x, yoffset: move.y, element }
304+ _ ← post (LP.Touch : LP.Flick : Nil) (LT.encodeMoveToRequest req)
305+ pure next
306+ Scroll move next → do
307+ element ← case move.origin of
308+ LT.FromViewport → map Just $ findElement $ LT.ByTagName "body"
309+ LT.FromPointer → pure Nothing
310+ LT.FromElement el → pure $ Just el
311+ let req = { xoffset: move.x, yoffset: move.y, element }
312+ _ ← post (LP.Touch : LP.Scroll : Nil) (LT.encodeMoveToRequest req)
313+ pure next
314+ DoubleTap next → do
315+ _ ← post' (LP.Touch : LP.DoubleClick : Nil)
316+ pure next
317+ where
318+ post a b = liftAndRethrow $ LP.post inp.uri (inSession : a) b
319+ post' a = liftAndRethrow $ LP.post' inp.uri (inSession : a)
320+
321+ inSession ∷ LP.EndpointPart
322+ inSession = LP.InSession inp.session
323+
324+handleLunapark ∷ ∀ r. HandleLunaparkInput → LunaparkF ~> Run (BASE_EFFECTS r)
285325handleLunapark inp = case _ of
286326 Quit next → do
287327 _ ← delete $ inSession : Nil
288328 pure next
289329 Status cont → do
290330 res ← get $ LP.Status : Nil
291− ss ← throwLeft $ LT.decodeServerStatus res
331+ ss ← rethrowAsJsonDecodeError $ LT.decodeServerStatus res
292332 pure $ cont ss
293333 GetTimeouts cont → do
294− res ← R.liftEff $ Ref.readRef inp.timeoutsRef
334+ res ← R.liftEffect $ Ref.read inp.timeoutsRef
295335 pure $ cont res
296336 SetTimeouts ts next → do
297− R.liftEff $ Ref.writeRef inp.timeoutsRef ts
298− withFallback "set timeouts"
299− { w3c: void $ post (inSession : LP.Timeouts : Nil) (LT.encodeTimeouts ts)
300− , jsonWire: do
301− T.for_ (LT.encodeLegacyTimeouts ts) \j →
302− void $ post (inSession : LP.Timeouts : Nil) j
303− }
337+ R.liftEffect $ Ref.write ts inp.timeoutsRef
338+ tryAndCache "set timeouts"
339+ [ void $ post (inSession : LP.Timeouts : Nil) (LT.encodeTimeouts ts)
340+ , T.for_ (LT.encodeLegacyTimeouts ts) (post (inSession : LP.Timeouts : Nil))
341+ ]
304342 pure next
305343 GoTo uri next → do
306344 _ ← post (inSession : LP.Url : Nil) $ LT.encodeGoRequest uri
307345 pure next
308346 GetUrl cont → do
309347 res ← get $ inSession : LP.Url : Nil
310− map cont $ throwLeft $ J.decodeJson res
348+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
311349 Back next → do
312− _ ← post_ (inSession : LP.Back : Nil)
350+ _ ← post' (inSession : LP.Back : Nil)
313351 pure next
314352 Forward next → do
315− _ ← post_ (inSession : LP.Forward : Nil)
353+ _ ← post' (inSession : LP.Forward : Nil)
316354 pure next
317355 Refresh next → do
318− _ ← post_ (inSession : LP.Refresh : Nil)
356+ _ ← post' (inSession : LP.Refresh : Nil)
319357 pure next
320358 GetTitle cont → do
321359 res ← get (inSession : LP.Title : Nil)
322− map cont $ throwLeft $ J.decodeJson res
360+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
323361 GetWindowHandle cont → do
324− res ← withFallback "get window handle"
325− { w3c: get (inSession : LP.Window : Nil)
326− , jsonWire: get (inSession : LP.WindowHandle : Nil)
327− }
328− map cont $ throwLeft $ LT.decodeWindowHandle res
362+ res ← tryAndCache "get window handle"
363+ [ get (inSession : LP.Window : Nil)
364+ , get (inSession : LP.WindowHandle : Nil)
365+ ]
366+ map cont $ rethrowAsJsonDecodeError $ LT.decodeWindowHandle res
329367 GetWindowHandles cont → do
330− res ← withFallback "get window handles"
331− { w3c: get (inSession : LP.Window : LP.Handles : Nil)
332− , jsonWire: get (inSession : LP.WindowHandles : Nil)
333− }
334− map cont $ throwLeft $ T.traverse LT.decodeWindowHandle =<< J.decodeJson res
368+ res ← tryAndCache "get window handles"
369+ [ get (inSession : LP.Window : LP.Handles : Nil)
370+ , get (inSession : LP.WindowHandles : Nil)
371+ ]
372+ map cont $ rethrowAsJsonDecodeError $ T.traverse LT.decodeWindowHandle =<< J.decodeJson res
335373 CloseWindow next → do
336374 _ ← delete (inSession : LP.Window : Nil)
337375 pure next
@@ -342,54 +380,53 @@ handleLunapark inp = case _ of
342380 _ ← post (inSession : LP.Frame : Nil) (LT.encodeFrameId fid)
343381 pure next
344382 SwitchToParentFrame next → do
345− _ ← post_ (inSession : LP.Frame : LP.Parent : Nil)
383+ _ ← post' (inSession : LP.Frame : LP.Parent : Nil)
346384 pure next
347385 GetWindowRectangle cont → do
348− res ← withFallback "get window rectangle"
349− { w3c: do
350− res ← get (inSession : LP.Window : LP.Rect : Nil)
351− throwLeft $ LT.decodeRectangle res
352− , jsonWire: do
353− position ← get (inSession : LP.Window : LP.Position : Nil)
354− size ← get (inSession : LP.Window : LP.Size : Nil)
355− throwLeft $ LT.decodeRectangleLegacy { position, size }
356− }
386+ res ← tryAndCache "get window rectangle"
387+ [ do
388+ res ← get (inSession : LP.Window : LP.Rect : Nil)
389+ rethrowAsJsonDecodeError $ LT.decodeRectangle res
390+ , do
391+ position ← get (inSession : LP.Window : LP.Position : Nil)
392+ size ← get (inSession : LP.Window : LP.Size : Nil)
393+ rethrowAsJsonDecodeError $ LT.decodeRectangleLegacy { position, size }
394+ ]
357395 pure $ cont res
358396 SetWindowRectangle r next → do
359− withFallback "set window rectangle"
360− { w3c: do
361− void $ post (inSession : LP.Window : LP.Rect : Nil) (LT.encodeRectangle r)
362− , jsonWire: do
363− let js = LT.encodeRectangleLegacy r
364− _ ← post (inSession : LP.Window : LP.Size : Nil) js.size
365− void $ post (inSession : LP.Window : LP.Position : Nil) js.position
366− }
397+ tryAndCache "set window rectangle"
398+ [ void $ post (inSession : LP.Window : LP.Rect : Nil) (LT.encodeRectangle r)
399+ , do
400+ let js = LT.encodeRectangleLegacy r
401+ _ ← post (inSession : LP.Window : LP.Size : Nil) js.size
402+ void $ post (inSession : LP.Window : LP.Position : Nil) js.position
403+ ]
367404 pure next
368405 MaximizeWindow next → do
369− _ ← post_ (inSession : LP.Window : LP.Maximize : Nil)
406+ _ ← post' (inSession : LP.Window : LP.Maximize : Nil)
370407 pure next
371408 MinimizeWindow next → do
372− _ ← post_ (inSession : LP.Window : LP.Minimize : Nil)
409+ _ ← post' (inSession : LP.Window : LP.Minimize : Nil)
373410 pure next
374411 FullscreenWindow next → do
375− _ ← post_ (inSession : LP.Window : LP.Fullscreen : Nil)
412+ _ ← post' (inSession : LP.Window : LP.Fullscreen : Nil)
376413 pure next
377414 ExecuteScript script cont → do
378− map cont $ withFallback "execute script"
379− { w3c: post (inSession : LP.Execute : LP.Sync : Nil) (LT.encodeScript script)
380− , jsonWire: post (inSession : LP.Execute : Nil) (LT.encodeScript script)
381− }
415+ map cont $ tryAndCache "execute script"
416+ [ post (inSession : LP.Execute : LP.Sync : Nil) (LT.encodeScript script)
417+ , post (inSession : LP.Execute : Nil) (LT.encodeScript script)
418+ ]
382419 ExecuteScriptAsync script cont → do
383− map cont $ withFallback "execute script async"
384− { w3c: post (inSession : LP.Execute : LP.Async : Nil) (LT.encodeScript script)
385− , jsonWire: post (inSession : LP.ExecuteAsync : Nil) (LT.encodeScript script)
386− }
420+ map cont $ tryAndCache "execute script async"
421+ [ post (inSession : LP.Execute : LP.Async : Nil) (LT.encodeScript script)
422+ , post (inSession : LP.ExecuteAsync : Nil) (LT.encodeScript script)
423+ ]
387424 GetAllCookies cont → do
388425 res ← get (inSession : LP.Cookies : Nil)
389− map cont $ throwLeft $ T.traverse LT.decodeCookie =<< J.decodeJson res
426+ map cont $ rethrowAsJsonDecodeError $ T.traverse LT.decodeCookie =<< J.decodeJson res
390427 GetCookie name cont → do
391428 res ← get (inSession : LP.Cookie name : Nil)
392− map cont $ throwLeft $ LT.decodeCookie res
429+ map cont $ rethrowAsJsonDecodeError $ LT.decodeCookie res
393430 DeleteAllCookies next → do
394431 _ ← delete (inSession : LP.Cookies : Nil)
395432 pure next
@@ -400,564 +437,168 @@ handleLunapark inp = case _ of
400437 _ ← post (inSession : LP.Cookies : Nil) (LT.encodeCookie cookie)
401438 pure next
402439 DismissAlert next → do
403− _ ← withFallback "dismiss alert"
404− { w3c: post_ (inSession : LP.Alert : LP.Dismiss : Nil)
405− , jsonWire: post_ (inSession : LP.DismissAlert : Nil)
406− }
440+ _ ← tryAndCache "dismiss alert"
441+ [ post' (inSession : LP.Alert : LP.Dismiss : Nil)
442+ , post' (inSession : LP.DismissAlert : Nil)
443+ ]
407444 pure next
408445 AcceptAlert next → do
409− _ ← withFallback "accept alert"
410− { w3c: post_ (inSession : LP.Alert : LP.Accept : Nil)
411− , jsonWire: post_ (inSession : LP.AcceptAlert : Nil)
412− }
446+ _ ← tryAndCache "accept alert"
447+ [ post' (inSession : LP.Alert : LP.Accept : Nil)
448+ , post' (inSession : LP.AcceptAlert : Nil)
449+ ]
413450 pure next
414451 GetAlertText cont → do
415− res ← withFallback "get alert text"
416− { w3c: get (inSession : LP.Alert : LP.Text : Nil)
417− , jsonWire: get (inSession : LP.AlertText : Nil)
418− }
419− map cont $ throwLeft $ J.decodeJson res
452+ res ← tryAndCache "get alert text"
453+ [ get (inSession : LP.Alert : LP.Text : Nil)
454+ , get (inSession : LP.AlertText : Nil)
455+ ]
456+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
420457 SendAlertText str next → do
421− _ ← withFallback "send alert text"
422− { w3c: post (inSession : LP.Alert : LP.Text : Nil) (LT.encodeSendKeysRequest str)
423− , jsonWire: post (inSession : LP.AlertText : Nil) (LT.encodeSendKeysRequest str)
424− }
458+ _ ← tryAndCache "send alert text"
459+ [ post (inSession : LP.Alert : LP.Text : Nil) (LT.encodeSendKeysRequest str)
460+ , post (inSession : LP.AlertText : Nil) (LT.encodeSendKeysRequest str)
461+ ]
425462 pure next
426463 Screenshot fp next → do
427464 res ← get (inSession : LP.Screenshot : Nil)
428− screenshotPack ← throwLeft $ LT.decodeScreenshot res
429− buffer ← R.liftEff $ B.fromString screenshotPack.content screenshotPack.encoding
430− R.liftAff $ FS.writeFile fp buffer
431− pure next
432− ElementScreenshot el fp next → do
433− res ← get (inSession : LP.InElement el : LP.Screenshot : Nil)
434− screenshotPack ← throwLeft $ LT.decodeScreenshot res
435− buffer ← R.liftEff $ B.fromString screenshotPack.content screenshotPack.encoding
465+ screenshotPack ← rethrowAsJsonDecodeError $ LT.decodeScreenshot res
466+ buffer ← R.liftEffect $ B.fromString screenshotPack.content screenshotPack.encoding
436467 R.liftAff $ FS.writeFile fp buffer
437468 pure next
438469 FindElement loc cont → do
439470 res ← post (inSession : LP.Element : Nil) (LT.encodeLocator loc)
440− map cont $ throwLeft $ LT.decodeElement res
471+ map cont $ rethrowAsJsonDecodeError $ LT.decodeElement res
441472 FindElements loc cont → do
442473 res ← post (inSession : LP.Elements : Nil) (LT.encodeLocator loc)
443− map cont $ throwLeft $ T.traverse LT.decodeElement =<< J.decodeJson res
444− FindElementInElement el loc cont → do
445− res ← post (inSession : LP.InElement el : LP.Element : Nil) (LT.encodeLocator loc)
446− map cont $ throwLeft $ LT.decodeElement res
447− FindElementsInElement el loc cont → do
448− res ← post (inSession : LP.InElement el : LP.Elements : Nil) (LT.encodeLocator loc)
449− map cont $ throwLeft $ T.traverse LT.decodeElement =<< J.decodeJson res
474+ map cont $ rethrowAsJsonDecodeError $ T.traverse LT.decodeElement =<< J.decodeJson res
475+ GetActiveElement cont → do
476+ res ← get (inSession : LP.Element : LP.Active : Nil)
477+ map cont $ rethrowAsJsonDecodeError $ LT.decodeElement res
478+ PerformActions req next → do
479+ when inp.actionsEnabled
480+ $ void
481+ $ post
482+ (inSession : LP.Actions : Nil)
483+ (LT.encodeActionRequest req)
484+ pure next
485+ ReleaseActions next → do
486+ when inp.actionsEnabled $ void $ delete (inSession : LP.Actions : Nil)
487+ pure next
488+ OnElement el elF →
489+ let
490+ inElement = LP.InElement el
491+ in
492+ case elF of
493+ ChildElement loc cont → do
494+ res ← post (inSession : inElement : LP.Element : Nil) (LT.encodeLocator loc)
495+ map cont $ rethrowAsJsonDecodeError $ LT.decodeElement res
496+ ChildElements loc cont → do
497+ res ← post (inSession : inElement : LP.Elements : Nil) (LT.encodeLocator loc)
498+ map cont $ rethrowAsJsonDecodeError $ T.traverse LT.decodeElement =<< J.decodeJson res
499+ ScreenshotEl fp next → do
500+ res ← get (inSession : inElement : LP.Screenshot : Nil)
501+ screenshotPack ← rethrowAsJsonDecodeError $ LT.decodeScreenshot res
502+ buffer ← R.liftEffect $ B.fromString screenshotPack.content screenshotPack.encoding
503+ R.liftAff $ FS.writeFile fp buffer
504+ pure next
505+ IsSelected cont → do
506+ res ← get (inSession : inElement : LP.Selected : Nil)
507+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
508+ GetAttribute attr cont → do
509+ res ← get (inSession : inElement : LP.Attribute attr : Nil)
510+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
511+ GetProperty prop cont → do
512+ map cont $ get (inSession : inElement : LP.Property prop : Nil)
513+ GetCss css cont → do
514+ res ← get (inSession : inElement : LP.CssValue css : Nil)
515+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
516+ GetText cont → do
517+ res ← get (inSession : inElement : LP.Text : Nil)
518+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
519+ GetTagName cont → do
520+ res ← get (inSession : inElement : LP.Name : Nil)
521+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
522+ GetRectangle cont →
523+ map cont $ tryAndCache "get element rectangle"
524+ [ do
525+ res ← get (inSession : inElement : LP.Rect : Nil)
526+ rethrowAsJsonDecodeError $ LT.decodeRectangle res
527+ , do
528+ position ← get (inSession : inElement : LP.Position : Nil)
529+ size ← get (inSession : inElement : LP.Size : Nil)
530+ rethrowAsJsonDecodeError $ LT.decodeRectangleLegacy { position, size }
531+ ]
532+ IsEnabled cont → do
533+ res ← get (inSession : inElement : LP.Enabled : Nil)
534+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
535+ ClickEl next → do
536+ _ ← tryAndCache "chromedriver75 update clickElement"
537+ [ post' (inSession : inElement : LP.Click : Nil)
538+ , post (inSession : inElement : LP.Click : Nil) $ LT.encodeElement el
539+ ]
540+ pure next
541+ ClearEl next → do
542+ _ ← tryAndCache "chromedriver75 update clearElement"
543+ [ post' (inSession : inElement : LP.Clear : Nil)
544+ , post (inSession : inElement : LP.Click : Nil) $ LT.encodeElement el
545+ ]
546+ pure next
547+ SendKeysEl txt next → do
548+ _ ← tryAndCache "send keys chromedriver hack"
549+ [ post (inSession : inElement : LP.Value : Nil) (LT.encodeSendKeysRequest txt)
550+ , post (inSession : inElement : LP.Value : Nil)
551+ $ J.encodeJson
552+ $ FO.singleton "value"
553+ $ Str.toCharArray txt
554+ ]
555+ pure next
556+ IsDisplayed cont → do
557+ res ← tryAndCache "is element displayed"
558+ [ get (inSession : inElement : LP.Displayed : Nil)
559+ , do
560+ let
561+ script =
562+ { script: """var el = arguments[0]; return el.offsetHeight > 0 && el.offsetWidth > 0"""
563+ , args: [ LT.encodeElement el ]
564+ }
565+ handleLunapark inp $ ExecuteScript script identity
566+ ]
567+ map cont $ rethrowAsJsonDecodeError $ J.decodeJson res
568+ Submit next → do
569+ _ ← tryAndCache "chromedriver75 update submit form"
570+ [ post' (inSession : inElement : LP.Submit : Nil)
571+ , post (inSession : inElement : LP.Submit : Nil) $ LT.encodeElement el
572+ ]
573+ pure next
450574
451575 where
452576 delete a = liftAndRethrow $ LP.delete inp.uri a
453577 post a b = liftAndRethrow $ LP.post inp.uri a b
454578 get a = liftAndRethrow $ LP.get inp.uri a
455− post_ a = liftAndRethrow $ LP.post_ inp.uri a
456−
457− withFallback ∷ ∀ a. String → { w3c ∷ BaseRun () e a, jsonWire ∷ BaseRun () e a } → BaseRun () e a
458− withFallback key { w3c: try, jsonWire: fallback } = do
459− mp ← R.liftEff $ Ref.readRef inp.requestMapRef
460− case DT.spy $ Map.lookup key mp of
461− Just true → try
462− Just false → fallback
579+ post' a = liftAndRethrow $ LP.post' inp.uri a
580+
581+ -- | It caches an index of an action that is valid for current webdriver implementation.
582+ -- | So you don't need to search correct one by tring them each time
583+ tryAndCache ∷ ∀ a. String → Array (Run (BASE_EFFECTS r) a) → Run (BASE_EFFECTS r) a
584+ tryAndCache key actions = do
585+ mp ← R.liftEffect $ Ref.read inp.requestMapRef
586+ case Map.lookup key mp of
587+ Just ix → case A.index actions ix of
588+ Just action → action
589+ Nothing → RE.throw $ LE.CachingError $ LE.IncorrectCache key
463590 Nothing →
464591 let
465− try' = do
466− a ← try
467− R.liftEff $ Ref.modifyRef inp.requestMapRef (Map.insert key true)
468− pure a
469− fallback' = do
470− a ← fallback
471− R.liftEff $ Ref.modifyRef inp.requestMapRef (Map.insert key false)
472− pure a
473− in catch try' \_ → fallback'
592+ go ix acc act =
593+ let
594+ try' = do
595+ a ← act
596+ R.liftEffect $ Ref.modify_ (Map.insert key ix) inp.requestMapRef
597+ pure a
598+ in
599+ catch try' \_ → acc
600+ in
601+ FI.foldlWithIndex go (RE.throw $ LE.CachingError $ LE.EmptyCases key) actions
474602
475603 inSession ∷ LP.EndpointPart
476604 inSession = LP.InSession inp.session
477−
478− liftAndRethrow ∷ ∀ e ω. Aff (LunaparkEffects e) (Either LE.Error ω) → BaseRun () e ω
479− liftAndRethrow a = do
480− res ← R.liftAff a
481− RE.rethrow res
482−
483− throwLeft ∷ ∀ ω. Either String ω → BaseRun () e ω
484− throwLeft = RE.rethrow <<< lmap LE.unknownError
485−
486−-- Safe, since we actually want handler and result have same rows not, remove except
487−catch ∷ ∀ e r a. R.Run (except ∷ EXCEPT e|r) a → (e → R.Run (except ∷ EXCEPT e|r) a) → R.Run (except ∷ EXCEPT e|r) a
488−catch = unsafeCoerce $ flip RE.catch
489−
490−
491−--interpret ∷ ∀ e. LunaparkF ~> Aff (ajax ∷ AJAX|e)
492−--interpret = unsafeCoerce
493−
494−
495−{-
496−import Prelude
497−
498−
499−
500−
501−
502−
503−
504−import Debug.Trace as DT
505−
506−type Config =
507− { session ∷ LT.SessionId
508− , baseURI ∷ String
509− , capabilities ∷ Array LT.Capability
510− }
511−
512−type State =
513− { timeouts ∷ LT.Timeouts }
514−
515−type LunaparkConstraints e m a
516− = MonadError LE.Error m
517− ⇒ MonadAff (ajax ∷ AJAX|e) m
518− ⇒ MonadAsk Config m
519− ⇒ MonadState State m
520− ⇒ a
521−
522−rethrow
523− ∷ ∀ m e eff a
524− . MonadThrow e m
525− ⇒ MonadAff eff m
526− ⇒ Aff eff (Either e a)
527− → m a
528−rethrow a = liftAff a >>= either throwError pure
529−
530−wrapEither ∷ ∀ m a. MonadThrow LE.Error m ⇒ Either String a → m a
531−wrapEither = either (throwError <<< LE.unknownError) pure
532−
533−init
534− ∷ ∀ e m
535− . MonadAff (ajax ∷ AJAX|e) m
536− ⇒ String
537− → LT.CapabilitiesRequest
538− → m (Either LE.Error LT.CreateSessionResponse)
539−init uri desiredCapabilities = do
540− sessObj ← liftAff $ LA.init uri $ LT.encodeCapabilitiesRequest desiredCapabilities
541− pure $ sessObj >>= \a → lmap LE.unknownError (LT.decodeCreateSessionResponse a)
542−
543−quit ∷ ∀ e m. LunaparkConstraints e m (m Unit)
544−quit = do
545− r ← ask
546− void $ rethrow $ LA.quit r.baseURI $ un LT.SessionId r.session
547−
548−status ∷ ∀ e m. LunaparkConstraints e m (m LT.ServerStatus)
549−status = do
550− r ← ask
551− res ← rethrow $ LA.status r.baseURI
552− wrapEither $ LT.decodeServerStatus res
553−
554−getTimeouts ∷ ∀ e m. LunaparkConstraints e m (m LT.Timeouts)
555−getTimeouts = do
556− r ← ask
557− res ← rethrow $ LA.getTimeouts r.baseURI $ un LT.SessionId r.session
558− wrapEither $ LT.decodeTimeouts res
559−
560−setTimeouts ∷ ∀ e m. LunaparkConstraints e m (LT.Timeouts → m Unit)
561−setTimeouts timeouts = do
562− r ← ask
563− void $ rethrow $ LA.setTimeouts
564− r.baseURI
565− (un LT.SessionId r.session)
566− (LT.encodeTimeouts timeouts)
567−
568−go ∷ ∀ e m. LunaparkConstraints e m (String → m Unit)
569−go url = do
570− r ← ask
571− void $ rethrow $ LA.go
572− r.baseURI
573− (un LT.SessionId r.session)
574− (LT.encodeGoRequest url)
575−
576−getCurrentUrl ∷ ∀ e m. LunaparkConstraints e m (m String)
577−getCurrentUrl = do
578− r ← ask
579− res ← rethrow $ LA.getCurrentUrl r.baseURI $ un LT.SessionId r.session
580− wrapEither $ J.decodeJson res
581−
582−back ∷ ∀ e m. LunaparkConstraints e m (m Unit)
583−back = do
584− r ← ask
585− void $ rethrow $ LA.back r.baseURI $ un LT.SessionId r.session
586−
587−forward ∷ ∀ e m. LunaparkConstraints e m (m Unit)
588−forward = do
589− r ← ask
590− void $ rethrow $ LA.forward r.baseURI $ un LT.SessionId r.session
591−
592−refresh ∷ ∀ e m. LunaparkConstraints e m (m Unit)
593−refresh = do
594− r ← ask
595− void $ rethrow $ LA.refresh r.baseURI $ un LT.SessionId r.session
596−
597−getTitle ∷ ∀ e m. LunaparkConstraints e m (m String)
598−getTitle = do
599− r ← ask
600− res ← rethrow $ LA.getTitle r.baseURI $ un LT.SessionId r.session
601− wrapEither $ J.decodeJson res
602−
603−getWindowHandle ∷ ∀ e m. LunaparkConstraints e m (m LT.WindowHandle)
604−getWindowHandle = do
605− r ← ask
606− res ← rethrow $ LA.getWindowHandle r.baseURI $ un LT.SessionId r.session
607− wrapEither $ LT.decodeWindowHandle res
608−
609−closeWindow ∷ ∀ e m. LunaparkConstraints e m (m Unit)
610−closeWindow = do
611− r ← ask
612− void $ rethrow $ LA.closeWindow r.baseURI $ un LT.SessionId r.session
613−
614−switchToWindow ∷ ∀ e m. LunaparkConstraints e m (LT.WindowHandle → m Unit)
615−switchToWindow wh = do
616− r ← ask
617− void $ rethrow $ LA.switchToWindow
618− r.baseURI
619− (un LT.SessionId r.session)
620− (LT.encodeSwitchToWindowRequest wh)
621−
622−getWindowHandles ∷ ∀ e m. LunaparkConstraints e m (m (Array LT.WindowHandle))
623−getWindowHandles = do
624− r ← ask
625− res ← rethrow $ LA.getWindowHandles r.baseURI $ un LT.SessionId r.session
626− wrapEither $ T.traverse LT.decodeWindowHandle =<< J.decodeJson res
627−
628−switchToFrame ∷ ∀ e m. LunaparkConstraints e m (LT.FrameId → m Unit)
629−switchToFrame fid = do
630− r ← ask
631− void $ rethrow $ LA.switchToFrame
632− r.baseURI
633− (un LT.SessionId r.session)
634− (LT.encodeFrameId fid)
635−
636−switchToParentFrame ∷ ∀ e m. LunaparkConstraints e m (m Unit)
637−switchToParentFrame = do
638− r ← ask
639− void $ rethrow $ LA.switchToParentFrame r.baseURI $ un LT.SessionId r.session
640−
641−getWindowRect ∷ ∀ e m. LunaparkConstraints e m (m LT.Rectangle)
642−getWindowRect = do
643− r ← ask
644− res ← rethrow $ LA.getWindowRect r.baseURI $ un LT.SessionId r.session
645− wrapEither $ LT.decodeRectangle res
646−
647−setWindowRect ∷ ∀ e m. LunaparkConstraints e m (LT.Rectangle → m Unit)
648−setWindowRect rectangle = do
649− r ← ask
650− void $ rethrow $ LA.setWindowRect
651− r.baseURI
652− (un LT.SessionId r.session)
653− (LT.encodeRectangle rectangle)
654−
655−maximizeWindow ∷ ∀ e m. LunaparkConstraints e m (m Unit)
656−maximizeWindow = do
657− r ← ask
658− void $ rethrow $ LA.maximizeWindow r.baseURI $ un LT.SessionId r.session
659−
660−minimizeWindow ∷ ∀ e m. LunaparkConstraints e m (m Unit)
661−minimizeWindow = do
662− r ← ask
663− void $ rethrow $ LA.minimizeWindow r.baseURI $ un LT.SessionId r.session
664−
665−fullscreenWindow ∷ ∀ e m. LunaparkConstraints e m (m Unit)
666−fullscreenWindow = do
667− r ← ask
668− void $ rethrow $ LA.fullscreenWindow r.baseURI $ un LT.SessionId r.session
669−
670−findElement ∷ ∀ m e. LunaparkConstraints e m (LT.Locator → m LT.Element)
671−findElement loc = do
672− r ← ask
673− res ←
674− rethrow $ LA.findElement
675− r.baseURI
676− (un LT.SessionId r.session)
677− (LT.encodeLocator loc)
678− wrapEither $ LT.decodeElement res
679−
680−findElements ∷ ∀ m e. LunaparkConstraints e m (LT.Locator → m (Array LT.Element))
681−findElements loc = do
682− r ← ask
683− res ←
684− rethrow $ LA.findElements
685− r.baseURI
686− (un LT.SessionId r.session)
687− (LT.encodeLocator loc)
688− wrapEither $ T.traverse LT.decodeElement =<< J.decodeJson res
689−
690−findElementFromElement
691− ∷ ∀ m e
692− . LunaparkConstraints e m
693− ( LT.Element
694− → LT.Locator
695− → m LT.Element
696− )
697−findElementFromElement el loc = do
698− r ← ask
699− res ←
700− rethrow $ LA.findElementFromElement
701− r.baseURI
702− (un LT.SessionId r.session)
703− (un LT.Element el)
704− (LT.encodeLocator loc)
705− wrapEither $ LT.decodeElement res
706−
707−findElementsFromElement
708− ∷ ∀ m e
709− . LunaparkConstraints e m
710− ( LT.Element
711− → LT.Locator
712− → m (Array LT.Element)
713− )
714−findElementsFromElement el loc = do
715− r ← ask
716− res ←
717− rethrow $ LA.findElementsFromElement
718− r.baseURI
719− (un LT.SessionId r.session)
720− (un LT.Element el)
721− (LT.encodeLocator loc)
722− wrapEither $ T.traverse LT.decodeElement =<< J.decodeJson res
723−
724−getActiveElement ∷ ∀ m e. LunaparkConstraints e m (m LT.Element)
725−getActiveElement = do
726− r ← ask
727− res ← rethrow $ LA.getActiveElement r.baseURI $ un LT.SessionId r.session
728− wrapEither $ LT.decodeElement res
729−
730−isElementSelected ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m Boolean)
731−isElementSelected el = do
732− r ← ask
733− res ←
734− rethrow $ LA.isElementSelected
735− r.baseURI
736− (un LT.SessionId r.session)
737− (un LT.Element el)
738− wrapEither $ J.decodeJson res
739−
740−getElementAttribute ∷ ∀ m e. LunaparkConstraints e m (LT.Element → String → m (Maybe String))
741−getElementAttribute el attrName = do
742− r ← ask
743− res ←
744− rethrow $ LA.getElementAttribute
745− r.baseURI
746− (un LT.SessionId r.session)
747− (un LT.Element el)
748− attrName
749− if J.isNull res
750− then pure Nothing
751− else wrapEither $ J.decodeJson res
752−
753−getElementProperty ∷ ∀ m e. LunaparkConstraints e m (LT.Element → String → m J.Json)
754−getElementProperty el propName = do
755− r ← ask
756− rethrow $ LA.getElementProperty
757− r.baseURI
758− (un LT.SessionId r.session)
759− (un LT.Element el)
760− propName
761−
762−getElementCSSValue ∷ ∀ m e. LunaparkConstraints e m (LT.Element → String → m String)
763−getElementCSSValue el cssName = do
764− r ← ask
765− res ←
766− rethrow $ LA.getElementCSSValue
767− r.baseURI
768− (un LT.SessionId r.session)
769− (un LT.Element el)
770− cssName
771− wrapEither $ J.decodeJson res
772−
773−getElementText ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m String)
774−getElementText el = do
775− r ← ask
776− res ←
777− rethrow $ LA.getElementText
778− r.baseURI
779− (un LT.SessionId r.session)
780− (un LT.Element el)
781− wrapEither $ J.decodeJson res
782−
783−getElementTagName ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m String)
784−getElementTagName el = do
785− r ← ask
786− res ←
787− rethrow $ LA.getElementTagName
788− r.baseURI
789− (un LT.SessionId r.session)
790− (un LT.Element el)
791− wrapEither $ J.decodeJson res
792−
793−getElementRect ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m LT.Rectangle)
794−getElementRect el = do
795− r ← ask
796− res ←
797− rethrow $ LA.getElementRect
798− r.baseURI
799− (un LT.SessionId r.session)
800− (un LT.Element el)
801− wrapEither $ LT.decodeRectangle res
802−
803−isElementEnabled ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m Boolean)
804−isElementEnabled el = do
805− r ← ask
806− res ←
807− rethrow $ LA.isElementEnabled
808− r.baseURI
809− (un LT.SessionId r.session)
810− (un LT.Element el)
811− wrapEither $ J.decodeJson res
812−
813−elementClick ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m Unit)
814−elementClick el = do
815− r ← ask
816− void $ rethrow $ LA.elementClick
817− r.baseURI
818− (un LT.SessionId r.session)
819− (un LT.Element el)
820−
821−elementClear ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m Unit)
822−elementClear el = do
823− r ← ask
824− void $ rethrow $ LA.elementClear
825− r.baseURI
826− (un LT.SessionId r.session)
827− (un LT.Element el)
828−
829−elementSendKeys ∷ ∀ m e. LunaparkConstraints e m (LT.Element → String → m Unit)
830−elementSendKeys el txt = do
831− r ← ask
832− void $ rethrow $ LA.elementSendKeys
833− r.baseURI
834− (un LT.SessionId r.session)
835− (un LT.Element el)
836− (LT.encodeSendKeysRequest txt)
837−
838−getPageSource ∷ ∀ m e. LunaparkConstraints e m (m String)
839−getPageSource = do
840− r ← ask
841− res ← rethrow $ LA.getPageSource r.baseURI (un LT.SessionId r.session)
842− wrapEither $ J.decodeJson res
843−
844−executeScript ∷ ∀ m e. LunaparkConstraints e m (LT.Script → m J.Json)
845−executeScript scr = do
846− r ← ask
847− rethrow $ LA.executeScript
848− r.baseURI
849− (un LT.SessionId r.session)
850− (LT.encodeScript scr)
851−
852−executeAsyncScript ∷ ∀ m e. LunaparkConstraints e m (LT.Script → m J.Json)
853−executeAsyncScript scr = do
854− r ← ask
855− rethrow $ LA.executeAsyncScript
856− r.baseURI
857− (un LT.SessionId r.session)
858− (LT.encodeScript scr)
859−
860−getAllCookies ∷ ∀ m e. LunaparkConstraints e m (m (Array LT.Cookie))
861−getAllCookies = do
862− r ← ask
863− res ← rethrow $ LA.getAllCookies r.baseURI $ un LT.SessionId r.session
864− wrapEither $ T.traverse LT.decodeCookie =<< J.decodeJson res
865−
866−getNamedCookie ∷ ∀ m e. LunaparkConstraints e m (String → m LT.Cookie)
867−getNamedCookie name = do
868− r ← ask
869− res ← rethrow $ LA.getNamedCookie r.baseURI (un LT.SessionId r.session) name
870− wrapEither $ LT.decodeCookie res
871−
872−addCookie ∷ ∀ m e. LunaparkConstraints e m (LT.Cookie → m Unit)
873−addCookie cookie = do
874− r ← ask
875− void $ rethrow $ LA.addCookie
876− r.baseURI
877− (un LT.SessionId r.session)
878− (LT.encodeCookie cookie)
879−
880−deleteCookie ∷ ∀ m e. LunaparkConstraints e m (String → m Unit)
881−deleteCookie name = do
882− r ← ask
883− void $ rethrow $ LA.deleteCookie
884− r.baseURI
885− (un LT.SessionId r.session)
886− name
887−
888−deleteAllCookies ∷ ∀ m e. LunaparkConstraints e m (m Unit)
889−deleteAllCookies = do
890− r ← ask
891− void $ rethrow $ LA.deleteAllCookies r.baseURI $ un LT.SessionId r.session
892−
893−performActions ∷ ∀ m e. LunaparkConstraints e m (LT.ActionRequest → m Unit)
894−performActions req = do
895− r ← ask
896− void $ rethrow $ LA.performActions
897− r.baseURI
898− (un LT.SessionId r.session)
899− (DT.spy $ LT.encodeActionRequest req)
900−
901−releaseActions ∷ ∀ m e. LunaparkConstraints e m (m Unit)
902−releaseActions = do
903− r ← ask
904− void $ rethrow $ LA.releaseActions r.baseURI $ un LT.SessionId r.session
905−
906−dismissAlert ∷ ∀ m e. LunaparkConstraints e m (m Unit)
907−dismissAlert = do
908− r ← ask
909− void $ rethrow $ LA.dismissAlert r.baseURI $ un LT.SessionId r.session
910−
911−acceptAlert ∷ ∀ m e. LunaparkConstraints e m (m Unit)
912−acceptAlert = do
913− r ← ask
914− void $ rethrow $ LA.acceptAlert r.baseURI $ un LT.SessionId r.session
915−
916−getAlertText ∷ ∀ m e. LunaparkConstraints e m (m String)
917−getAlertText = do
918− r ← ask
919− res ← rethrow $ LA.getAlertText r.baseURI $ un LT.SessionId r.session
920− wrapEither $ J.decodeJson res
921−
922−sendAlertText ∷ ∀ m e. LunaparkConstraints e m (String → m Unit)
923−sendAlertText s = do
924− r ← ask
925− void $ rethrow $ LA.sendAlertText
926− r.baseURI
927− (un LT.SessionId r.session)
928− (LT.encodeSendKeysRequest s)
929−
930−takeScreenshot ∷ ∀ m e. LunaparkConstraints e m (m LT.Screenshot)
931−takeScreenshot = do
932− r ← ask
933− res ← rethrow $ LA.takeScreenshot
934− r.baseURI
935− (un LT.SessionId r.session)
936− wrapEither $ LT.decodeScreenshot res
937−
938−takeElementScreenshot ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m LT.Screenshot)
939−takeElementScreenshot el = do
940− r ← ask
941− res ← rethrow $ LA.takeElementScreenshot
942− r.baseURI
943− (un LT.SessionId r.session)
944− (un LT.Element el)
945− wrapEither $ LT.decodeScreenshot res
946−
947−-- Recomended by W3C
948−isDisplayed ∷ ∀ m e. LunaparkConstraints e m (LT.Element → m Boolean)
949−isDisplayed el = do
950− r ← ask
951− res ← rethrow $ LA.isDisplayed
952− r.baseURI
953− (un LT.SessionId r.session)
954− (un LT.Element el)
955− wrapEither $ J.decodeJson res
956−
957−-- JsonWire legacy
958−setWireTimeouts ∷ ∀ m e. LunaparkConstraints e m (LT.Timeouts → m Unit)
959−setWireTimeouts ts = do
960− r ← ask
961− T.for_ (LT.encodeLegacyTimeouts ts) \j →
962− void $ rethrow $ LA.setTimeouts r.baseURI (un LT.SessionId r.session) j
963−-}
src/Lunapark/ActionF.pursnew file+79
@@ -0,0 +1,79 @@
1+module Lunapark.ActionF where
2+
3+import Prelude
4+
5+import Type.Proxy (Proxy(..))
6+import Data.Time.Duration (Milliseconds)
7+import Lunapark.Types as LT
8+import Run (Run)
9+import Run as R
10+
11+data ActionF a
12+ = Click LT.Button a
13+ | ButtonDown LT.Button a
14+ | ButtonUp LT.Button a
15+ | DoubleClick LT.Button a
16+ | SendKeys String a
17+ | MoveTo LT.PointerMove a
18+ | InTouch (TouchF a)
19+ | Pause Milliseconds a
20+
21+data TouchF a
22+ = Tap a
23+ | TouchDown a
24+ | TouchUp a
25+ | LongClick a
26+ | Flick LT.PointerMove a
27+ | Scroll LT.PointerMove a
28+ | DoubleTap a
29+
30+derive instance functorActionF ∷ Functor ActionF
31+derive instance functorTouchF ∷ Functor TouchF
32+
33+_lunaparkActions = Proxy ∷ Proxy "lunaparkActions"
34+type LUNAPARK_ACTIONS r = (lunaparkActions ∷ ActionF | r)
35+
36+liftAction ∷ ∀ r. ActionF Unit → Run (LUNAPARK_ACTIONS r) Unit
37+liftAction = R.lift _lunaparkActions
38+
39+click ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
40+click btn = liftAction $ Click btn unit
41+
42+buttonDown ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
43+buttonDown btn = liftAction $ ButtonDown btn unit
44+
45+buttonUp ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
46+buttonUp btn = liftAction $ ButtonUp btn unit
47+
48+doubleClick ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
49+doubleClick btn = liftAction $ DoubleClick btn unit
50+
51+sendKeys ∷ ∀ r. String → Run (LUNAPARK_ACTIONS r) Unit
52+sendKeys txt = liftAction $ SendKeys txt unit
53+
54+moveTo ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
55+moveTo move = liftAction $ MoveTo move unit
56+
57+pause ∷ ∀ r. Milliseconds → Run (LUNAPARK_ACTIONS r) Unit
58+pause ms = liftAction $ Pause ms unit
59+
60+tap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
61+tap = liftAction $ InTouch $ Tap unit
62+
63+touchDown ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
64+touchDown = liftAction $ InTouch $ TouchDown unit
65+
66+touchUp ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
67+touchUp = liftAction $ InTouch $ TouchUp unit
68+
69+longTap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
70+longTap = liftAction $ InTouch $ LongClick unit
71+
72+flick ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
73+flick move = liftAction $ InTouch $ Flick move unit
74+
75+scroll ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
76+scroll move = liftAction $ InTouch $ Scroll move unit
77+
78+doubleTap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
79+doubleTap = liftAction $ InTouch $ DoubleTap unit
src/Lunapark/Affjax.pursdeleted−378
@@ -1,378 +0,0 @@
1−module Lunapark.Affjax where
2−
3−import Prelude
4−
5−import Control.Monad.Aff (Aff)
6−import Data.Argonaut (Json)
7−import Data.Argonaut as J
8−import Data.Bifunctor (lmap)
9−import Data.Either (Either(..))
10−import Data.Maybe (Maybe(..))
11−import Network.HTTP.Affjax (AJAX)
12−import Network.HTTP.Affjax as N
13−import Network.HTTP.StatusCode (StatusCode(..))
14−import Lunapark.Error as LE
15−
16−-- | This two type synonims are used only here
17−-- | this is the lowest level of bindings this lib provides
18−type URI = String
19−type SessionId = String
20−type ElementId = String
21−type WindowHandle = String
22−
23−handleAPIError ∷ N.AffjaxResponse Json → Either LE.Error Json
24−handleAPIError r = case r.status of
25− StatusCode 200 → lmap LE.unknownError do
26− obj ← J.decodeJson r.response
27− obj J..? "value"
28− code → Left $ LE.fromJson r.response
29−
30−init ∷ ∀ e. URI → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
31−init uri obj =
32− map handleAPIError $ N.post (uri <> "/session") obj
33−
34−quit ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
35−quit uri sessId =
36− map handleAPIError $ N.delete (uri <> "/session/" <> sessId)
37−
38−status ∷ ∀ e. URI → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
39−status uri =
40− map handleAPIError $ N.get (uri <> "/status")
41−
42−getTimeouts ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
43−getTimeouts uri sessId =
44− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/timeouts")
45−
46−setTimeouts ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
47−setTimeouts uri sessId timeouts =
48− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/timeouts") timeouts
49−
50−go ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
51−go uri sessId obj =
52− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/url") obj
53−
54−getCurrentUrl ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
55−getCurrentUrl uri sessId =
56− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/url")
57−
58−back ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
59−back uri sessId =
60− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/back") (Nothing ∷ Maybe Unit)
61−
62−forward ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
63−forward uri sessId =
64− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/forward") (Nothing ∷ Maybe Unit)
65−
66−refresh ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
67−refresh uri sessId =
68− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/refresh") (Nothing ∷ Maybe Unit)
69−
70−getTitle ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
71−getTitle uri sessId =
72− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/title")
73−
74−getWindow ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
75−getWindow uri sessId =
76− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/window")
77−
78−closeWindow ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
79−closeWindow uri sessId =
80− map handleAPIError $ N.delete (uri <> "/session/" <> sessId)
81−
82−switchToWindow ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
83−switchToWindow uri sessId obj =
84− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/window") obj
85−
86−getWindowHandles ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
87−getWindowHandles uri sessId =
88− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/window/handles")
89−
90−switchToFrame ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
91−switchToFrame uri sessId obj =
92− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/frame") obj
93−
94−switchToParentFrame ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
95−switchToParentFrame uri sessId =
96− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/frame/parent") (Nothing ∷ Maybe Unit)
97−
98−getWindowRect ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
99−getWindowRect uri sessId =
100− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/window/rect")
101−
102−setWindowRect ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
103−setWindowRect uri sessId obj =
104− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/window/rect") obj
105−
106−maximizeWindow ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
107−maximizeWindow uri sessId =
108− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/window/maximize") (Nothing ∷ Maybe Unit)
109−
110−minimizeWindow ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
111−minimizeWindow uri sessId =
112− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/window/minimize") (Nothing ∷ Maybe Unit)
113−
114−fullscreenWindow ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
115−fullscreenWindow uri sessId =
116− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/window/fullscreen") (Nothing ∷ Maybe Unit)
117−
118−findElement ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
119−findElement uri sessId obj =
120− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/element") obj
121−
122−findElements ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
123−findElements uri sessId obj =
124− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/elements") obj
125−
126−findElementFromElement ∷ ∀ e. URI → SessionId → ElementId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
127−findElementFromElement uri sessId elId obj =
128− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/element") obj
129−
130−findElementsFromElement ∷ ∀ e. URI → SessionId → ElementId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
131−findElementsFromElement uri sessId elId obj =
132− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/elements") obj
133−
134−getActiveElement ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
135−getActiveElement uri sessId = map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/active")
136−
137−isElementSelected ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
138−isElementSelected uri sessId elId =
139− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/selected")
140−
141−getElementAttribute ∷ ∀ e. URI → SessionId → ElementId → String → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
142−getElementAttribute uri sessId elId attrName =
143− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/attribute/" <> attrName)
144−
145−getElementProperty ∷ ∀ e. URI → SessionId → ElementId → String → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
146−getElementProperty uri sessId elId propName =
147− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/property/" <> propName)
148−
149−getElementCSSValue ∷ ∀ e. URI → SessionId → ElementId → String → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
150−getElementCSSValue uri sessId elId cssName =
151− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/css/" <> cssName)
152−
153−getElementText ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
154−getElementText uri sessId elId =
155− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/text")
156−
157−getElementTagName ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
158−getElementTagName uri sessId elId =
159− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/name")
160−
161−getElementRect ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
162−getElementRect uri sessId elId =
163− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/rect")
164−
165−isElementEnabled ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
166−isElementEnabled uri sessId elId =
167− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/enabled")
168−
169−elementClick ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
170−elementClick uri sessId elId =
171− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/click") (Nothing ∷ Maybe Unit)
172−
173−elementClear ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
174−elementClear uri sessId elId =
175− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/clear") (Nothing ∷ Maybe Unit)
176−
177−elementSendKeys ∷ ∀ e. URI → SessionId → ElementId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
178−elementSendKeys uri sessId elId obj =
179− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/value") obj
180−
181−getPageSource ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
182−getPageSource uri sessId =
183− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/source")
184−
185−executeScript ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
186−executeScript uri sessId obj =
187− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/execute/sync") obj
188−
189−executeAsyncScript ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
190−executeAsyncScript uri sessId obj =
191− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/execute/async") obj
192−
193−getAllCookies ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
194−getAllCookies uri sessId =
195− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/cookie")
196−
197−getNamedCookie ∷ ∀ e. URI → SessionId → String → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
198−getNamedCookie uri sessId name =
199− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/cookie/" <> name)
200−
201−addCookie ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
202−addCookie uri sessId obj =
203− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/cookie") obj
204−
205−deleteCookie ∷ ∀ e. URI → SessionId → String → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
206−deleteCookie uri sessId name =
207− map handleAPIError $ N.delete (uri <> "/session/" <> sessId <> "/cookie/" <> name)
208−
209−deleteAllCookies ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
210−deleteAllCookies uri sessId =
211− map handleAPIError $ N.delete (uri <> "/session/" <> sessId <> "/cookie")
212−
213−performActions ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
214−performActions uri sessId obj =
215− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/actions") obj
216−
217−releaseActions ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
218−releaseActions uri sessId =
219− map handleAPIError $ N.delete (uri <> "/session/" <> sessId <> "/actions")
220−
221−dismissAlert ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
222−dismissAlert uri sessId =
223− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/alert/dismiss") (Nothing ∷ Maybe Unit)
224−
225−acceptAlert ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
226−acceptAlert uri sessId =
227− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/alert/accept") (Nothing ∷ Maybe Unit)
228−
229−getAlertText ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
230−getAlertText uri sessId =
231− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/alert/text")
232−
233−sendAlertText ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
234−sendAlertText uri sessId obj =
235− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/alert/text") obj
236−
237−takeScreenshot ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
238−takeScreenshot uri sessId =
239− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/screenshot")
240−
241−takeElementScreenshot ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
242−takeElementScreenshot uri sessId elId =
243− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/screenshot")
244−
245−-- Recomended by W3C
246−isDisplayed ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
247−isDisplayed uri sessId elId = do
248− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/displayed")
249−
250−-- JsonWire legacy, note this wouldn't envolve thing like local storage or geolocation
251−-- because you always could do it via async script _OR_ you couldn't do it via W3C
252−getSession ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
253−getSession uri sessId =
254− map handleAPIError $ N.get (uri <> "/session/" <> sessId)
255−
256−getSessions ∷ ∀ e. URI → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
257−getSessions uri =
258− map handleAPIError $ N.get (uri <> "/sessions")
259−
260−setAsyncScriptTimeout ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
261−setAsyncScriptTimeout uri sessId obj =
262− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/timeouts/async_script") obj
263−
264−getWindowHandle ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
265−getWindowHandle uri sessId =
266− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/window_handle")
267−
268−getWindowHandlesLegacy ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
269−getWindowHandlesLegacy uri sessId =
270− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/window_handles")
271−
272−execute ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
273−execute uri sessId obj =
274− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/execute") obj
275−
276−executeAsync ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
277−executeAsync uri sessId obj =
278− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/execute_async") obj
279−
280−setWindowSize ∷ ∀ e. URI → SessionId → WindowHandle → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
281−setWindowSize uri sessId win obj =
282− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/window/" <> win <> "/size") obj
283−
284−getWindowSize ∷ ∀ e. URI → SessionId → WindowHandle → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
285−getWindowSize uri sessId win =
286− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/window/" <> win <> "/size")
287−
288−setWindowPosition ∷ ∀ e. URI → SessionId → WindowHandle → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
289−setWindowPosition uri sessId win obj =
290− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/window/" <> win <> "/position") obj
291−
292−getWindowPosition ∷ ∀ e. URI → SessionId → WindowHandle → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
293−getWindowPosition uri sessId win =
294− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/window/" <> win <> "/position")
295−
296−elementSubmit ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
297−elementSubmit uri sessId elId =
298− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/submit") (Nothing ∷ Maybe Unit)
299−
300−sendKeys ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
301−sendKeys uri sessId obj =
302− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/keys") obj
303−
304−getElementLocation ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
305−getElementLocation uri sessId elId =
306− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/location")
307−
308−getElementSize ∷ ∀ e. URI → SessionId → ElementId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
309−getElementSize uri sessId elId =
310− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/element/" <> elId <> "/size")
311−
312−getAlertTextLegacy ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
313−getAlertTextLegacy uri sessId =
314− map handleAPIError $ N.get (uri <> "/session/" <> sessId <> "/alert_text")
315−
316−setAlertText ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
317−setAlertText uri sessId obj =
318− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/alert_text") obj
319−
320−acceptAlertLegacy ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
321−acceptAlertLegacy uri sessId =
322− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/accept_alert") (Nothing ∷ Maybe Unit)
323−
324−dismissAlertLegacy ∷ ∀ e. URI → SessionId → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
325−dismissAlertLegacy uri sessId =
326− map handleAPIError $ N.post' (uri <> "/session/" <> sessId <> "/dismiss_alert") (Nothing ∷ Maybe Unit)
327−
328−moveTo ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
329−moveTo uri sessId obj =
330− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/moveto") obj
331−
332−sendClick ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
333−sendClick uri sessId obj =
334− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/click") obj
335−
336−sendButtonDown ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
337−sendButtonDown uri sessId obj =
338− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/buttondown") obj
339−
340−sendButtonUp ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
341−sendButtonUp uri sessId obj =
342− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/buttonup") obj
343−
344−sendDoubleClick ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
345−sendDoubleClick uri sessId obj =
346− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/doubleclick") obj
347−
348−sendTouch ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
349−sendTouch uri sessId obj =
350− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/click") obj
351−
352−sendTouchDown ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
353−sendTouchDown uri sessId obj =
354− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/down") obj
355−
356−sendTouchUp ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
357−sendTouchUp uri sessId obj =
358− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/up") obj
359−
360−sendTouchMove ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
361−sendTouchMove uri sessId obj =
362− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/move") obj
363−
364−sendTouchScroll ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
365−sendTouchScroll uri sessId obj =
366− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/scroll") obj
367−
368−sendTouchDoubleClick ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
369−sendTouchDoubleClick uri sessId obj =
370− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/doubleclick") obj
371−
372−sendTouchLongClick ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
373−sendTouchLongClick uri sessId obj =
374− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/longclick") obj
375−
376−sendTouchFlick ∷ ∀ e. URI → SessionId → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
377−sendTouchFlick uri sessId obj =
378− map handleAPIError $ N.post (uri <> "/session/" <> sessId <> "/touch/flick") obj
src/Lunapark/Endpoint.purs+40−28
@@ -1,28 +1,36 @@
1−module Lunapark.Endpoint where
1+-- | Building whole endpoint leads to having tons of noizy things like `ElementFindElement` and `TouchClick`
2+-- | Making this a `Variant` is definitely overkill
3+-- | So, to have something like `/session/:sessId/element/:elId/doubleclick` we have
4+-- | `InSession sessId : InElement elId : DoubleClick : Nil`
5+-- | This is not as typesafe as it could be, but at least it saves from typos.
6+module Lunapark.Endpoint
7+ ( delete
8+ , get
9+ , post
10+ , post'
11+ , EndpointPart(..)
12+ ) where
213
314import Prelude
415
5−import Control.Monad.Aff (Aff)
6−import Data.Argonaut (Json)
7−import Data.Argonaut as J
16+import Affjax.Node as N
17+import Affjax.RequestBody as NQ
18+import Affjax.ResponseFormat as NR
19+import Affjax.StatusCode (StatusCode(..))
20+import Data.Argonaut.Core (Json)
21+import Data.Argonaut.Decode.Class (decodeJson) as J
22+import Data.Argonaut.Decode.Combinators ((.:)) as J
823import Data.Bifunctor (lmap)
9−import Data.Either (Either(..))
24+import Data.Either (Either(..), either)
1025import Data.Foldable as F
1126import Data.List as L
1227import Data.Maybe (Maybe(..))
1328import Data.Newtype (un)
29+import Effect.Aff (Aff)
1430import Lunapark.Error as LE
1531import Lunapark.Types as LT
16−import Network.HTTP.Affjax (AJAX)
17−import Network.HTTP.Affjax as N
18−import Network.HTTP.StatusCode (StatusCode(..))
19−
32+import Lunapark.WebDriverError as LWE
2033
21−-- | Building whole endpoint leads to having tons of noizy things like `ElementFindElement` and `TouchClick`
22−-- | Making this a `Variant` is definitely overkill
23−-- | So, to have something like `/session/:sessId/element/:elId/doubleclick` we have
24−-- | `InSession sessId : InElement elId : DoubleClick : Nil`
25−-- | This is not as typesafe as it could be, but at least it saves from typos.
2634data EndpointPart
2735 = Session
2836 | InSession LT.SessionId
@@ -167,21 +175,25 @@ printPart = case _ of
167175 LongClick → "longclick"
168176 Flick → "flick"
169177
170−handleAPIError ∷ N.AffjaxResponse Json → Either LE.Error Json
171−handleAPIError r = case r.status of
172− StatusCode 200 → lmap LE.unknownError do
173− obj ← J.decodeJson r.response
174− obj J..? "value"
175− code → Left $ LE.fromJson r.response
178+handleAPIError
179+ ∷ Either N.Error (N.Response Json)
180+ → Either LE.Error Json
181+handleAPIError (Left error) = Left $ LE.AffjaxError error
182+handleAPIError (Right r) = case r.status of
183+ StatusCode 200 → lmap LE.JsonDecodeError do
184+ obj ← J.decodeJson r.body
185+ obj J..: "value"
186+ _ →
187+ Left $ either LE.JsonDecodeError LE.WebDriverError $ LWE.fromJson r.body
176188
177−get ∷ ∀ e. String → Endpoint → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
178−get uri ep = map handleAPIError $ N.get (uri <> print ep)
189+get ∷ String → Endpoint → Aff (Either LE.Error Json)
190+get uri ep = map handleAPIError $ N.get NR.json (uri <> print ep)
179191
180−post ∷ ∀ e. String → Endpoint → Json → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
181−post uri ep obj = map handleAPIError $ N.post (uri <> print ep) obj
192+post ∷ String → Endpoint → Json → Aff (Either LE.Error Json)
193+post uri ep obj = map handleAPIError $ N.post NR.json (uri <> print ep) $ Just (NQ.json obj)
182194
183−post_ ∷ ∀ e. String → Endpoint → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
184−post_ uri ep = map handleAPIError $ N.post' (uri <> print ep) (Nothing ∷ Maybe Unit)
195+post' ∷ String → Endpoint → Aff (Either LE.Error Json)
196+post' uri ep = map handleAPIError $ N.post NR.json (uri <> print ep) Nothing
185197
186−delete ∷ ∀ e. String → Endpoint → Aff (ajax ∷ AJAX|e) (Either LE.Error Json)
187−delete uri ep = map handleAPIError $ N.delete (uri <> print ep)
198+delete ∷ String → Endpoint → Aff (Either LE.Error Json)
199+delete uri ep = map handleAPIError $ N.delete NR.json (uri <> print ep)
src/Lunapark/Error.purs+36−118
@@ -1,121 +1,39 @@
11module Lunapark.Error where
22
33import Prelude
4−
5−import Data.Argonaut as J
6−import Data.Either (Either(..), either)
7−
8−data ErrorType
9− = ElementClickIntercepted
10− | ElementNotSelectable
11− | ElementNotInteractable
12− | InsecureCertificate
13− | InvalidArgument
14− | InvalidCookieDomain
15− | InvalidCoordinates
16− | InvalidElementState
17− | InvalidSelector
18− | InvalidSessionId
19− | JavaScriptError
20− | MoveTargetOutOfBounds
21− | NoSuchAlert
22− | NoSuchCookie
23− | NoSuchElement
24− | NoSuchFrame
25− | NoSuchWindow
26− | ScriptTimeout
27− | SessionNotCreated
28− | StaleElementReference
29− | Timeout
30− | UnableToSetCookie
31− | UnableToCaptureScreen
32− | UnexpectedAlertOpen
33− | UnknownCommand
34− | UnknownError
35− | UnknownMethod
36− | UnsupportedOperation
37−
38−fromStringCode ∷ String → Either String ErrorType
39−fromStringCode = case _ of
40− "element click intercepted" → Right ElementClickIntercepted
41− "element not selectable" → Right ElementNotSelectable
42− "element not interactable" → Right ElementNotInteractable
43− "insecure certificate" → Right InsecureCertificate
44− "invalid argument" → Right InvalidArgument
45− "invalid cookie domain" → Right InvalidCookieDomain
46− "invalid coordinates" → Right InvalidCoordinates
47− "invalid element state" → Right InvalidElementState
48− "invalid selector" → Right InvalidSelector
49− "invalid session id" → Right InvalidSessionId
50− "javascript error" → Right JavaScriptError
51− "move target out of bounds" → Right MoveTargetOutOfBounds
52− "no such alert" → Right NoSuchAlert
53− "no such cookie" → Right NoSuchCookie
54− "no such element" → Right NoSuchElement
55− "no such frame" → Right NoSuchFrame
56− "no such window" → Right NoSuchWindow
57− "script timeout" → Right ScriptTimeout
58− "session not created" → Right SessionNotCreated
59− "stale element reference" → Right StaleElementReference
60− "timeout" → Right Timeout
61− "unable to set cookie" → Right UnableToSetCookie
62− "unable to capture screen" → Right UnableToCaptureScreen
63− "unexpected alert open" → Right UnexpectedAlertOpen
64− "unknown command" → Right UnknownCommand
65− "unknown error" → Right UnknownError
66− "unknown method" → Right UnknownMethod
67− "unsupported operation" → Right UnsupportedOperation
68− s → Left s
69−
70−toStringCode ∷ ErrorType → String
71−toStringCode = case _ of
72− ElementClickIntercepted → "element click intercepted"
73− ElementNotSelectable → "element not selectable"
74− ElementNotInteractable → "element not interactable"
75− InsecureCertificate → "insecure certificate"
76− InvalidArgument → "invalid argument"
77− InvalidCookieDomain → "invalid cookie domain"
78− InvalidCoordinates → "invalid coordinates"
79− InvalidElementState → "invalid element state"
80− InvalidSelector → "invalid selector"
81− InvalidSessionId → "invalid session id"
82− JavaScriptError → "javascript error"
83− MoveTargetOutOfBounds → "move target out of bounds"
84− NoSuchAlert → "no such alert"
85− NoSuchCookie → "no such cookie"
86− NoSuchElement → "no such element"
87− NoSuchFrame → "no such frame"
88− NoSuchWindow → "no such window"
89− ScriptTimeout → "script timeout"
90− SessionNotCreated → "session not created"
91− StaleElementReference → "stale element reference"
92− Timeout → "timeout"
93− UnableToSetCookie → "unable to set cookie"
94− UnableToCaptureScreen → "unable to capture screen"
95− UnexpectedAlertOpen → "unexpected alert open"
96− UnknownCommand → "unknown command"
97− UnknownError → "unknown error"
98− UnknownMethod → "unknown method"
99− UnsupportedOperation → "unsupported operation"
100−
101−type Error =
102− { error ∷ ErrorType
103− , message ∷ String
104− , stacktrace ∷ String
105− }
106−
107−fromJson ∷ J.Json → Error
108−fromJson js = either unknownError id do
109− obj ← J.decodeJson js
110− value ← obj J..? "value"
111− error ← fromStringCode =<< value J..? "error"
112− message ← value J..? "message"
113− stacktrace ← value J..? "stacktrace"
114− pure { error, message, stacktrace }
115−
116−unknownError ∷ String → Error
117−unknownError message =
118− { error: UnknownError
119− , message
120− , stacktrace: ""
121− }
4+import Affjax as N
5+import Lunapark.WebDriverError as LWE
6+import Data.Argonaut.Decode (JsonDecodeError, printJsonDecodeError) as J
7+
8+data CachingError
9+ = EmptyCases String
10+ | IncorrectCache String
11+
12+data Error
13+ = JsonDecodeError J.JsonDecodeError
14+ | WebDriverError LWE.WebDriverError
15+ | AffjaxError N.Error
16+ | CachingError CachingError
17+
18+printError ∷ Error → String
19+printError = case _ of
20+ JsonDecodeError jsonDecodeError →
21+ J.printJsonDecodeError jsonDecodeError
22+ WebDriverError webdriverError →
23+ "Response with error message:\n"
24+ <> " error type: "
25+ <> LWE.toStringCode webdriverError.error
26+ <> "\n"
27+ <> " message: "
28+ <> webdriverError.message
29+ <> "\n"
30+ <> " stacktrace: "
31+ <> webdriverError.stacktrace
32+ AffjaxError affjaxError →
33+ N.printError affjaxError
34+ CachingError cachingError →
35+ "Error during caching:\n " <> printCachingError cachingError
36+ where
37+ printCachingError = case _ of
38+ EmptyCases key → "There is no working implementation for " <> key <> " action."
39+ IncorrectCache key → "Trying another implementation for " <> key <> " action."
src/Lunapark/Helpers.pursdeleted−162
@@ -1,162 +0,0 @@
1−module Lunapark.Helpers where
2−{-
3−import Prelude
4−
5−import CSS as CSS
6−import Control.Monad.Aff as Aff
7−import Control.Monad.Aff.Class (liftAff)
8−import Control.Monad.Eff.Class (liftEff)
9−import Control.Monad.Eff.Ref as Ref
10−import Control.Monad.Error.Class as EC
11−import Control.Monad.State.Class as SC
12−import Data.Argonaut as J
13−import Data.FoldableWithIndex as FI
14−import Data.StrMap as SM
15−import Data.Symbol (SProxy(..))
16−import Data.Time.Duration (Milliseconds(..))
17−import Data.Variant as V
18−import Lunapark.API as LA
19−import Lunapark.Error as LE
20−import Lunapark.Types as LT
21−import Node.Buffer as B
22−import Node.FS.Aff as FS
23−import Node.Path as Path
24−
25−import Debug.Trace (traceAnyA)
26−
27−isVisible ∷ ∀ e m. LA.LunaparkConstraints e m (LT.Element → m Boolean)
28−isVisible el = EC.catchError (LA.isDisplayed el) \err → case err.error of
29− LE.UnknownCommand → stepByStep
30− e → EC.throwError err
31− where
32− script =
33− { script: """var el = arguments[0]; return el.offsetHeight > 0 && el.offsetWidth > 0"""
34− , args: [ LT.encodeElement el ]
35− }
36−
37− stepByStep = do
38− res ← LA.executeScript script
39− LA.wrapEither $ J.decodeJson res
40−
41−isStale ∷ ∀ e m. LA.LunaparkConstraints e m (LT.Element → m Boolean)
42−isStale el = EC.catchError (false <$ (LA.findElementsFromElement el $ LT.ByCss $ CSS.fromString "*")) \err →
43− case err.error of
44− LE.StaleElementReference → pure true
45− _ → EC.throwError err
46−
47−setTimeouts ∷ ∀ e m. LA.LunaparkConstraints e m (LT.Timeouts → m Unit)
48−setTimeouts ts = EC.catchError (LA.setTimeouts ts) \err →
49− case err.error of
50− LE.InvalidArgument → do
51− LA.setWireTimeouts ts
52− SC.modify _{ timeouts = ts }
53− _ → EC.throwError err
54−
55−getTimeouts ∷ ∀ e m. LA.LunaparkConstraints e m (m LT.Timeouts)
56−getTimeouts =
57− EC.catchError action \err → case err.error of
58− LE.UnknownCommand → do
59− SC.gets _.timeouts
60− _ → EC.throwError err
61− where
62− action = do
63− ts ← LA.getTimeouts
64− SC.modify _{ timeouts = ts }
65− pure ts
66−
67−-- | Might be useful for setting implicit timeout of finding element
68−localTimeouts
69− ∷ ∀ e m a
70− . LA.LunaparkConstraints e m
71− ( (LT.Timeouts → LT.Timeouts)
72− → m a
73− → m a
74− )
75−localTimeouts fn action = do
76− ts ← getTimeouts
77− setTimeouts $ fn ts
78− res ← action
79− setTimeouts ts
80− pure res
81−
82−-- | Currently used in ps-webdriver but with duration passed explicitly
83−-- | since we already have timeouts it might be good idea to use them
84−repeatedly ∷ ∀ e m a. LA.LunaparkConstraints (ref ∷ Ref.REF|e) m (m a → m a)
85−repeatedly action = do
86− ts ← getTimeouts
87− ref ← liftEff $ Ref.newRef false
88− _ ← liftAff $ Aff.forkAff do
89− Aff.delay ts.script
90− liftEff $ Ref.writeRef ref true
91− let attempt = EC.catchError action \e → do
92− shouldRethrow ← liftEff $ Ref.readRef ref
93− if shouldRethrow
94− then EC.throwError e
95− else do
96− liftAff $ Aff.delay ts.implicit
97− attempt
98− attempt
99−
100−screenshot ∷ ∀ m e. LA.LunaparkConstraints (buffer ∷ B.BUFFER, fs ∷ FS.FS|e) m (Path.FilePath → m Unit)
101−screenshot fp = do
102− res ← LA.takeScreenshot
103− buffer ← liftEff $ B.fromString res.content res.encoding
104− liftAff do
105− FS.writeFile fp buffer
106−
107−elementScreenshot
108− ∷ ∀ m e
109− . LA.LunaparkConstraints (buffer ∷ B.BUFFER, fs ∷ FS.FS|e) m
110− ( LT.Element → Path.FilePath → m Unit )
111−elementScreenshot el fp = do
112− traceAnyA "ELEMENT SCREENSHOT"
113− res ← LA.takeElementScreenshot el
114− traceAnyA res
115− buffer ← liftEff $ B.fromString res.content res.encoding
116− liftAff do
117− FS.writeFile fp buffer
118−
119−pause ∷ ∀ e a. a → V.Variant (pause ∷ a|e)
120−pause = V.inj (SProxy ∷ SProxy "pause")
121−
122−keyDown ∷ ∀ e a. a → V.Variant (keyDown ∷ a|e)
123−keyDown = V.inj (SProxy ∷ SProxy "keyDown")
124−
125−keyUp ∷ ∀ e a. a → V.Variant (keyUp ∷ a|e)
126−keyUp = V.inj (SProxy ∷ SProxy "keyUp")
127−
128−pointerUp ∷ ∀ a e. a → V.Variant (pointerUp ∷ a|e)
129−pointerUp = V.inj (SProxy ∷ SProxy "pointerUp")
130−
131−pointerDown ∷ ∀ a e. a → V.Variant (pointerDown ∷ a|e)
132−pointerDown = V.inj (SProxy ∷ SProxy "pointerDown")
133−
134−pointerMove ∷ ∀ a e. a → V.Variant (pointerMove ∷ a|e)
135−pointerMove = V.inj (SProxy ∷ SProxy "pointerMove")
136−
137−click ∷ LT.Button → _ --LT.ActionSequence
138−click btn =
139− [ pointerDown btn
140− , pointerUp btn
141− ]
142−
143−leftClick ∷ _ -- LT.ActionSequence
144−leftClick = click LT.LeftBtn
145−
146−rightClick ∷ _ --LT.ActionSequence
147−rightClick = click LT.RightBtn
148−
149−doubleClick ∷ _ -- LT.ActionSequence
150−doubleClick = LT.Pointer LT.Mouse
151− [ pointerDown LT.LeftBtn
152− , pointerUp LT.LeftBtn
153− , pointerDown LT.LeftBtn
154− , pointerUp LT.LeftBtn
155− ]
156−
157−moveToElement ∷ LT.Element → LT.PointerMove
158−moveToElement el = { duration: Milliseconds 100.0, origin: LT.FromElement el, x: 0, y: 0 }
159−
160−performActions ∷ ∀ f s e m. Show s ⇒ FI.FoldableWithIndex s f ⇒ LA.LunaparkConstraints e m (f LT.ActionSequence → m Unit)
161−performActions fs = LA.performActions $ FI.foldlWithIndex (\i acc a → SM.insert (show i) a acc) SM.empty fs
162−-}
src/Lunapark/LunaparkF.pursnew file+237
@@ -0,0 +1,237 @@
1+module Lunapark.LunaparkF where
2+
3+import Prelude
4+
5+import Data.Argonaut.Core as J
6+import Type.Proxy (Proxy(..))
7+import Lunapark.Types as LT
8+import Run (Run)
9+import Run as R
10+
11+data LunaparkF a
12+ = Quit a
13+ | Status (LT.ServerStatus → a)
14+ | GetTimeouts (LT.Timeouts → a)
15+ | SetTimeouts LT.Timeouts a
16+ | GoTo String a
17+ | GetUrl (String → a)
18+ | Forward a
19+ | Back a
20+ | Refresh a
21+ | GetTitle (String → a)
22+ | GetWindowHandle (LT.WindowHandle → a)
23+ | GetWindowHandles (Array LT.WindowHandle → a)
24+ | CloseWindow a
25+ | SwitchToWindow LT.WindowHandle a
26+ | SwitchToFrame LT.FrameId a
27+ | SwitchToParentFrame a
28+ | GetWindowRectangle (LT.Rectangle → a)
29+ | SetWindowRectangle LT.Rectangle a
30+ | MaximizeWindow a
31+ | MinimizeWindow a
32+ | FullscreenWindow a
33+ | ExecuteScript LT.Script (J.Json → a)
34+ | ExecuteScriptAsync LT.Script (J.Json → a)
35+ | GetAllCookies (Array LT.Cookie → a)
36+ | GetCookie String (LT.Cookie → a)
37+ | DeleteCookie String a
38+ | DeleteAllCookies a
39+ | AddCookie LT.Cookie a
40+ | DismissAlert a
41+ | AcceptAlert a
42+ | GetAlertText (String → a)
43+ | SendAlertText String a
44+ | Screenshot String a
45+ | GetActiveElement (LT.Element → a)
46+ | FindElement LT.Locator (LT.Element → a)
47+ | FindElements LT.Locator (Array LT.Element → a)
48+ | OnElement LT.Element (ElementF a)
49+ | PerformActions LT.ActionRequest a
50+ | ReleaseActions a
51+
52+data ElementF a
53+ = ChildElement LT.Locator (LT.Element → a)
54+ | ChildElements LT.Locator (Array LT.Element → a)
55+ | IsSelected (Boolean → a)
56+ | GetAttribute String (String → a)
57+ | GetProperty String (J.Json → a)
58+ | GetCss String (String → a)
59+ | GetText (String → a)
60+ | GetTagName (String → a)
61+ | GetRectangle (LT.Rectangle → a)
62+ | IsEnabled (Boolean → a)
63+ | ClickEl a
64+ | ClearEl a
65+ | SendKeysEl String a
66+ | ScreenshotEl String a
67+ | IsDisplayed (Boolean → a)
68+ | Submit a
69+
70+derive instance functorLunaparkF ∷ Functor LunaparkF
71+derive instance functorElementF ∷ Functor ElementF
72+
73+_lunapark = Proxy ∷ Proxy "lunapark"
74+
75+type LUNAPARK r = (lunapark ∷ LunaparkF | r)
76+
77+liftLunapark ∷ ∀ a r. LunaparkF a → Run (LUNAPARK r) a
78+liftLunapark = R.lift _lunapark
79+
80+quit ∷ ∀ r. Run (LUNAPARK r) Unit
81+quit = liftLunapark $ Quit unit
82+
83+status ∷ ∀ r. Run (LUNAPARK r) LT.ServerStatus
84+status = liftLunapark $ Status identity
85+
86+setTimeouts ∷ ∀ r. LT.Timeouts → Run (LUNAPARK r) Unit
87+setTimeouts ts = liftLunapark $ SetTimeouts ts unit
88+
89+getTimeouts ∷ ∀ r. Run (LUNAPARK r) LT.Timeouts
90+getTimeouts = liftLunapark $ GetTimeouts identity
91+
92+go ∷ ∀ r. String → Run (LUNAPARK r) Unit
93+go uri = liftLunapark $ GoTo uri unit
94+
95+getUrl ∷ ∀ r. Run (LUNAPARK r) String
96+getUrl = liftLunapark $ GetUrl identity
97+
98+forward ∷ ∀ r. Run (LUNAPARK r) Unit
99+forward = liftLunapark $ Forward unit
100+
101+back ∷ ∀ r. Run (LUNAPARK r) Unit
102+back = liftLunapark $ Back unit
103+
104+refresh ∷ ∀ r. Run (LUNAPARK r) Unit
105+refresh = liftLunapark $ Refresh unit
106+
107+getTitle ∷ ∀ r. Run (LUNAPARK r) String
108+getTitle = liftLunapark $ GetTitle identity
109+
110+getWindowHandle ∷ ∀ r. Run (LUNAPARK r) LT.WindowHandle
111+getWindowHandle = liftLunapark $ GetWindowHandle identity
112+
113+getWindowHandles ∷ ∀ r. Run (LUNAPARK r) (Array LT.WindowHandle)
114+getWindowHandles = liftLunapark $ GetWindowHandles identity
115+
116+closeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
117+closeWindow = liftLunapark $ CloseWindow unit
118+
119+switchToWindow ∷ ∀ r. LT.WindowHandle → Run (LUNAPARK r) Unit
120+switchToWindow w = liftLunapark $ SwitchToWindow w unit
121+
122+switchToFrame ∷ ∀ r. LT.FrameId → Run (LUNAPARK r) Unit
123+switchToFrame f = liftLunapark $ SwitchToFrame f unit
124+
125+switchToParentFrame ∷ ∀ r. Run (LUNAPARK r) Unit
126+switchToParentFrame = liftLunapark $ SwitchToParentFrame unit
127+
128+getWindowRectangle ∷ ∀ r. Run (LUNAPARK r) LT.Rectangle
129+getWindowRectangle = liftLunapark $ GetWindowRectangle identity
130+
131+setWindowRectangle ∷ ∀ r. LT.Rectangle → Run (LUNAPARK r) Unit
132+setWindowRectangle r = liftLunapark $ SetWindowRectangle r unit
133+
134+maximizeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
135+maximizeWindow = liftLunapark $ MaximizeWindow unit
136+
137+minimizeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
138+minimizeWindow = liftLunapark $ MinimizeWindow unit
139+
140+fullscreenWindow ∷ ∀ r. Run (LUNAPARK r) Unit
141+fullscreenWindow = liftLunapark $ FullscreenWindow unit
142+
143+executeScript ∷ ∀ r. LT.Script → Run (LUNAPARK r) J.Json
144+executeScript script = liftLunapark $ ExecuteScript script identity
145+
146+executeScriptAsync ∷ ∀ r. LT.Script → Run (LUNAPARK r) J.Json
147+executeScriptAsync script = liftLunapark $ ExecuteScriptAsync script identity
148+
149+getAllCookies ∷ ∀ r. Run (LUNAPARK r) (Array LT.Cookie)
150+getAllCookies = liftLunapark $ GetAllCookies identity
151+
152+getCookie ∷ ∀ r. String → Run (LUNAPARK r) LT.Cookie
153+getCookie name = liftLunapark $ GetCookie name identity
154+
155+addCookie ∷ ∀ r. LT.Cookie → Run (LUNAPARK r) Unit
156+addCookie cookie = liftLunapark $ AddCookie cookie unit
157+
158+deleteCookie ∷ ∀ r. String → Run (LUNAPARK r) Unit
159+deleteCookie name = liftLunapark $ DeleteCookie name unit
160+
161+deleteAllCookies ∷ ∀ r. Run (LUNAPARK r) Unit
162+deleteAllCookies = liftLunapark $ DeleteAllCookies unit
163+
164+dismissAlert ∷ ∀ r. Run (LUNAPARK r) Unit
165+dismissAlert = liftLunapark $ DismissAlert unit
166+
167+acceptAlert ∷ ∀ r. Run (LUNAPARK r) Unit
168+acceptAlert = liftLunapark $ AcceptAlert unit
169+
170+getAlertText ∷ ∀ r. Run (LUNAPARK r) String
171+getAlertText = liftLunapark $ GetAlertText identity
172+
173+sendAlertText ∷ ∀ r. String → Run (LUNAPARK r) Unit
174+sendAlertText txt = liftLunapark $ SendAlertText txt unit
175+
176+screenshot ∷ ∀ r. String → Run (LUNAPARK r) Unit
177+screenshot fp = liftLunapark $ Screenshot fp unit
178+
179+elementScreenshot ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) Unit
180+elementScreenshot el fp = liftLunapark $ OnElement el $ ScreenshotEl fp unit
181+
182+findElement ∷ ∀ r. LT.Locator → Run (LUNAPARK r) LT.Element
183+findElement l = liftLunapark $ FindElement l identity
184+
185+findElements ∷ ∀ r. LT.Locator → Run (LUNAPARK r) (Array LT.Element)
186+findElements l = liftLunapark $ FindElements l identity
187+
188+childElement ∷ ∀ r. LT.Element → LT.Locator → Run (LUNAPARK r) LT.Element
189+childElement el l = liftLunapark $ OnElement el $ ChildElement l identity
190+
191+childElements ∷ ∀ r. LT.Element → LT.Locator → Run (LUNAPARK r) (Array LT.Element)
192+childElements el l = liftLunapark $ OnElement el $ ChildElements l identity
193+
194+isSelected ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
195+isSelected el = liftLunapark $ OnElement el $ IsSelected identity
196+
197+getAttribute ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) String
198+getAttribute el name = liftLunapark $ OnElement el $ GetAttribute name identity
199+
200+getProperty ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) J.Json
201+getProperty el name = liftLunapark $ OnElement el $ GetProperty name identity
202+
203+getCss ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) String
204+getCss el name = liftLunapark $ OnElement el $ GetCss name identity
205+
206+getText ∷ ∀ r. LT.Element → Run (LUNAPARK r) String
207+getText el = liftLunapark $ OnElement el $ GetText identity
208+
209+getTagName ∷ ∀ r. LT.Element → Run (LUNAPARK r) String
210+getTagName el = liftLunapark $ OnElement el $ GetTagName identity
211+
212+getRectangle ∷ ∀ r. LT.Element → Run (LUNAPARK r) LT.Rectangle
213+getRectangle el = liftLunapark $ OnElement el $ GetRectangle identity
214+
215+isEnabled ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
216+isEnabled el = liftLunapark $ OnElement el $ IsEnabled identity
217+
218+clickElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
219+clickElement el = liftLunapark $ OnElement el $ ClickEl unit
220+
221+clearElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
222+clearElement el = liftLunapark $ OnElement el $ ClearEl unit
223+
224+sendKeysElement ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) Unit
225+sendKeysElement el txt = liftLunapark $ OnElement el $ SendKeysEl txt unit
226+
227+isDisplayed ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
228+isDisplayed el = liftLunapark $ OnElement el $ IsDisplayed identity
229+
230+submitElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
231+submitElement el = liftLunapark $ OnElement el $ Submit unit
232+
233+performActions ∷ ∀ r. LT.ActionRequest → Run (LUNAPARK r) Unit
234+performActions req = liftLunapark $ PerformActions req unit
235+
236+releaseActions ∷ ∀ r. Run (LUNAPARK r) Unit
237+releaseActions = liftLunapark $ ReleaseActions unit
src/Lunapark/Starter.pursdeleted−32
@@ -1,32 +0,0 @@
1−module Lunapark.Starter where
2−
3−import Prelude
4−
5−import Control.Monad.Aff.Class (class MonadAff, liftAff)
6−import Control.Monad.Eff.Class (liftEff)
7−import Lunapark.Types as LT
8−import Data.Traversable as T
9−import Node.Path (FilePath)
10−import Node.FS (FS)
11−import Node.FS.Aff as FS
12−import Node.ChildProcess as CP
13−import Unsafe.Coerce (unsafeCoerce)
14−
15−start
16− ∷ ∀ e m
17− . MonadAff (fs ∷ FS, cp ∷ CP.CHILD_PROCESS|e) m
18− ⇒ LT.DriverPaths
19− → FilePath
20− → Array String
21− → m Unit
22−start drivers jarPath additionalParams = do
23− preparedJar ← liftAff $ FS.realpath jarPath
24− preparedDrivers ← liftAff $ T.traverse FS.realpath drivers
25−
26− liftEff $ CP.exec
27− ("java "
28− <> T.intercalate " " (LT.renderDriverPaths preparedDrivers)
29− <> " -jar " <> preparedJar <> " "
30− <> T.intercalate " " additionalParams)
31− CP.defaultExecOptions
32− (const $ pure unit)
src/Lunapark/Types.purs+194−147
@@ -1,63 +1,81 @@
1+-- | This module contains types for requests and response.
2+-- | Most of them are records with `α → J.Json` and `J.Json → Either J.JsonDecodeError α` functions
3+-- | not newtypes with `Encode|DecodeJson` instances.
14module Lunapark.Types where
25
36import Prelude
47
5−import CSS.Render as CSSR
6−import CSS.Selector as CSS
8+import CSS as CSS
79import Control.Alt ((<|>))
8−import Data.Argonaut (Json, (.?))
9−import Data.Argonaut as J
10+import Data.Argonaut.Core (Json, jsonEmptyObject, jsonNull, fromString) as J
11+import Data.Argonaut.Decode (JsonDecodeError(..)) as J
12+import Data.Argonaut.Decode.Class (decodeJson) as J
13+import Data.Argonaut.Decode.Combinators ((.:))
14+import Data.Argonaut.Encode.Class (class EncodeJson, encodeJson) as J
15+import Data.Argonaut.Encode.Combinators (extend) as J
1016import Data.Array as A
1117import Data.Either (Either(..))
12−import Data.Traversable as F
1318import Data.Map as Map
1419import Data.Maybe (Maybe(..))
1520import Data.Newtype (class Newtype, un)
16−import Data.StrMap as SM
1721import Data.String as Str
22+import Type.Proxy (Proxy(..))
1823import Data.Time.Duration (Milliseconds(..))
24+import Data.Traversable as F
1925import Data.Tuple (Tuple(..))
2026import Data.Variant as V
21−import Data.XPath.Types as X
27+import Foreign.Object as FO
2228import Node.Encoding as NE
2329import Node.Path (FilePath)
2430
2531newtype SessionId = SessionId String
32+
2633derive instance newtypeSessionId ∷ Newtype SessionId _
34+derive newtype instance eqSessionId ∷ Eq SessionId
35+derive newtype instance ordSessionId ∷ Ord SessionId
2736
2837newtype WindowHandle = WindowHandle String
38+
2939derive instance newtypeWindowHandle ∷ Newtype WindowHandle _
40+derive newtype instance eqWindowHandle ∷ Eq WindowHandle
41+derive newtype instance ordWindowHandle ∷ Ord WindowHandle
3042
3143currentWindow ∷ WindowHandle
3244currentWindow = WindowHandle "current"
3345
3446data FrameId = ByElementId String | ByIndex Int | TopFrame
3547
48+derive instance eqFrameId ∷ Eq FrameId
49+derive instance ordFrameId ∷ Ord FrameId
50+
3651newtype Element = Element String
37−derive instance newtypeElementId ∷ Newtype Element _
3852
39−decodeElement ∷ Json → Either String Element
53+derive instance newtypeElement ∷ Newtype Element _
54+derive newtype instance eqElement ∷ Eq Element
55+derive newtype instance ordElement ∷ Ord Element
56+
57+decodeElement ∷ J.Json → Either J.JsonDecodeError Element
4058decodeElement = J.decodeJson >=> \obj →
41− map Element $ obj .? "element-6066-11e4-a52e-4f735466cecf" <|> obj .? "ELEMENT"
59+ map Element $ obj .: "element-6066-11e4-a52e-4f735466cecf" <|> obj .: "ELEMENT"
4260
43−encodeElement ∷ Element → Json
44−encodeElement (Element eid) = J.encodeJson $ SM.fromFoldable
61+encodeElement ∷ Element → J.Json
62+encodeElement (Element eid) = J.encodeJson $ FO.fromFoldable
4563 [ Tuple "element-6066-11e4-a52e-4f735466cecf" eid
4664 , Tuple "ELEMENT" eid
4765 ]
4866
49−decodeSessionId ∷ Json → Either String SessionId
67+decodeSessionId ∷ J.Json → Either J.JsonDecodeError SessionId
5068decodeSessionId = map SessionId <<< J.decodeJson
5169
5270type CreateSessionResponse =
53− { session ∷ SessionId
54− , capabilities ∷ Array Capability
55− }
71+ { session ∷ SessionId
72+ , capabilities ∷ Array Capability
73+ }
5674
57−decodeCreateSessionResponse ∷ Json → Either String CreateSessionResponse
75+decodeCreateSessionResponse ∷ J.Json → Either J.JsonDecodeError CreateSessionResponse
5876decodeCreateSessionResponse = J.decodeJson >=> \obj → do
59− session ← decodeSessionId =<< obj .? "sessionId"
60− capabilities ← decodeCapabilities =<< obj .? "capabilities"
77+ session ← decodeSessionId =<< obj .: "sessionId"
78+ capabilities ← decodeCapabilities =<< obj .: "capabilities"
6179 pure { session, capabilities }
6280
6381type ServerStatus =
@@ -65,8 +83,8 @@ type ServerStatus =
6583 , message ∷ String
6684 }
6785
68−decodeServerStatus ∷ Json → Either String ServerStatus
69−decodeServerStatus = J.decodeJson >=> \obj → { ready: _, message: _ } <$> obj .? "ready" <*> obj .? "message"
86+decodeServerStatus ∷ J.Json → Either J.JsonDecodeError ServerStatus
87+decodeServerStatus = J.decodeJson >=> \obj → { ready: _, message: _ } <$> obj .: "ready" <*> obj .: "message"
7088
7189type Timeouts =
7290 { script ∷ Milliseconds
@@ -74,38 +92,38 @@ type Timeouts =
7492 , implicit ∷ Milliseconds
7593 }
7694
77−decodeTimeouts ∷ Json → Either String Timeouts
95+decodeTimeouts ∷ J.Json → Either J.JsonDecodeError Timeouts
7896decodeTimeouts = J.decodeJson >=> \obj → do
79− script ← map Milliseconds $ obj .? "script"
80− pageLoad ← map Milliseconds $ obj .? "pageLoad"
81− implicit ← map Milliseconds $ obj .? "implicit"
97+ script ← map Milliseconds $ obj .: "script"
98+ pageLoad ← map Milliseconds $ obj .: "pageLoad"
99+ implicit ← map Milliseconds $ obj .: "implicit"
82100 pure { script, pageLoad, implicit }
83101
84−encodeTimeouts ∷ Timeouts → Json
85−encodeTimeouts r = J.encodeJson $ SM.fromFoldable
102+encodeTimeouts ∷ Timeouts → J.Json
103+encodeTimeouts r = J.encodeJson $ FO.fromFoldable
86104 [ Tuple "script" (un Milliseconds r.script)
87105 , Tuple "pageLoad" (un Milliseconds r.pageLoad)
88106 , Tuple "implicit" (un Milliseconds r.implicit)
89107 ]
90108
91−encodeLegacyTimeouts ∷ Timeouts → Array Json
109+encodeLegacyTimeouts ∷ Timeouts → Array J.Json
92110encodeLegacyTimeouts r =
93− [ J.encodeJson $ SM.singleton "script" $ un Milliseconds r.script
94− , J.encodeJson $ SM.singleton "implicit" $ un Milliseconds r.implicit
95− , J.encodeJson $ SM.singleton "page load" $ un Milliseconds r.pageLoad
111+ [ J.encodeJson $ FO.singleton "script" $ un Milliseconds r.script
112+ , J.encodeJson $ FO.singleton "implicit" $ un Milliseconds r.implicit
113+ , J.encodeJson $ FO.singleton "page load" $ un Milliseconds r.pageLoad
96114 ]
97115
98−encodeGoRequest ∷ String → Json
99−encodeGoRequest url = J.encodeJson $ SM.fromFoldable [ Tuple "url" url ]
116+encodeGoRequest ∷ String → J.Json
117+encodeGoRequest url = J.encodeJson $ FO.fromFoldable [ Tuple "url" url ]
100118
101−decodeWindowHandle ∷ Json → Either String WindowHandle
119+decodeWindowHandle ∷ J.Json → Either J.JsonDecodeError WindowHandle
102120decodeWindowHandle = map WindowHandle <<< J.decodeJson
103121
104−encodeSwitchToWindowRequest ∷ WindowHandle → Json
105−encodeSwitchToWindowRequest w = J.encodeJson $ SM.fromFoldable [ Tuple "handle" $ un WindowHandle w ]
122+encodeSwitchToWindowRequest ∷ WindowHandle → J.Json
123+encodeSwitchToWindowRequest w = J.encodeJson $ FO.fromFoldable [ Tuple "handle" $ un WindowHandle w ]
106124
107−encodeFrameId ∷ FrameId → Json
108−encodeFrameId fid = J.encodeJson $ SM.fromFoldable [ Tuple "id" encoded ]
125+encodeFrameId ∷ FrameId → J.Json
126+encodeFrameId fid = J.encodeJson $ FO.fromFoldable [ Tuple "id" encoded ]
109127 where
110128 encoded = case fid of
111129 TopFrame → J.jsonNull
@@ -119,32 +137,32 @@ type Rectangle =
119137 , y ∷ Int
120138 }
121139
122−decodeRectangle ∷ Json → Either String Rectangle
140+decodeRectangle ∷ J.Json → Either J.JsonDecodeError Rectangle
123141decodeRectangle = J.decodeJson >=> \obj → do
124− width ← obj .? "width"
125− height ← obj .? "height"
126− x ← obj .? "x"
127− y ← obj .? "y"
142+ width ← obj .: "width"
143+ height ← obj .: "height"
144+ x ← obj .: "x"
145+ y ← obj .: "y"
128146 pure { width, height, x, y }
129147
130−decodeRectangleLegacy ∷ { size ∷ Json, position ∷ Json } → Either String Rectangle
148+decodeRectangleLegacy ∷ { size ∷ J.Json, position ∷ J.Json } → Either J.JsonDecodeError Rectangle
131149decodeRectangleLegacy { size, position } = do
132150 sobj ← J.decodeJson size
133151 pobj ← J.decodeJson position
134− x ← pobj .? "x"
135− y ← pobj .? "y"
136− width ← sobj .? "width"
137− height ← sobj .? "height"
152+ x ← pobj .: "x"
153+ y ← pobj .: "y"
154+ width ← sobj .: "width"
155+ height ← sobj .: "height"
138156 pure { width, height, x, y }
139157
140−encodeRectangleLegacy ∷ Rectangle → { size ∷ Json, position ∷ Json }
158+encodeRectangleLegacy ∷ Rectangle → { size ∷ J.Json, position ∷ J.Json }
141159encodeRectangleLegacy r =
142− { size: J.encodeJson $ SM.fromFoldable [ Tuple "width" r.width, Tuple "height" r.height ]
143− , position: J.encodeJson $ SM.fromFoldable [ Tuple "x" r.x, Tuple "y" r.y ]
160+ { size: J.encodeJson $ FO.fromFoldable [ Tuple "width" r.width, Tuple "height" r.height ]
161+ , position: J.encodeJson $ FO.fromFoldable [ Tuple "x" r.x, Tuple "y" r.y ]
144162 }
145163
146−encodeRectangle ∷ Rectangle → Json
147−encodeRectangle r = J.encodeJson $ SM.fromFoldable
164+encodeRectangle ∷ Rectangle → J.Json
165+encodeRectangle r = J.encodeJson $ FO.fromFoldable
148166 [ Tuple "width" r.width
149167 , Tuple "height" r.height
150168 , Tuple "x" r.x
@@ -153,7 +171,7 @@ encodeRectangle r = J.encodeJson $ SM.fromFoldable
153171
154172data Locator
155173 = ByCss CSS.Selector
156− | ByXPath X.XPath
174+ | ByXPath String
157175 | ByTagName String
158176 | ByLinkText String
159177 | ByPartialLinkText String
@@ -164,15 +182,15 @@ type RawLocator =
164182 , value ∷ String
165183 }
166184
167−encodeLocator ∷ Locator → Json
168−encodeLocator l = J.encodeJson $ SM.fromFoldable case l of
185+encodeLocator ∷ Locator → J.Json
186+encodeLocator l = J.encodeJson $ FO.fromFoldable case l of
169187 ByCss sel →
170188 [ Tuple "using" "css selector"
171− , Tuple "value" $ CSSR.selector sel
189+ , Tuple "value" $ CSS.selector sel
172190 ]
173− ByXPath sel →
191+ ByXPath expr →
174192 [ Tuple "using" "xpath"
175− , Tuple "value" $ X.printXPath sel
193+ , Tuple "value" expr
176194 ]
177195 ByLinkText sel →
178196 [ Tuple "using" "link text"
@@ -191,16 +209,16 @@ encodeLocator l = J.encodeJson $ SM.fromFoldable case l of
191209 , Tuple "value" r.value
192210 ]
193211
194−encodeSendKeysRequest ∷ String → Json
195−encodeSendKeysRequest txt = J.encodeJson $ SM.fromFoldable [ Tuple "text" txt ]
212+encodeSendKeysRequest ∷ String → J.Json
213+encodeSendKeysRequest txt = J.encodeJson $ FO.fromFoldable [ Tuple "text" txt ]
196214
197215type Script =
198216 { script ∷ String
199− , args ∷ Array Json
217+ , args ∷ Array J.Json
200218 }
201219
202−encodeScript ∷ Script → Json
203−encodeScript r = J.encodeJson $ SM.fromFoldable
220+encodeScript ∷ Script → J.Json
221+encodeScript r = J.encodeJson $ FO.fromFoldable
204222 [ Tuple "script" $ J.encodeJson r.script
205223 , Tuple "args" $ J.encodeJson r.args
206224 ]
@@ -215,31 +233,32 @@ type Cookie =
215233 , expiry ∷ Maybe Int
216234 }
217235
218−encodeCookie ∷ Cookie → Json
219−encodeCookie r = J.encodeJson $ SM.fromFoldable
220− [ Tuple "cookie" $ SM.fromFoldable
221− $ [ Tuple "name" $ J.encodeJson r.name
222− , Tuple "value" $ J.encodeJson r.value
223− ]
224− <> maybeToAOfPair "path" r.path
225− <> maybeToAOfPair "domain" r.domain
226− <> maybeToAOfPair "secure" r.secure
227− <> maybeToAOfPair "httpOnly" r.httpOnly
228− <> maybeToAOfPair "expiry" r.expiry
236+encodeCookie ∷ Cookie → J.Json
237+encodeCookie r = J.encodeJson $ FO.fromFoldable
238+ [ Tuple "cookie" $ FO.fromFoldable
239+ $
240+ [ Tuple "name" $ J.encodeJson r.name
241+ , Tuple "value" $ J.encodeJson r.value
242+ ]
243+ <> maybeToAOfPair "path" r.path
244+ <> maybeToAOfPair "domain" r.domain
245+ <> maybeToAOfPair "secure" r.secure
246+ <> maybeToAOfPair "httpOnly" r.httpOnly
247+ <> maybeToAOfPair "expiry" r.expiry
229248 ]
230249 where
231250 maybeToAOfPair ∷ ∀ a. J.EncodeJson a ⇒ String → Maybe a → Array (Tuple String J.Json)
232251 maybeToAOfPair key mb = F.foldMap (A.singleton <<< Tuple key <<< J.encodeJson) mb
233252
234−decodeCookie ∷ Json → Either String Cookie
253+decodeCookie ∷ J.Json → Either J.JsonDecodeError Cookie
235254decodeCookie = J.decodeJson >=> \obj → do
236− name ← obj .? "name"
237− value ← obj .? "value"
238− path ← maybify $ obj .? "path"
239− domain ← maybify $ obj .? "domain"
240− secure ← maybify $ obj .? "secure"
241− httpOnly ← maybify $ obj .? "httpOnly"
242− expiry ← maybify $ obj .? "expiry"
255+ name ← obj .: "name"
256+ value ← obj .: "value"
257+ path ← maybify $ obj .: "path"
258+ domain ← maybify $ obj .: "domain"
259+ secure ← maybify $ obj .: "secure"
260+ httpOnly ← maybify $ obj .: "httpOnly"
261+ expiry ← maybify $ obj .: "expiry"
243262 pure
244263 { name
245264 , value
@@ -253,19 +272,18 @@ decodeCookie = J.decodeJson >=> \obj → do
253272 maybify ∷ ∀ a b. Either a b → Either a (Maybe b)
254273 maybify e = map Just e <|> Right Nothing
255274
256−
257275type Screenshot =
258276 { content ∷ String
259277 , encoding ∷ NE.Encoding
260278 }
261279
262−decodeScreenshot ∷ Json → Either String Screenshot
280+decodeScreenshot ∷ J.Json → Either J.JsonDecodeError Screenshot
263281decodeScreenshot j =
264282 { content: _, encoding: NE.Base64 } <$> J.decodeJson j
265283
266284data Button = LeftBtn | MiddleBtn | RightBtn
267285
268−encodeButton ∷ Button → Json
286+encodeButton ∷ Button → J.Json
269287encodeButton = J.encodeJson <<< case _ of
270288 LeftBtn → 0
271289 MiddleBtn → 1
@@ -276,7 +294,7 @@ data PointerMoveOrigin
276294 | FromPointer
277295 | FromElement Element
278296
279−encodeOrigin ∷ PointerMoveOrigin → Json
297+encodeOrigin ∷ PointerMoveOrigin → J.Json
280298encodeOrigin = case _ of
281299 FromViewport → J.encodeJson "viewport"
282300 FromPointer → J.encodeJson "pointer"
@@ -289,15 +307,14 @@ type PointerMove =
289307 , y ∷ Int
290308 }
291309
292−encodePointerMove ∷ PointerMove → SM.StrMap Json
293−encodePointerMove r = SM.fromFoldable
310+encodePointerMove ∷ PointerMove → FO.Object J.Json
311+encodePointerMove r = FO.fromFoldable
294312 [ Tuple "x" $ J.encodeJson r.x
295313 , Tuple "y" $ J.encodeJson r.y
296314 , Tuple "duration" $ J.encodeJson $ un Milliseconds r.duration
297315 , Tuple "origin" $ encodeOrigin r.origin
298316 ]
299317
300−
301318type Action = V.Variant
302319 ( pause ∷ Milliseconds
303320 , keyDown ∷ Char
@@ -307,38 +324,55 @@ type Action = V.Variant
307324 , pointerMove ∷ PointerMove
308325 )
309326
310−encodeAction ∷ Action → Json
327+pause ∷ ∀ r a. a → V.Variant (pause ∷ a | r)
328+pause = V.inj (Proxy ∷ Proxy "pause")
329+
330+keyDown ∷ ∀ r a. a → V.Variant (keyDown ∷ a | r)
331+keyDown = V.inj (Proxy ∷ Proxy "keyDown")
332+
333+keyUp ∷ ∀ r a. a → V.Variant (keyUp ∷ a | r)
334+keyUp = V.inj (Proxy ∷ Proxy "keyUp")
335+
336+pointerUp ∷ ∀ r a. a → V.Variant (pointerUp ∷ a | r)
337+pointerUp = V.inj (Proxy ∷ Proxy "pointerUp")
338+
339+pointerDown ∷ ∀ r a. a → V.Variant (pointerDown ∷ a | r)
340+pointerDown = V.inj (Proxy ∷ Proxy "pointerDown")
341+
342+pointerMove ∷ ∀ r a. a → V.Variant (pointerMove ∷ a | r)
343+pointerMove = V.inj (Proxy ∷ Proxy "pointerMove")
344+
345+encodeAction ∷ Action → J.Json
311346encodeAction = V.match
312347 { pause: \ms →
313− J.encodeJson $ SM.fromFoldable
314− [ Tuple "duration" $ J.encodeJson $ un Milliseconds ms
315− , Tuple "type" $ J.encodeJson "pause"
316− ]
348+ J.encodeJson $ FO.fromFoldable
349+ [ Tuple "duration" $ J.encodeJson $ un Milliseconds ms
350+ , Tuple "type" $ J.encodeJson "pause"
351+ ]
317352 , keyDown: \ch →
318− J.encodeJson $ SM.fromFoldable
319− [ Tuple "value" $ J.encodeJson ch
320− , Tuple "type" $ J.encodeJson "keyDown"
321− ]
353+ J.encodeJson $ FO.fromFoldable
354+ [ Tuple "value" $ J.encodeJson ch
355+ , Tuple "type" $ J.encodeJson "keyDown"
356+ ]
322357 , keyUp: \ch →
323− J.encodeJson $ SM.fromFoldable
324− [ Tuple "value" $ J.encodeJson ch
325− , Tuple "type" $ J.encodeJson "keyUp"
326− ]
358+ J.encodeJson $ FO.fromFoldable
359+ [ Tuple "value" $ J.encodeJson ch
360+ , Tuple "type" $ J.encodeJson "keyUp"
361+ ]
327362 , pointerUp: \btn →
328− J.encodeJson $ SM.fromFoldable
329− [ Tuple "button" $ encodeButton btn
330− , Tuple "type" $ J.encodeJson "pointerUp"
331− ]
363+ J.encodeJson $ FO.fromFoldable
364+ [ Tuple "button" $ encodeButton btn
365+ , Tuple "type" $ J.encodeJson "pointerUp"
366+ ]
332367 , pointerDown: \btn →
333− J.encodeJson $ SM.fromFoldable
334− [ Tuple "button" $ encodeButton btn
335− , Tuple "type" $ J.encodeJson "pointerDown"
336− ]
368+ J.encodeJson $ FO.fromFoldable
369+ [ Tuple "button" $ encodeButton btn
370+ , Tuple "type" $ J.encodeJson "pointerDown"
371+ ]
337372 , pointerMove: \pm →
338− J.encodeJson $ SM.insert "type" (J.encodeJson "pointerMove") $ encodePointerMove pm
373+ J.encodeJson $ FO.insert "type" (J.encodeJson "pointerMove") $ encodePointerMove pm
339374 }
340375
341−
342376data PointerType = Mouse | Pen | Touch
343377
344378printPointerType ∷ PointerType → String
@@ -356,31 +390,31 @@ data ActionSequence
356390 (Array (V.Variant (pause ∷ Milliseconds, pointerUp ∷ Button, pointerDown ∷ Button, pointerMove ∷ PointerMove)))
357391
358392-- Right, this is not an `Array` but `StrMap` because all `ActionSequence`s are tagged with unique id's
359−type ActionRequest = SM.StrMap ActionSequence
393+type ActionRequest = FO.Object ActionSequence
360394
361−encodeActionRequest ∷ ActionRequest → Json
362−encodeActionRequest sm = J.encodeJson $ SM.singleton "actions" $ map encodePair arrayOfPairs
395+encodeActionRequest ∷ ActionRequest → J.Json
396+encodeActionRequest sm = J.encodeJson $ FO.singleton "actions" $ map encodePair arrayOfPairs
363397 where
364398 arrayOfPairs ∷ Array (Tuple String ActionSequence)
365− arrayOfPairs = SM.toUnfoldable sm
399+ arrayOfPairs = FO.toUnfoldable sm
366400
367− encodePair ∷ Tuple String ActionSequence → Json
401+ encodePair ∷ Tuple String ActionSequence → J.Json
368402 encodePair (Tuple identifier sequence) =
369− J.encodeJson $ SM.insert "id" (J.encodeJson identifier) $ encodeSequence sequence
403+ J.encodeJson $ FO.insert "id" (J.encodeJson identifier) $ encodeSequence sequence
370404
371− encodeSequence ∷ ActionSequence → J.JObject
405+ encodeSequence ∷ ActionSequence → FO.Object J.Json
372406 encodeSequence = case _ of
373− NoSource as → SM.fromFoldable
407+ NoSource as → FO.fromFoldable
374408 [ Tuple "type" $ J.encodeJson "none"
375409 , Tuple "actions" $ J.encodeJson $ map (encodeAction <<< V.expand) as
376410 ]
377− Key as → SM.fromFoldable
411+ Key as → FO.fromFoldable
378412 [ Tuple "type" $ J.encodeJson "key"
379413 , Tuple "actions" $ J.encodeJson $ map (encodeAction <<< V.expand) as
380414 ]
381− Pointer ptype as → SM.fromFoldable
415+ Pointer ptype as → FO.fromFoldable
382416 [ Tuple "type" $ J.encodeJson "pointer"
383− , Tuple "parameters" $ J.encodeJson $ SM.singleton "pointerType" $ printPointerType ptype
417+ , Tuple "parameters" $ J.encodeJson $ FO.singleton "pointerType" $ printPointerType ptype
384418 , Tuple "actions" $ J.encodeJson $ map (encodeAction <<< V.expand) as
385419 ]
386420
@@ -409,7 +443,6 @@ renderDriverPaths ps = map renderDriverPath pairs
409443 Chrome → "-Dwebdriver.chrome.driver"
410444 Firefox → "-DWebdriver.gecko.driver"
411445
412−
413446data PageLoad
414447 = Normal
415448 | Eager
@@ -427,10 +460,9 @@ data Capability
427460 | PageLoadStrategy PageLoad
428461 | DesiredTimeouts Timeouts
429462 | UnhandledPromptBehavior UnhandledPrompt
430− | CustomCapability String Json
463+ | CustomCapability String J.Json
431464
432−
433−encodeCapability ∷ Capability → Tuple String Json
465+encodeCapability ∷ Capability → Tuple String J.Json
434466encodeCapability = case _ of
435467 BrowserName bn → Tuple "browserName" $ J.encodeJson case bn of
436468 MSEdge → "MicrosoftEdge"
@@ -453,51 +485,66 @@ encodeCapability = case _ of
453485 Dismiss → "dismiss"
454486 CustomCapability k v → Tuple k v
455487
456−encodeCapabilities ∷ ∀ f. F.Foldable f ⇒ f Capability → Json
488+encodeCapabilities ∷ ∀ f. F.Foldable f ⇒ f Capability → J.Json
457489encodeCapabilities = F.foldl (\b a → J.extend (encodeCapability a) b) J.jsonEmptyObject
458490
459−decodeCapabilities ∷ Json → Either String (Array Capability)
491+decodeCapabilities ∷ J.Json → Either J.JsonDecodeError (Array Capability)
460492decodeCapabilities = J.decodeJson >=> \obj →
461− F.for (SM.toUnfoldable obj) \l@(Tuple key val) →
493+ F.for (FO.toUnfoldable obj) \l@(Tuple key val) →
462494 decodeCapability l <|> Right (CustomCapability key val)
463495 where
464− decodeCapability ∷ Tuple String Json → Either String Capability
496+ decodeCapability ∷ Tuple String J.Json → Either J.JsonDecodeError Capability
465497 decodeCapability (Tuple key val) = case key of
466− "browserName" → BrowserName <$> decodeBrowserName val
498+ "browserName" → BrowserName <$> decodeBrowserType val
467499 "browserVersion" → BrowserVersion <$> J.decodeJson val
468500 "acceptInsecureCerts" → AcceptInsecureCerts <$> J.decodeJson val
469− "pageLoadStrategy" → PageLoadStrategy <$> decodePageLoadStrategy val
501+ "pageLoadStrategy" → PageLoadStrategy <$> decodePageLoad val
470502 "timeouts" → DesiredTimeouts <$> decodeTimeouts val
471− "unhandledPromptBehaviour" → UnhandledPromptBehavior <$> decodePrompt val
472− _ → Left "unhandled"
503+ "unhandledPromptBehaviour" → UnhandledPromptBehavior <$> decodeUnhandledPrompt val
504+ other → Left $ J.Named "Capability" $ J.UnexpectedValue (J.fromString other)
473505
474− decodeBrowserName ∷ Json → Either String BrowserType
475− decodeBrowserName = J.decodeJson >=> \str → case Str.toLower str of
506+ decodeBrowserType ∷ J.Json → Either J.JsonDecodeError BrowserType
507+ decodeBrowserType = J.decodeJson >=> \str → case Str.toLower str of
476508 "microsoftedge" → Right MSEdge
477509 "chrome" → Right Chrome
478510 "firefox" → Right Firefox
479− _ → Left "unhandled"
511+ other → Left $ J.Named "BrowserType" $ J.UnexpectedValue (J.fromString other)
480512
481− decodePageLoadStrategy ∷ Json → Either String PageLoad
482− decodePageLoadStrategy = J.decodeJson >=> \str → case Str.toLower str of
513+ decodePageLoad ∷ J.Json → Either J.JsonDecodeError PageLoad
514+ decodePageLoad = J.decodeJson >=> \str → case Str.toLower str of
483515 "none" → Right Immediate
484516 "normal" → Right Normal
485517 "eager" → Right Eager
486− _ → Left "unhandled"
518+ other → Left $ J.Named "PageLoad" $ J.UnexpectedValue (J.fromString other)
487519
488− decodePrompt ∷ Json → Either String UnhandledPrompt
489− decodePrompt = J.decodeJson >=> \str → case Str.toLower str of
520+ decodeUnhandledPrompt ∷ J.Json → Either J.JsonDecodeError UnhandledPrompt
521+ decodeUnhandledPrompt = J.decodeJson >=> \str → case Str.toLower str of
490522 "accept" → Right Accept
491523 "dismiss" → Right Dismiss
492− _ → Left "unhandled"
524+ other → Left $ J.Named "UnhandledPrompt" $ J.UnexpectedValue (J.fromString other)
493525
494526type CapabilitiesRequest =
495527 { alwaysMatch ∷ Array Capability
496528 , firstMatch ∷ Array (Array Capability)
497529 }
498530
499−encodeCapabilitiesRequest ∷ CapabilitiesRequest → Json
500−encodeCapabilitiesRequest r = J.encodeJson $ SM.singleton "capabilities" $ SM.fromFoldable
531+encodeCapabilitiesRequest ∷ CapabilitiesRequest → J.Json
532+encodeCapabilitiesRequest r = J.encodeJson $ FO.singleton "capabilities" $ FO.fromFoldable
501533 [ Tuple "alwaysMatch" $ encodeCapabilities r.alwaysMatch
502534 , Tuple "firstMatch" $ J.encodeJson $ map encodeCapabilities r.firstMatch
503535 ]
536+
537+type MoveToRequest =
538+ { element ∷ Maybe Element
539+ , xoffset ∷ Int
540+ , yoffset ∷ Int
541+ }
542+
543+encodeMoveToRequest ∷ MoveToRequest → J.Json
544+encodeMoveToRequest r = J.encodeJson $ FO.fromFoldable
545+ [ Tuple "element" $ case r.element of
546+ Nothing → J.jsonNull
547+ Just el → J.encodeJson $ un Element el
548+ , Tuple "xoffset" $ J.encodeJson r.xoffset
549+ , Tuple "yoffset" $ J.encodeJson r.yoffset
550+ ]
src/Lunapark/UnicodeCharacters.pursnew file+177
@@ -0,0 +1,177 @@
1+module Lunapark.UnicodeCharacters where
2+
3+-- copied from https://github.com/webdriverio/webdriverio/blob/13d3a3419b951803c5e7a5db53e48764ca58f371/packages/webdriverio/src/constants.js#L315
4+
5+unidentified ∷ Char
6+unidentified = '\xE000'
7+
8+cancel ∷ Char
9+cancel = '\xE001'
10+
11+help ∷ Char
12+help = '\xE002'
13+
14+backspace ∷ Char
15+backspace = '\xE003'
16+
17+tab ∷ Char
18+tab = '\xE004'
19+
20+clear ∷ Char
21+clear = '\xE005'
22+
23+return ∷ Char
24+return = '\xE006'
25+
26+enter ∷ Char
27+enter = '\xE007'
28+
29+shift ∷ Char
30+shift = '\xE008'
31+
32+controlLeft ∷ Char
33+controlLeft = '\xE009'
34+
35+controlRight ∷ Char
36+controlRight = '\xE051'
37+
38+alt ∷ Char
39+alt = '\xE00A'
40+
41+pause ∷ Char
42+pause = '\xE00B'
43+
44+escape ∷ Char
45+escape = '\xE00C'
46+
47+space ∷ Char
48+space = '\xE00D'
49+
50+pageUp ∷ Char
51+pageUp = '\xE00E'
52+
53+pageDown ∷ Char
54+pageDown = '\xE00F'
55+
56+end ∷ Char
57+end = '\xE010'
58+
59+home ∷ Char
60+home = '\xE011'
61+
62+arrowLeft ∷ Char
63+arrowLeft = '\xE012'
64+
65+arrowUp ∷ Char
66+arrowUp = '\xE013'
67+
68+arrowRight ∷ Char
69+arrowRight = '\xE014'
70+
71+arrowDown ∷ Char
72+arrowDown = '\xE015'
73+
74+insert ∷ Char
75+insert = '\xE016'
76+
77+delete ∷ Char
78+delete = '\xE017'
79+
80+semicolon ∷ Char
81+semicolon = '\xE018'
82+
83+equals ∷ Char
84+equals = '\xE019'
85+
86+numpad0 ∷ Char
87+numpad0 = '\xE01A'
88+
89+numpad1 ∷ Char
90+numpad1 = '\xE01B'
91+
92+numpad2 ∷ Char
93+numpad2 = '\xE01C'
94+
95+numpad3 ∷ Char
96+numpad3 = '\xE01D'
97+
98+numpad4 ∷ Char
99+numpad4 = '\xE01E'
100+
101+numpad5 ∷ Char
102+numpad5 = '\xE01F'
103+
104+numpad6 ∷ Char
105+numpad6 = '\xE020'
106+
107+numpad7 ∷ Char
108+numpad7 = '\xE021'
109+
110+numpad8 ∷ Char
111+numpad8 = '\xE022'
112+
113+numpad9 ∷ Char
114+numpad9 = '\xE023'
115+
116+multiply ∷ Char
117+multiply = '\xE024'
118+
119+add ∷ Char
120+add = '\xE025'
121+
122+separator ∷ Char
123+separator = '\xE026'
124+
125+subtract ∷ Char
126+subtract = '\xE027'
127+
128+decimal ∷ Char
129+decimal = '\xE028'
130+
131+divide ∷ Char
132+divide = '\xE029'
133+
134+f1 ∷ Char
135+f1 = '\xE031'
136+
137+f2 ∷ Char
138+f2 = '\xE032'
139+
140+f3 ∷ Char
141+f3 = '\xE033'
142+
143+f4 ∷ Char
144+f4 = '\xE034'
145+
146+f5 ∷ Char
147+f5 = '\xE035'
148+
149+f6 ∷ Char
150+f6 = '\xE036'
151+
152+f7 ∷ Char
153+f7 = '\xE037'
154+
155+f8 ∷ Char
156+f8 = '\xE038'
157+
158+f9 ∷ Char
159+f9 = '\xE039'
160+
161+f10 ∷ Char
162+f10 = '\xE03A'
163+
164+f11 ∷ Char
165+f11 = '\xE03B'
166+
167+f12 ∷ Char
168+f12 = '\xE03C'
169+
170+command ∷ Char
171+command = '\xE03D'
172+
173+meta ∷ Char
174+meta = '\xE03D'
175+
176+zenkakuHankaku ∷ Char
177+zenkakuHankaku = '\xE040'
src/Lunapark/Utils.pursnew file+36
@@ -0,0 +1,36 @@
1+module Lunapark.Utils where
2+
3+import Prelude
4+
5+import Data.Argonaut.Decode (JsonDecodeError) as J
6+import Data.Bifunctor (lmap)
7+import Data.Either (Either)
8+import Effect.Aff (Aff)
9+import Lunapark.Error as LE
10+import Run as R
11+import Run.Except as RE
12+import Type.Row (type (+))
13+import Unsafe.Coerce (unsafeCoerce)
14+
15+liftAndRethrow
16+ ∷ ∀ r ε ω
17+ . Aff (Either ε ω)
18+ → R.Run (R.AFF + RE.EXCEPT ε + r) ω
19+liftAndRethrow a = do
20+ res ← R.liftAff a
21+ RE.rethrow res
22+
23+rethrowAsJsonDecodeError
24+ ∷ ∀ r
25+ . Either J.JsonDecodeError
26+ ~> R.Run (RE.EXCEPT LE.Error + r)
27+rethrowAsJsonDecodeError =
28+ RE.rethrow <<< lmap LE.JsonDecodeError
29+
30+-- Safe, since we actually want handler and result have same rows not, remove except
31+catch
32+ ∷ ∀ e r a
33+ . R.Run (RE.EXCEPT e + r) a
34+ → (e → R.Run (RE.EXCEPT e + r) a)
35+ → R.Run (RE.EXCEPT e + r) a
36+catch = unsafeCoerce $ flip RE.catch
src/Lunapark/WebDriverError.pursnew file+117
@@ -0,0 +1,117 @@
1+module Lunapark.WebDriverError where
2+
3+import Prelude
4+
5+import Data.Argonaut.Core (Json, fromString) as J
6+import Data.Argonaut.Decode (JsonDecodeError(..)) as J
7+import Data.Argonaut.Decode.Combinators ((.:)) as J
8+import Data.Argonaut.Decode.Class (decodeJson) as J
9+import Data.Either (Either(..))
10+
11+data WebDriverErrorType
12+ = ElementClickIntercepted
13+ | ElementNotSelectable
14+ | ElementNotInteractable
15+ | InsecureCertificate
16+ | InvalidArgument
17+ | InvalidCookieDomain
18+ | InvalidCoordinates
19+ | InvalidElementState
20+ | InvalidSelector
21+ | InvalidSessionId
22+ | JavaScriptError
23+ | MoveTargetOutOfBounds
24+ | NoSuchAlert
25+ | NoSuchCookie
26+ | NoSuchElement
27+ | NoSuchFrame
28+ | NoSuchWindow
29+ | ScriptTimeout
30+ | SessionNotCreated
31+ | StaleElementReference
32+ | Timeout
33+ | UnableToSetCookie
34+ | UnableToCaptureScreen
35+ | UnexpectedAlertOpen
36+ | UnknownCommand
37+ | UnknownError
38+ | UnknownMethod
39+ | UnsupportedOperation
40+
41+fromStringCode ∷ String → Either J.JsonDecodeError WebDriverErrorType
42+fromStringCode = case _ of
43+ "element click intercepted" → Right ElementClickIntercepted
44+ "element not selectable" → Right ElementNotSelectable
45+ "element not interactable" → Right ElementNotInteractable
46+ "insecure certificate" → Right InsecureCertificate
47+ "invalid argument" → Right InvalidArgument
48+ "invalid cookie domain" → Right InvalidCookieDomain
49+ "invalid coordinates" → Right InvalidCoordinates
50+ "invalid element state" → Right InvalidElementState
51+ "invalid selector" → Right InvalidSelector
52+ "invalid session id" → Right InvalidSessionId
53+ "javascript error" → Right JavaScriptError
54+ "move target out of bounds" → Right MoveTargetOutOfBounds
55+ "no such alert" → Right NoSuchAlert
56+ "no such cookie" → Right NoSuchCookie
57+ "no such element" → Right NoSuchElement
58+ "no such frame" → Right NoSuchFrame
59+ "no such window" → Right NoSuchWindow
60+ "script timeout" → Right ScriptTimeout
61+ "session not created" → Right SessionNotCreated
62+ "stale element reference" → Right StaleElementReference
63+ "timeout" → Right Timeout
64+ "unable to set cookie" → Right UnableToSetCookie
65+ "unable to capture screen" → Right UnableToCaptureScreen
66+ "unexpected alert open" → Right UnexpectedAlertOpen
67+ "unknown command" → Right UnknownCommand
68+ "unknown error" → Right UnknownError
69+ "unknown method" → Right UnknownMethod
70+ "unsupported operation" → Right UnsupportedOperation
71+ s → Left $ J.Named "WebDriverErrorType" $ J.UnexpectedValue $ J.fromString s
72+
73+toStringCode ∷ WebDriverErrorType → String
74+toStringCode = case _ of
75+ ElementClickIntercepted → "element click intercepted"
76+ ElementNotSelectable → "element not selectable"
77+ ElementNotInteractable → "element not interactable"
78+ InsecureCertificate → "insecure certificate"
79+ InvalidArgument → "invalid argument"
80+ InvalidCookieDomain → "invalid cookie domain"
81+ InvalidCoordinates → "invalid coordinates"
82+ InvalidElementState → "invalid element state"
83+ InvalidSelector → "invalid selector"
84+ InvalidSessionId → "invalid session id"
85+ JavaScriptError → "javascript error"
86+ MoveTargetOutOfBounds → "move target out of bounds"
87+ NoSuchAlert → "no such alert"
88+ NoSuchCookie → "no such cookie"
89+ NoSuchElement → "no such element"
90+ NoSuchFrame → "no such frame"
91+ NoSuchWindow → "no such window"
92+ ScriptTimeout → "script timeout"
93+ SessionNotCreated → "session not created"
94+ StaleElementReference → "stale element reference"
95+ Timeout → "timeout"
96+ UnableToSetCookie → "unable to set cookie"
97+ UnableToCaptureScreen → "unable to capture screen"
98+ UnexpectedAlertOpen → "unexpected alert open"
99+ UnknownCommand → "unknown command"
100+ UnknownError → "unknown error"
101+ UnknownMethod → "unknown method"
102+ UnsupportedOperation → "unsupported operation"
103+
104+type WebDriverError =
105+ { error ∷ WebDriverErrorType
106+ , message ∷ String
107+ , stacktrace ∷ String
108+ }
109+
110+fromJson ∷ J.Json → Either J.JsonDecodeError WebDriverError
111+fromJson js = do
112+ obj ← J.decodeJson js
113+ value ← obj J..: "value"
114+ error ← fromStringCode =<< value J..: "error"
115+ message ← value J..: "message"
116+ stacktrace ← value J..: "stacktrace"
117+ pure { error, message, stacktrace }
src/Main.pursdeleted−102
@@ -1,102 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−import Control.Monad.Eff (Eff)
6−import Control.Monad.Eff.Class (liftEff)
7−import Control.Monad.Aff as Aff
8−import Control.Monad.Aff.Class (liftAff)
9−import Control.Monad.Except.Trans as ET
10−import Control.Monad.Reader.Trans as RT
11−import Control.Monad.State.Trans as ST
12−import Control.Comonad (class Comonad, extract)
13−import Control.Extend (class Extend, extend, (<<=), (=>>))
14−import Data.Array as A
15−import Data.Newtype (wrap)
16−import CSS as CSS
17−import CSS.Selector as Selector
18−import Data.Foldable (for_)
19−import Data.Either (Either(..), either)
20−import Data.StrMap as SM
21−import Data.Map as Map
22−import Data.Argonaut as A
23−import Data.Tuple (Tuple(..))
24−import Network.HTTP.Affjax as AJ
25−import Node.ChildProcess as CP
26−import Data.Posix.Signal (Signal(..))
27−import Control.Monad.Eff.Now as Now
28−import Run as R
29−import Node.Process as PR
30−
31−import Debug.Trace as DT
32−
33−import Lunapark.Starter as LS
34−import Lunapark.Types as LT
35−import Lunapark.API as LA
36−import Lunapark.Helpers as LH
37−
38−defaultTimeouts ∷ LT.Timeouts
39−defaultTimeouts =
40− { pageLoad: wrap 300000.0
41− , implicit: wrap 0.0
42− , script: wrap 30000.0
43− }
44−main ∷ Eff _ Unit
45−main = void $ Aff.launchAff do
46− interpret ← LA.init "http://localhost:4444/wd/hub" { alwaysMatch: [], firstMatch: [ [ LT.BrowserName LT.Chrome ] ] }
47− res ← interpret do
48− st ← LA.status
49− DT.traceAnyA "status"
50− DT.traceAnyA st
51− ts ← LA.getTimeouts
52− DT.traceAnyA "timeouts"
53− DT.traceAnyA ts
54− LA.setTimeouts ts{ pageLoad = wrap 10.0 }
55− ts' ← LA.getTimeouts
56− DT.traceAnyA "timeouts'"
57− DT.traceAnyA ts'
58− LA.setTimeouts ts
59− LA.quit
60− DT.traceAnyA res
61−{-
62−main ∷ Eff _ Unit
63−main = void $ Aff.launchAff do
64−-- LS.start (Map.singleton LT.Firefox "gk.exe") "selenium-3.11.0.jar" [ "-port", "5555" ]
65−
66− let baseURI = "http://localhost:4444/wd/hub"
67− ei ← LA.init baseURI { alwaysMatch: [ ], firstMatch: [ [ LT.BrowserName LT.Firefox ] ] }
68− case ei of
69− Left err → do
70− DT.traceAnyA "An error occured"
71− DT.traceAnyA err
72−
73− Right sr → do
74− let config = { session: sr.session, baseURI, capabilities: sr.capabilities }
75− res ←
76− R.runBaseAff' $ R.runReader config $ R.runExcept $ R.runState {timeouts: defaultTimeouts} do
77− LA.go "http://localhost:8080"
78− LH.localTimeouts (\t → t{implicit = wrap 1000.0}) $ LH.repeatedly do
79− _ ← LA.findElement $ byAriaLabel "Select healthtrack"
80− localDir ← LA.findElement $ byAriaLabel "Select local"
81− DT.traceAnyA localDir
82− LH.performActions $ A.singleton $ LT.Pointer LT.Mouse
83− $ [LH.pointerMove $ LH.moveToElement localDir]
84−
85− LH.performActions $ A.singleton $ LT.Pointer LT.Mouse
86− $ LH.leftClick
87− LH.performActions $ A.singleton $ LT.Pointer LT.Mouse
88− $ LH.leftClick
89−
90−-- LA.elementClick localDir
91−-- LA.elementClick localDir
92− st ← LA.findElement $ byAriaLabel "Select startup_log"
93− DT.traceAnyA "startup_log"
94− DT.traceAnyA st
95−
96− _ ← R.runBaseAff' $ R.runReader config $ R.runExcept $ R.runState { timeouts: defaultTimeouts } $ LA.quit
97− DT.traceAnyA res
98− void $ liftEff $ PR.exit 0 --CP.kill SIGTERM cp
99−
100− where
101− byAriaLabel value = LT.ByCss $ CSS.fromString $ "[aria-label='" <> value <> "']"
102−-}
test/Test/Main.pursnew file+12
@@ -0,0 +1,12 @@
1+module Test.Main where
2+
3+import Prelude
4+
5+import Effect (Effect)
6+import Effect.Class.Console (log)
7+
8+main :: Effect Unit
9+main = do
10+ log "🍕"
11+ log "You should add some tests."
12+