on master help sign in
README.md+3−3
since splitsnapshots
unifiedsplit
@@ -137,7 +137,7 @@ The first five keys `[0..4]` are
137these values. Both the Haskell code and `jsaddle.js` can allocate new `JSVal` keys. The Haskell code allocates negative
137these values. Both the Haskell code and `jsaddle.js` can allocate new `JSVal` keys. The Haskell code allocates negative
138keys and `jsaddle.js` allocates positive keys to avoid clashing.
138keys and `jsaddle.js` allocates positive keys to avoid clashing.
139
139
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
141that are sort of "hey call this function and put the result in the map with this key"). This allows for the
141that are sort of "hey call this function and put the result in the map with this key"). This allows for the
142lazy execution of the JSaddle code.
142lazy execution of the JSaddle code.
143
143
@@ -146,7 +146,7 @@ when the JSVal is no longer reachable. The `jsaddle.js` code then deletes the k
146
146
147### JSStrings
147### JSStrings
148
148
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`.
150
150
151### Lazy Execution
151### Lazy Execution
152
152
@@ -213,7 +213,7 @@ JSaddle does not support exceptions well. When compiled with GHCJS an exception
213at the point the exception is thrown.
213at the point the exception is thrown.
214
214
215When using GHC the Haskell executions will probably continue for a while before the exception is received at all by the Haskell code
215When 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.
217When it reaches the synchronous command a haskell type JSException will be thrown (this may not be the thread that initiated the
217When it reaches the synchronous command a haskell type JSException will be thrown (this may not be the thread that initiated the
218command that caused the exception). You can use `syncPoint` and `syncAfter` to force the exception to be thrown.
218command that caused the exception). You can use `syncPoint` and `syncAfter` to force the exception to be thrown.
219There are `JSM` versions of `catch` and `bracket` that also include a `syncPoint` call.
219There are `JSM` versions of `catch` and `bracket` that also include a `syncPoint` call.
cabal.project+2−6
@@ -2,13 +2,9 @@ packages:
2 jsaddle/
2 jsaddle/
3 jsaddle-warp/
3 jsaddle-warp/
4 jsaddle-wkwebview/
4 jsaddle-wkwebview/
5−-- jsaddle-webkitgtk/
6 jsaddle-webkit2gtk/
5 jsaddle-webkit2gtk/
7 jsaddle-clib/
6 jsaddle-clib/
8
7
9−constraints: haskell-gi-overloading == 0.0, random >=1.2, time >=1.10, process >=1.6.10.0
8+constraints: haskell-gi-overloading == 0.0
10
9
11−package jsaddle-warp
12− tests: False
13−
14−allow-newer: websockets:random splitmix:time *:time *:unix *:process
10+allow-newer: websockets:random, splitmix:time, *:time, *:unix, *:process, stm:base
default.nixdeleted−11
@@ -1,11 +0,0 @@
1−{ sourcesOverride ? {}
2−, sources ? import ./nix/sources.nix {} // sourcesOverride
3−, pkgs ? (import sources."haskell.nix" {}).pkgs
4−, compiler-nix-name ? "ghc8101"
5−, system ? null
6−}:
7− pkgs.haskell-nix.project {
8− inherit compiler-nix-name;
9− src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; name = "jsaddle"; };
10− modules = [{ reinstallableLibGhc = true; packages.jsaddle-warp.components.tests.test-tool.buildable = pkgs.lib.mkForce false; }];
11− }
jsaddle-clib/jsaddle-clib.cabal+1−1
@@ -1,5 +1,5 @@
1name: jsaddle-clib
1name: jsaddle-clib
2−version: 0.9.7.1
2+version: 0.9.8.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
jsaddle-warp/jsaddle-warp.cabal+2−2
@@ -1,5 +1,5 @@
1name: jsaddle-warp
1name: jsaddle-warp
2−version: 0.9.7.1
2+version: 0.9.8.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -59,7 +59,7 @@ test-suite test-tool
59 bytestring -any,
59 bytestring -any,
60 containers -any,
60 containers -any,
61 deepseq -any,
61 deepseq -any,
62− doctest >=0.10.1 && <0.18,
62+ doctest >=0.10.1 && <0.19,
63 exceptions -any,
63 exceptions -any,
64 filepath >=1.4.0.0 && <1.5,
64 filepath >=1.4.0.0 && <1.5,
65 foreign-store -any,
65 foreign-store -any,
jsaddle-webkit2gtk/jsaddle-webkit2gtk.cabal+2−2
@@ -1,5 +1,5 @@
1name: jsaddle-webkit2gtk
1name: jsaddle-webkit2gtk
2−version: 0.9.7.1
2+version: 0.9.8.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -35,7 +35,7 @@ library
35 gi-gtk >=3.0.17 && <3.1,
35 gi-gtk >=3.0.17 && <3.1,
36 gi-webkit2 >=4.0.14 && <4.1,
36 gi-webkit2 >=4.0.14 && <4.1,
37 gi-javascriptcore >=4.0.14 && <4.1,
37 gi-javascriptcore >=4.0.14 && <4.1,
38− haskell-gi-base >=0.20 && <0.24,
38+ haskell-gi-base >=0.20 && <0.26,
39 haskell-gi-overloading >=0.0 && < 2.0,
39 haskell-gi-overloading >=0.0 && < 2.0,
40 jsaddle >=0.9.4.0 && <0.10,
40 jsaddle >=0.9.4.0 && <0.10,
41 text >=1.2.1.3 && <1.3,
41 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
55import qualified GI.Gtk as Gtk (main, init)
55import qualified GI.Gtk as Gtk (main, init)
56import GI.Gtk
56import GI.Gtk
57 (windowSetPosition, windowSetDefaultSize, windowNew,
57 (windowSetPosition, windowSetDefaultSize, windowNew,
58− scrolledWindowNew, noAdjustment, containerAdd,
58+ scrolledWindowNew, Adjustment, containerAdd,
59 WindowType(..), WindowPosition(..), widgetDestroy,
59 WindowType(..), WindowPosition(..), widgetDestroy,
60 widgetGetToplevel, widgetShowAll, onWidgetDestroy,
60 widgetGetToplevel, widgetShowAll, onWidgetDestroy,
61 mainQuit)
61 mainQuit)
62−import GI.Gio (noCancellable)
62+import GI.Gio (Cancellable)
63import GI.JavaScriptCore (valueToString)
63import GI.JavaScriptCore (valueToString)
64import GI.WebKit2
64import GI.WebKit2
65 (scriptDialogPromptSetText, scriptDialogPromptGetDefaultText,
65 (scriptDialogPromptSetText, scriptDialogPromptGetDefaultText,
@@ -82,6 +82,12 @@ import Language.Javascript.JSaddle (JSM, Results, Batch)
82import Language.Javascript.JSaddle.Run (runJavaScript)
82import Language.Javascript.JSaddle.Run (runJavaScript)
83import Language.Javascript.JSaddle.Run.Files (initState, runBatch, ghcjsHelpers)
83import Language.Javascript.JSaddle.Run.Files (initState, runBatch, ghcjsHelpers)
84
84
85+noAdjustment :: Maybe Adjustment
86+noAdjustment = Nothing
87+
88+noCancellable :: Maybe Cancellable
89+noCancellable = Nothing
90+
85quitWebView :: WebView -> IO ()
91quitWebView :: WebView -> IO ()
86quitWebView wv = postGUIAsync $ do w <- widgetGetToplevel wv --TODO: Shouldn't this be postGUISync?
92quitWebView wv = postGUIAsync $ do w <- widgetGetToplevel wv --TODO: Shouldn't this be postGUISync?
87 widgetDestroy w
93 widgetDestroy w
jsaddle-wkwebview/jsaddle-wkwebview.cabal+4−2
@@ -1,5 +1,5 @@
1name: jsaddle-wkwebview
1name: jsaddle-wkwebview
2−version: 0.9.7.1
2+version: 0.9.8.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -29,11 +29,13 @@ library
29 base <5
29 base <5
30 default-language: Haskell2010
30 default-language: Haskell2010
31 hs-source-dirs: src
31 hs-source-dirs: src
32− frameworks: Foundation, WebKit
33 ghc-options: -ferror-spans -Wall
32 ghc-options: -ferror-spans -Wall
33+ if os(linux)
34+ buildable: False
34 if impl(ghcjs)
35 if impl(ghcjs)
35 hs-source-dirs: src-ghcjs
36 hs-source-dirs: src-ghcjs
36 else
37 else
38+ frameworks: Foundation, WebKit
37 build-depends:
39 build-depends:
38 aeson >=0.8.0.2 && <1.6,
40 aeson >=0.8.0.2 && <1.6,
39 bytestring >=0.10.6.0 && <0.11,
41 bytestring >=0.10.6.0 && <0.11,
jsaddle/jsaddle.cabal+4−4
@@ -1,5 +1,5 @@
1name: jsaddle
1name: jsaddle
2−version: 0.9.7.1
2+version: 0.9.8.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -10,7 +10,7 @@ description:
10 This package provides an EDSL for calling JavaScript that
10 This package provides an EDSL for calling JavaScript that
11 can be used both from GHCJS and GHC. When using GHC
11 can be used both from GHCJS and GHC. When using GHC
12 the application is run using Warp and WebSockets to
12 the application is run using Warp and WebSockets to
13− drive a small JavaScipt helper.
13+ drive a small JavaScript helper.
14category: Web, Javascript
14category: Web, Javascript
15author: Hamish Mackenzie
15author: Hamish Mackenzie
16
16
@@ -107,13 +107,13 @@ library
107 Language.Javascript.JSaddle.Value
107 Language.Javascript.JSaddle.Value
108 Language.Javascript.JSaddle.Types
108 Language.Javascript.JSaddle.Types
109 build-depends:
109 build-depends:
110− aeson >=0.8.0.2 && <1.6,
110+ aeson >=0.11.3.0 && <1.6,
111 base >=4.9 && <5,
111 base >=4.9 && <5,
112 base-compat >=0.9.0 && <0.12,
112 base-compat >=0.9.0 && <0.12,
113 base64-bytestring >=1.0.0.1 && <1.2,
113 base64-bytestring >=1.0.0.1 && <1.2,
114 bytestring >=0.10.6.0 && <0.11,
114 bytestring >=0.10.6.0 && <0.11,
115 exceptions >=0.8 && <0.11,
115 exceptions >=0.8 && <0.11,
116− lens >=3.8.5 && <4.20,
116+ lens >=3.8.5 && <5.1,
117 primitive >=0.6.1.0 && <0.8,
117 primitive >=0.6.1.0 && <0.8,
118 text >=1.2.1.3 && <1.3,
118 text >=1.2.1.3 && <1.3,
119 transformers >=0.4.2.0 && <0.6
119 transformers >=0.4.2.0 && <0.6
jsaddle/src/Language/Javascript/JSaddle/Object.hs+3−4
@@ -526,12 +526,11 @@ array args = do
526 Object . coerce <$> fromListIO rargs
526 Object . coerce <$> fromListIO rargs
527
527
528-- | JavaScript's global object
528-- | JavaScript's global object
529−global :: Object
530#ifdef ghcjs_HOST_OS
529#ifdef ghcjs_HOST_OS
531−global = js_window
532−foreign import javascript unsafe "$r = window"
530+foreign import javascript unsafe "$r = globalThis"
533− js_window :: Object
531+ global :: Object
534#else
532#else
533+global :: Object
535global = Object . JSVal . unsafePerformIO $ newIORef 4
534global = Object . JSVal . unsafePerformIO $ newIORef 4
536#endif
535#endif
537
536
jsaddle/src/Language/Javascript/JSaddle/Run/Files.hs+1−1
@@ -41,7 +41,7 @@ initState = "\
41 \ jsaddle_values.set(1, undefined);\n\
41 \ jsaddle_values.set(1, undefined);\n\
42 \ jsaddle_values.set(2, false);\n\
42 \ jsaddle_values.set(2, false);\n\
43 \ jsaddle_values.set(3, true);\n\
43 \ jsaddle_values.set(3, true);\n\
44− \ jsaddle_values.set(4, window);\n\
44+ \ jsaddle_values.set(4, globalThis);\n\
45 \ var jsaddle_index = 100;\n\
45 \ var jsaddle_index = 100;\n\
46 \ var expectedBatch = 1;\n\
46 \ var expectedBatch = 1;\n\
47 \ var lastResults = [0, {\"tag\": \"Success\", \"contents\": [[], []]}];\n\
47 \ 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+}
nix/sources.jsondeleted−38
@@ -1,38 +0,0 @@
1−{
2− "haskell.nix": {
3− "branch": "master",
4− "description": "Alternative Haskell Infrastructure for Nixpkgs",
5− "homepage": "https://input-output-hk.github.io/haskell.nix",
6− "owner": "input-output-hk",
7− "repo": "haskell.nix",
8− "rev": "91b0a95e4071e7998778e1fe997f8ddcf759d48b",
9− "sha256": "13jx33vj8ixr3m88181wybzb8qlx0rl249bpphgz944anxp8z521",
10− "type": "tarball",
11− "url": "https://github.com/input-output-hk/haskell.nix/archive/91b0a95e4071e7998778e1fe997f8ddcf759d48b.tar.gz",
12− "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13− },
14− "niv": {
15− "branch": "master",
16− "description": "Easy dependency management for Nix projects",
17− "homepage": "https://github.com/nmattia/niv",
18− "owner": "nmattia",
19− "repo": "niv",
20− "rev": "c27f5a6c57de4495045450b6587d4a2c489851c8",
21− "sha256": "064lyr1661pk7hh7npgxsmk4cni9bc34hb2d6r76qp4cs2hcazim",
22− "type": "tarball",
23− "url": "https://github.com/nmattia/niv/archive/c27f5a6c57de4495045450b6587d4a2c489851c8.tar.gz",
24− "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25− },
26− "nixpkgs": {
27− "branch": "nixos-19.09",
28− "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
29− "homepage": "https://github.com/NixOS/nixpkgs",
30− "owner": "NixOS",
31− "repo": "nixpkgs-channels",
32− "rev": "289466dd6a11c65a7de4a954d6ebf66c1ad07652",
33− "sha256": "0r5ja052s86fr54fm1zlhld3fwawz2w1d1gd6vbvpjrpjfyajibn",
34− "type": "tarball",
35− "url": "https://github.com/NixOS/nixpkgs-channels/archive/289466dd6a11c65a7de4a954d6ebf66c1ad07652.tar.gz",
36− "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
37− }
38−}
nix/sources.nixdeleted−134
@@ -1,134 +0,0 @@
1−# This file has been generated by Niv.
2−
3−let
4−
5− #
6− # The fetchers. fetch_<type> fetches specs of type <type>.
7− #
8−
9− fetch_file = pkgs: spec:
10− if spec.builtin or true then
11− builtins_fetchurl { inherit (spec) url sha256; }
12− else
13− pkgs.fetchurl { inherit (spec) url sha256; };
14−
15− fetch_tarball = pkgs: spec:
16− if spec.builtin or true then
17− builtins_fetchTarball { inherit (spec) url sha256; }
18− else
19− pkgs.fetchzip { inherit (spec) url sha256; };
20−
21− fetch_git = spec:
22− builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
23−
24− fetch_builtin-tarball = spec:
25− builtins.trace
26− ''
27− WARNING:
28− The niv type "builtin-tarball" will soon be deprecated. You should
29− instead use `builtin = true`.
30−
31− $ niv modify <package> -a type=tarball -a builtin=true
32− ''
33− builtins_fetchTarball { inherit (spec) url sha256; };
34−
35− fetch_builtin-url = spec:
36− builtins.trace
37− ''
38− WARNING:
39− The niv type "builtin-url" will soon be deprecated. You should
40− instead use `builtin = true`.
41−
42− $ niv modify <package> -a type=file -a builtin=true
43− ''
44− (builtins_fetchurl { inherit (spec) url sha256; });
45−
46− #
47− # Various helpers
48− #
49−
50− # The set of packages used when specs are fetched using non-builtins.
51− mkPkgs = sources:
52− let
53− sourcesNixpkgs =
54− import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
55− hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
56− hasThisAsNixpkgsPath = <nixpkgs> == ./.;
57− in
58− if builtins.hasAttr "nixpkgs" sources
59− then sourcesNixpkgs
60− else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
61− import <nixpkgs> {}
62− else
63− abort
64− ''
65− Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
66− add a package called "nixpkgs" to your sources.json.
67− '';
68−
69− # The actual fetching function.
70− fetch = pkgs: name: spec:
71−
72− if ! builtins.hasAttr "type" spec then
73− abort "ERROR: niv spec ${name} does not have a 'type' attribute"
74− else if spec.type == "file" then fetch_file pkgs spec
75− else if spec.type == "tarball" then fetch_tarball pkgs spec
76− else if spec.type == "git" then fetch_git spec
77− else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
78− else if spec.type == "builtin-url" then fetch_builtin-url spec
79− else
80− abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
81−
82− # Ports of functions for older nix versions
83−
84− # a Nix version of mapAttrs if the built-in doesn't exist
85− mapAttrs = builtins.mapAttrs or (
86− f: set: with builtins;
87− listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
88− );
89−
90− # fetchTarball version that is compatible between all the versions of Nix
91− builtins_fetchTarball = { url, sha256 }@attrs:
92− let
93− inherit (builtins) lessThan nixVersion fetchTarball;
94− in
95− if lessThan nixVersion "1.12" then
96− fetchTarball { inherit url; }
97− else
98− fetchTarball attrs;
99−
100− # fetchurl version that is compatible between all the versions of Nix
101− builtins_fetchurl = { url, sha256 }@attrs:
102− let
103− inherit (builtins) lessThan nixVersion fetchurl;
104− in
105− if lessThan nixVersion "1.12" then
106− fetchurl { inherit url; }
107− else
108− fetchurl attrs;
109−
110− # Create the final "sources" from the config
111− mkSources = config:
112− mapAttrs (
113− name: spec:
114− if builtins.hasAttr "outPath" spec
115− then abort
116− "The values in sources.json should not have an 'outPath' attribute"
117− else
118− spec // { outPath = fetch config.pkgs name spec; }
119− ) config.sources;
120−
121− # The "config" used by the fetchers
122− mkConfig =
123− { sourcesFile ? ./sources.json
124− , sources ? builtins.fromJSON (builtins.readFile sourcesFile)
125− , pkgs ? mkPkgs sources
126− }: rec {
127− # The sources, i.e. the attribute set of spec name to spec
128− inherit sources;
129−
130− # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
131− inherit pkgs;
132− };
133−in
134−mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
shell.nixdeleted−4
@@ -1,4 +0,0 @@
1−{ sourcesOverride ? {}, compiler-nix-name ? "ghc8101" }:
2−(import ./. { inherit sourcesOverride compiler-nix-name; }).shellFor {
3− tools = { cabal = "3.2.0.0"; };
4−}