Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 0f2e689

Browse files
authored
Merge pull request #5 from garyb/interpreter-type
Interpreter type
2 parents 780f320 + fc225a0 commit 0f2e689

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"node_modules",
2222
"bower_components",
2323
"output",
24-
"test"
24+
"test",
25+
"vendor"
2526
],
2627
"dependencies": {
2728
"purescript-xpath": "cryogenian/purescript-xpath#compiler/0.12",

src/Lunapark.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Lunapark
66
) where
77

88

9-
import Lunapark.API (BaseRun, HandleLunaparkInput, Lunapark, handleLunapark, init, interpret, interpretW3CActions, jsonWireActions, runLunapark, runLunaparkActions, w3cActions)
9+
import Lunapark.API (Interpreter(..), runInterpreter, BaseRun, HandleLunaparkInput, Lunapark, handleLunapark, init, interpret, interpretW3CActions, jsonWireActions, runLunapark, runLunaparkActions, w3cActions)
1010
import Lunapark.Error (Error, ErrorType(..), fromJson, fromStringCode, toStringCode, unknownError)
1111
import Lunapark.ActionF (ActionF(..), LUNAPARK_ACTIONS, TouchF(..), WithAction, _lunaparkActions, buttonDown, buttonUp, click, doubleClick, doubleTap, flick, liftAction, longTap, moveTo, pause, scroll, sendKeys, tap, touchDown, touchUp)
1212
import Lunapark.LunaparkF (ElementF(..), LUNAPARK, LunaparkF(..), WithLunapark, _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)

src/Lunapark/API.purs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@ import Node.FS.Aff as FS
3333
import Run as R
3434
import Run.Except (EXCEPT)
3535

36+
newtype Interpreter r = Interpreter (Lunapark r ~> BaseRun r)
37+
38+
runInterpreter r. Interpreter r Lunapark r ~> BaseRun r
39+
runInterpreter (Interpreter f) = f
40+
3641
init
37-
m r a
42+
m r
3843
. MonadAff m
3944
MonadRec m
4045
String
4146
LT.CapabilitiesRequest
42-
m (Either LE.Error (Lunapark r a BaseRun r a))
47+
m (Either LE.Error (Interpreter r))
4348
init uri caps = do
4449
res ←
4550
liftAff
@@ -78,7 +83,7 @@ init uri caps = do
7883
, actionsEnabled
7984
}
8085

81-
pure $ interpret input
86+
pure $ Interpreter (interpret input)
8287

8388
interpret
8489
r

0 commit comments

Comments
 (0)