on master help sign in
14 files changed+61−70
since splitsnapshots
unifiedsplit
README.md+3−3 cabal.project+1−8 default.nix−28 jsaddle-clib/jsaddle-clib.cabal+2−2 jsaddle-warp/jsaddle-warp.cabal+5−5 jsaddle-webkit2gtk/jsaddle-webkit2gtk.cabal+3−3 jsaddle-webkit2gtk/src/Language/Javascript/JSaddle/WebKitGTK.hs+8−2 jsaddle-wkwebview/default.nix+14 jsaddle-wkwebview/jsaddle-wkwebview.cabal+5−3 jsaddle/jsaddle.cabal+8−8 jsaddle/src/Language/Javascript/JSaddle/Object.hs+3−4 jsaddle/src/Language/Javascript/JSaddle/Run/Files.hs+1−1 nix/hix.nix+8 shell.nix−3
README.md+3−3
@@ -137,7 +137,7 @@ The first five keys `[0..4]` are
137137these values. Both the Haskell code and `jsaddle.js` can allocate new `JSVal` keys. The Haskell code allocates negative
138138keys and `jsaddle.js` allocates positive keys to avoid clashing.
139139
140−The haskell code will not know the value of the to go with the key, but it will include it in commands to the server
140+The haskell code will not know the value to go with the key, but it will include it in commands to the server
141141that are sort of "hey call this function and put the result in the map with this key"). This allows for the
142142lazy execution of the JSaddle code.
143143
@@ -146,7 +146,7 @@ when the JSVal is no longer reachable. The `jsaddle.js` code then deletes the k
146146
147147### JSStrings
148148
149−These are haskell `Text` type and so reside on the native side of the WebSocket. If you want to make avoid transferring large string values over the WebSocket use `toJSVal` to convert it to a `JSVal`.
149+These are haskell `Text` type and so reside on the native side of the WebSocket. If you want to avoid transferring large string values over the WebSocket use `toJSVal` to convert it to a `JSVal`.
150150
151151### Lazy Execution
152152
@@ -213,7 +213,7 @@ JSaddle does not support exceptions well. When compiled with GHCJS an exception
213213at the point the exception is thrown.
214214
215215When using GHC the Haskell executions will probably continue for a while before the exception is received at all by the Haskell code
216−(because the lazy execution of the JS code). The exception will be thrown when the the next synchronous command is executed.
216+(because the lazy execution of the JS code). The exception will be thrown when the next synchronous command is executed.
217217When it reaches the synchronous command a haskell type JSException will be thrown (this may not be the thread that initiated the
218218command that caused the exception). You can use `syncPoint` and `syncAfter` to force the exception to be thrown.
219219There are `JSM` versions of `catch` and `bracket` that also include a `syncPoint` call.
cabal.project+1−8
@@ -2,16 +2,9 @@ packages:
22 jsaddle/
33 jsaddle-warp/
44 jsaddle-wkwebview/
5−-- jsaddle-webkitgtk/
65 jsaddle-webkit2gtk/
76 jsaddle-clib/
87
98constraints: haskell-gi-overloading == 0.0
109
11−write-ghc-environment-files: never
12−
13−source-repository-package
14− type: git
15− location: https://github.com/gtk2hs/webkit-javascriptcore
16− tag: 5868624d0ea1db6e6279c301f7f56adb808a85bf
17− --sha256: 0aj0cvcbnzrdi1ynahpb4034vadfrs99n5qa8dar1srhijv55g8b
10+allow-newer: websockets:random, splitmix:time, *:time, *:unix, *:process, stm:base
default.nixdeleted−28
@@ -1,28 +0,0 @@
1−{ pkgs ? import nixpkgs (haskellNixpkgsArgs // (if system == null then {} else { inherit system; }) //
2− { overlays = haskellNixpkgsArgs.overlays ++ [(self: super: {
3− inherit (self.haskell-nix.haskellPackages) alex happy;
4− })];})
5−, nixpkgs ? haskellNixSrc + "/nixpkgs"
6−, haskellNixpkgsArgs ? import haskellNixSrc
7−, haskellNixSrc ? builtins.fetchTarball {
8− url = "https://github.com/input-output-hk/haskell.nix/archive/1dd6951d6a56115fd368c5b37b8dab47a90ec45c.tar.gz";
9− sha256 = "02nhjy90xwg9wrp81cnlczndxags966c71wlbz6n91423a13mc99";
10− }
11−, haskellCompiler ? "ghc881"
12−, system ? null
13−}:
14−let
15− frameworks = pkgs.lib.optionals pkgs.stdenv.isDarwin (
16− with pkgs.darwin.apple_sdk.frameworks; [ Cocoa Carbon CoreGraphics ]);
17− project = pkgs.haskell-nix.cabalProject' {
18− src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
19− ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler};
20− modules = [
21− ({ config, ...}: {
22− packages.gi-gtk.components.setup.frameworks = frameworks;
23− packages.vault.components.library.doHaddock = false;
24− })
25− ];
26− };
27−in
28− project
jsaddle-clib/jsaddle-clib.cabal+2−2
@@ -1,5 +1,5 @@
11name: jsaddle-clib
2−version: 0.9.7.0
2+version: 0.9.8.0
33cabal-version: >=1.10
44build-type: Simple
55license: MIT
@@ -21,7 +21,7 @@ library
2121 Language.Javascript.JSaddle.CLib
2222 Language.Javascript.JSaddle.CLib.Internal
2323 build-depends:
24− aeson >=0.8.0.2 && <1.5,
24+ aeson >=0.8.0.2 && <1.6,
2525 base <5,
2626 base-compat >=0.9.0 && <0.12,
2727 bytestring >=0.10.6.0 && <0.11,
jsaddle-warp/jsaddle-warp.cabal+5−5
@@ -1,5 +1,5 @@
11name: jsaddle-warp
2−version: 0.9.7.0
2+version: 0.9.8.0
33cabal-version: >=1.10
44build-type: Simple
55license: MIT
@@ -27,7 +27,7 @@ library
2727 other-modules:
2828 Language.Javascript.JSaddle.WebSockets.Compat
2929 build-depends:
30− aeson >=0.8.0.2 && <1.5,
30+ aeson >=0.8.0.2 && <1.6,
3131 bytestring >=0.10.6.0 && <0.11,
3232 containers >=0.5.6.2 && <0.7,
3333 foreign-store >=0.2 && <0.3,
@@ -35,7 +35,7 @@ library
3535 jsaddle >=0.9.4.0 && <0.10,
3636 stm >=2.4.4 && <2.6,
3737 text >=1.2.1.3 && <1.3,
38− time >=1.5.0.1 && <1.10,
38+ time >=1.5.0.1 && <1.11,
3939 transformers >=0.4.2.0 && <0.6,
4040 wai >=3.0.3.0 && <3.3,
4141 wai-websockets >=3.0.0.6 && <3.1,
@@ -59,7 +59,7 @@ test-suite test-tool
5959 bytestring -any,
6060 containers -any,
6161 deepseq -any,
62− doctest >=0.10.1 && <0.17,
62+ doctest >=0.10.1 && <0.19,
6363 exceptions -any,
6464 filepath >=1.4.0.0 && <1.5,
6565 foreign-store -any,
@@ -81,7 +81,7 @@ test-suite test-tool
8181 wai -any,
8282 wai-websockets -any,
8383 warp -any,
84− webdriver >=0.8.4 && <1.0,
84+ webdriver >=0.8.4 && <0.10,
8585 websockets -any
8686 type: exitcode-stdio-1.0
8787 main-is: DocTest.hs
jsaddle-webkit2gtk/jsaddle-webkit2gtk.cabal+3−3
@@ -1,5 +1,5 @@
11name: jsaddle-webkit2gtk
2−version: 0.9.7.0
2+version: 0.9.8.0
33cabal-version: >=1.10
44build-type: Simple
55license: MIT
@@ -26,7 +26,7 @@ library
2626 base <5
2727 if !impl(ghcjs -any)
2828 build-depends:
29− aeson >=0.8.0.2 && <1.5,
29+ aeson >=0.8.0.2 && <1.6,
3030 base <5,
3131 bytestring >=0.10.6.0 && <0.11,
3232 directory >=1.0.0.2 && <1.4,
@@ -35,7 +35,7 @@ library
3535 gi-gtk >=3.0.17 && <3.1,
3636 gi-webkit2 >=4.0.14 && <4.1,
3737 gi-javascriptcore >=4.0.14 && <4.1,
38− haskell-gi-base >=0.20 && <0.24,
38+ haskell-gi-base >=0.20 && <0.26,
3939 haskell-gi-overloading >=0.0 && < 2.0,
4040 jsaddle >=0.9.4.0 && <0.10,
4141 text >=1.2.1.3 && <1.3,
jsaddle-webkit2gtk/src/Language/Javascript/JSaddle/WebKitGTK.hs+8−2
@@ -55,11 +55,11 @@ import GI.GLib (timeoutAdd, idleAdd, pattern PRIORITY_HIGH, pattern PRIORITY_DEF
5555import qualified GI.Gtk as Gtk (main, init)
5656import GI.Gtk
5757 (windowSetPosition, windowSetDefaultSize, windowNew,
58− scrolledWindowNew, noAdjustment, containerAdd,
58+ scrolledWindowNew, Adjustment, containerAdd,
5959 WindowType(..), WindowPosition(..), widgetDestroy,
6060 widgetGetToplevel, widgetShowAll, onWidgetDestroy,
6161 mainQuit)
62−import GI.Gio (noCancellable)
62+import GI.Gio (Cancellable)
6363import GI.JavaScriptCore (valueToString)
6464import GI.WebKit2
6565 (scriptDialogPromptSetText, scriptDialogPromptGetDefaultText,
@@ -82,6 +82,12 @@ import Language.Javascript.JSaddle (JSM, Results, Batch)
8282import Language.Javascript.JSaddle.Run (runJavaScript)
8383import Language.Javascript.JSaddle.Run.Files (initState, runBatch, ghcjsHelpers)
8484
85+noAdjustment :: Maybe Adjustment
86+noAdjustment = Nothing
87+
88+noCancellable :: Maybe Cancellable
89+noCancellable = Nothing
90+
8591quitWebView :: WebView -> IO ()
8692quitWebView wv = postGUIAsync $ do w <- widgetGetToplevel wv --TODO: Shouldn't this be postGUISync?
8793 widgetDestroy w
jsaddle-wkwebview/default.nixnew file+14
@@ -0,0 +1,14 @@
1+{ filterSource ? (x: x) }:
2+self: super:
3+let
4+ pkgs = self.callPackage ({pkgs}: pkgs) {};
5+ inherit (pkgs) lib;
6+in
7+with pkgs.haskell.lib;
8+overrideCabal (self.callCabal2nix "jsaddle-wkwebview" (filterSource ./.) {}) (drv: {
9+ libraryFrameworkDepends = (drv.libraryFrameworkDepends or []) ++
10+ (if pkgs.stdenv.hostPlatform.useiOSPrebuilt then [
11+ "${pkgs.buildPackages.darwin.xcode}/Contents/Developer/Platforms/${pkgs.stdenv.hostPlatform.xcodePlatform}.platform/Developer/SDKs/${pkgs.stdenv.hostPlatform.xcodePlatform}.sdk/System"
12+ ] else (with pkgs.buildPackages.darwin.apple_sdk.frameworks; [ Cocoa WebKit ]));
13+ buildDepends = lib.optional (!pkgs.stdenv.hostPlatform.useiOSPrebuilt) [ pkgs.buildPackages.darwin.cf-private ];
14+})
jsaddle-wkwebview/jsaddle-wkwebview.cabal+5−3
@@ -1,5 +1,5 @@
11name: jsaddle-wkwebview
2−version: 0.9.7.0
2+version: 0.9.8.0
33cabal-version: >=1.10
44build-type: Simple
55license: MIT
@@ -29,13 +29,15 @@ library
2929 base <5
3030 default-language: Haskell2010
3131 hs-source-dirs: src
32− frameworks: Foundation, WebKit
3332 ghc-options: -ferror-spans -Wall
33+ if os(linux)
34+ buildable: False
3435 if impl(ghcjs)
3536 hs-source-dirs: src-ghcjs
3637 else
38+ frameworks: Foundation, WebKit
3739 build-depends:
38− aeson >=0.8.0.2 && <1.5,
40+ aeson >=0.8.0.2 && <1.6,
3941 bytestring >=0.10.6.0 && <0.11,
4042 directory,
4143 jsaddle >= 0.9.4.0 && <0.10,
jsaddle/jsaddle.cabal+8−8
@@ -1,5 +1,5 @@
11name: jsaddle
2−version: 0.9.7.0
2+version: 0.9.8.0
33cabal-version: >=1.10
44build-type: Simple
55license: MIT
@@ -10,7 +10,7 @@ description:
1010 This package provides an EDSL for calling JavaScript that
1111 can be used both from GHCJS and GHC. When using GHC
1212 the application is run using Warp and WebSockets to
13− drive a small JavaScipt helper.
13+ drive a small JavaScript helper.
1414category: Web, Javascript
1515author: Hamish Mackenzie
1616
@@ -42,14 +42,14 @@ library
4242 ghc-prim,
4343 http-types >=0.8.6 && <0.13,
4444 process >=1.2.3.0 && <1.7,
45− random >= 1.1 && < 1.2,
45+ random >= 1.1 && < 1.3,
4646 ref-tf >=0.4.0.1 && <0.5,
4747 scientific >=0.3 && <0.4,
4848 stm >=2.4.4 && <2.6,
49− time >=1.5.0.1 && <1.10,
49+ time >=1.5.0.1 && <1.11,
5050 unordered-containers >=0.2 && <0.3,
5151 vector >=0.10 && <0.13,
52− unliftio-core >=0.1 && < 0.2
52+ unliftio-core >=0.1 && < 0.3
5353 exposed-modules:
5454 Data.JSString
5555 Data.JSString.Internal
@@ -107,13 +107,13 @@ library
107107 Language.Javascript.JSaddle.Value
108108 Language.Javascript.JSaddle.Types
109109 build-depends:
110− aeson >=0.8.0.2 && <1.5,
110+ aeson >=0.11.3.0 && <1.6,
111111 base >=4.9 && <5,
112112 base-compat >=0.9.0 && <0.12,
113− base64-bytestring >=1.0.0.1 && <1.1,
113+ base64-bytestring >=1.0.0.1 && <1.2,
114114 bytestring >=0.10.6.0 && <0.11,
115115 exceptions >=0.8 && <0.11,
116− lens >=3.8.5 && <4.19,
116+ lens >=3.8.5 && <5.1,
117117 primitive >=0.6.1.0 && <0.8,
118118 text >=1.2.1.3 && <1.3,
119119 transformers >=0.4.2.0 && <0.6
jsaddle/src/Language/Javascript/JSaddle/Object.hs+3−4
@@ -526,12 +526,11 @@ array args = do
526526 Object . coerce <$> fromListIO rargs
527527
528528-- | JavaScript's global object
529−global :: Object
530529#ifdef ghcjs_HOST_OS
531−global = js_window
532−foreign import javascript unsafe "$r = window"
533− js_window :: Object
530+foreign import javascript unsafe "$r = globalThis"
531+ global :: Object
534532#else
533+global :: Object
535534global = Object . JSVal . unsafePerformIO $ newIORef 4
536535#endif
537536
jsaddle/src/Language/Javascript/JSaddle/Run/Files.hs+1−1
@@ -41,7 +41,7 @@ initState = "\
4141 \ jsaddle_values.set(1, undefined);\n\
4242 \ jsaddle_values.set(2, false);\n\
4343 \ jsaddle_values.set(3, true);\n\
44− \ jsaddle_values.set(4, window);\n\
44+ \ jsaddle_values.set(4, globalThis);\n\
4545 \ var jsaddle_index = 100;\n\
4646 \ var expectedBatch = 1;\n\
4747 \ var lastResults = [0, {\"tag\": \"Success\", \"contents\": [[], []]}];\n\
nix/hix.nixnew file+8
@@ -0,0 +1,8 @@
1+{pkgs, ...}:
2+{ modules = [({pkgs, ...}: {
3+ packages.webkit2gtk3-javascriptcore.components.library.doHaddock = false;
4+ })];
5+ shell.buildInputs = [ pkgs.nodejs ];
6+ shell.tools.cabal = {};
7+ shell.crossPlatforms = p: [ p.ghcjs ];
8+}
shell.nixdeleted−3
@@ -1,3 +0,0 @@
1−{ haskellCompiler ? "ghc881" }:
2−(import ./. { inherit haskellCompiler; }).hsPkgs.shellFor {}
3−