diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml
index 80c8541e..105acf67 100644
--- a/.github/workflows/haskell.yml
+++ b/.github/workflows/haskell.yml
@@ -1,12 +1,12 @@
name: github-action
-on: [push, pull_request]
+on: [push, pull_request]
jobs:
build:
strategy:
matrix:
- ghc: ['8.4.4', '8.6.5', '8.8.4', '8.10.2']
+ ghc: ['8.4.4', '8.6.5', '8.8.4', '8.10.2', '9.8.2', '9.10.1']
os: ['ubuntu-latest', 'macos-latest']
exclude:
# There are some linker warnings in 802 on darwin that
diff --git a/.gitignore b/.gitignore
index e28ef49b..a241d7e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ hsenv.log
*_stub.h
.cabal-sandbox/
cabal.sandbox.config
+cabal.project.local
.stack-work
codex.tags
*.dump-*
diff --git a/cabal.dependencies.project b/cabal.dependencies.project
new file mode 100644
index 00000000..853f8b76
--- /dev/null
+++ b/cabal.dependencies.project
@@ -0,0 +1,27 @@
+allow-newer:
+ which:base
+ , which:template-haskell
+ , dependent-sum-template:template-haskell
+
+source-repository-package
+ type: git
+ location: https://github.com/ymeister/ghcjs-dom.git
+ tag: 5bff37b7f83072b732eedaea4661083b3d35e4b6
+ subdir: ghcjs-dom-javascript
+ --sha256: 0dxiskgx3f2f4bnkwghk0kqfp7pp2m5r3pma9dxlhxggj9a95brm
+
+if !arch(javascript)
+ source-repository-package
+ type: git
+ location: https://github.com/ndmitchell/hlint.git
+ tag: 49f47288040400f1a4c4af71646d2037fdbbd72b
+ --sha256: sha256-gHVNiyYkCX8DKzOEt2HeV+2v/AyafpjsgfZbZjHo0lM=
+
+ source-repository-package
+ type: git
+ location: https://github.com/gtk2hs/webkit-javascriptcore.git
+ tag: 0.14.4.6
+ --sha256: sha256-AHqqMG7RkCZGjtEKXD94VAzxa8vP0K4LMX9ZjUyPC5M=
+
+ package webkit2gtk3-javascriptcore
+ documentation: false
diff --git a/cabal.project b/cabal.project
index 66bf72d3..1362d589 100644
--- a/cabal.project
+++ b/cabal.project
@@ -4,7 +4,7 @@ packages:
chrome-test-utils/
reflex-dom-test-selenium/
-source-repository-package
- type: git
- location: https://github.com/dfordivam/hspec-webdriver-clone
- tag: 0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8
+if arch(javascript)
+ extra-packages: ghci
+
+import: cabal.dependencies.project
diff --git a/cabal.project-nogtk b/cabal.project-nogtk
index 6694c040..a3fb1107 100644
--- a/cabal.project-nogtk
+++ b/cabal.project-nogtk
@@ -7,8 +7,3 @@ package reflex-dom-core
package reflex-dom
flags: +use-warp -webkit2gtk
-
-source-repository-package
- type: git
- location: https://github.com/dfordivam/hspec-webdriver-clone
- tag: 0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8
diff --git a/reflex-dom-core/reflex-dom-core.cabal b/reflex-dom-core/reflex-dom-core.cabal
index 84b0aecc..c7d3a68e 100644
--- a/reflex-dom-core/reflex-dom-core.cabal
+++ b/reflex-dom-core/reflex-dom-core.cabal
@@ -1,260 +1,280 @@
-cabal-version: 1.24
-Name: reflex-dom-core
-Version: 0.8.0.0
-Synopsis: Functional Reactive Web Apps with Reflex
-Description:
- Web applications without callbacks or side-effects.
- Reflex-DOM brings the power of functional reactive programming (FRP) to the web.
- Build HTML and other Document Object Model (DOM) data with a pure functional interface.
- .
- Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: .
- .
- The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the
- correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.).
- Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@.
- All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@.
-License: BSD3
-License-file: LICENSE
-Author: Ryan Trinkle
-Maintainer: ryan.trinkle@gmail.com
-Stability: Experimental
-Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
-Build-type: Simple
--- Deal with https://github.com/haskell/cabal/issues/2544 / https://github.com/haskell/cabal/issues/367
-extra-source-files: src-ghc/Foreign/JavaScript/Internal/Utils.hs
- src-ghcjs/Foreign/JavaScript/Internal/Utils.hs
- src/Reflex/Dom/Xhr/Foreign.hs
- src/Reflex/Dom/WebSocket/Foreign.hs
- src/Reflex/Dom/Xhr/ResponseType.hs
- src/Reflex/Dom/Xhr/Exception.hs
- ChangeLog.md
+cabal-version: 1.24
+name: reflex-dom-core
+version: 0.8.0.0
+license: BSD3
+license-file: LICENSE
+maintainer: ryan.trinkle@gmail.com
+author: Ryan Trinkle
+stability: Experimental
+synopsis: Functional Reactive Web Apps with Reflex
+description:
+ Web applications without callbacks or side-effects.
+ Reflex-DOM brings the power of functional reactive programming (FRP) to the web.
+ Build HTML and other Document Object Model (DOM) data with a pure functional interface.
+ .
+ Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: .
+ .
+ The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the
+ correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.).
+ Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@.
+ All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@.
+
+category:
+ FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
+
+build-type: Simple
+extra-source-files:
+ src-ghc/Foreign/JavaScript/Internal/Utils.hs
+ src-ghcjs/Foreign/JavaScript/Internal/Utils.hs
+ src/Reflex/Dom/Xhr/Foreign.hs
+ src/Reflex/Dom/WebSocket/Foreign.hs
+ src/Reflex/Dom/Xhr/ResponseType.hs
+ src/Reflex/Dom/Xhr/Exception.hs
+ ChangeLog.md
+
+source-repository head
+ type: git
+ location: https://github.com/reflex-frp/reflex-dom
+ subdir: reflex-dom-core
flag use-template-haskell
- description: Use template haskell to generate lenses
- default: True
- manual: True
+ description: Use template haskell to generate lenses
+ manual: True
flag use-reflex-optimizer
- description: Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental.
- default: False
- manual: True
+ description:
+ Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental.
+
+ default: False
+ manual: True
flag expose-all-unfoldings
- description: Build the library with -fexpose-all-unfoldings which can help client code specialize better
- default: False
- manual: True
+ description:
+ Build the library with -fexpose-all-unfoldings which can help client code specialize better
+
+ default: False
+ manual: True
flag profile-reflex
- description: Add a layer of profiling to all Reflex events in the system
- default: False
- manual: True
+ description: Add a layer of profiling to all Reflex events in the system
+ default: False
+ manual: True
flag split-these
- description: Use split these/semialign packages
- manual: False
- default: True
+ description: Use split these/semialign packages
flag hydration-tests
- description: Whether to run the hydration tests (currently only available on linux)
- default: True
- manual: True
+ description:
+ Whether to run the hydration tests (currently only available on linux)
+
+ manual: True
flag gc-tests
- description: Whether to run the gc tests (currently only available on linux)
- default: True
- manual: True
+ description:
+ Whether to run the gc tests (currently only available on linux)
+
+ manual: True
library
- hs-source-dirs: src
- build-depends:
- aeson >= 0.8 && < 2.2,
- base >= 4.7 && < 4.15,
- bifunctors >= 4.2 && < 6,
- bimap >= 0.3 && < 0.5,
- blaze-builder >= 0.4.1 && < 0.5,
- bytestring == 0.10.*,
- case-insensitive < 1.3,
- commutative-semigroups >=0.1 && <0.2,
- containers >= 0.6 && < 0.7,
- constraints >= 0.9 && < 0.14,
- contravariant >= 1.4 && < 1.6,
- data-default >= 0.5 && < 0.8,
- dependent-map >= 0.3 && < 0.5,
- dependent-sum >= 0.6 && < 0.8,
- dependent-sum-template >= 0.1 && < 0.2,
- directory >= 1.2 && < 1.4,
- exception-transformers == 0.4.*,
- ghcjs-dom >= 0.9.1.0 && < 0.10,
- jsaddle >= 0.9.0.0 && < 0.10,
- -- keycode-0.2 has a bug on firefox
- keycode >= 0.2.1 && < 0.3,
- lens >= 4.7 && < 5.3,
- monad-control >= 1.0.1 && < 1.1,
- mtl >= 2.1 && < 2.3,
- primitive >= 0.5 && < 0.8,
- random >= 1.1 && < 1.3,
- ref-tf >= 0.4 && < 0.6,
- reflex >= 0.8.2.1 && < 1,
- semigroups >= 0.16 && < 0.20,
- stm >= 2.4 && < 2.6,
- text == 1.2.*,
- transformers >= 0.3 && < 0.6,
- network-uri >= 2.6.1 && < 2.7,
- zenc == 0.1.*
-
- if impl(ghcjs)
- hs-source-dirs: src-ghcjs
- build-depends:
- ghcjs-base,
- hashable >= 1.2 && < 1.4
- else
- hs-source-dirs: src-ghc
- if !os(windows)
- build-depends: unix == 2.7.*
-
- if flag(split-these)
- build-depends:
- semialign >= 1 && < 1.3,
- these >= 1 && < 1.3
- else
- build-depends:
- these >= 0.4 && < 0.9
-
- exposed-modules:
- Foreign.JavaScript.TH
- Foreign.JavaScript.Orphans
- Foreign.JavaScript.Utils
- Reflex.Dom.Builder.Class
- Reflex.Dom.Builder.Class.Events
- Reflex.Dom.Builder.Immediate
- Reflex.Dom.Builder.InputDisabled
- Reflex.Dom.Builder.Hydratable
- Reflex.Dom.Builder.Static
- Reflex.Dom.Class
- Reflex.Dom.Core
- Reflex.Dom.Location
- Reflex.Dom.Main
- Reflex.Dom.Modals.Class
- Reflex.Dom.Old
- Reflex.Dom.Prerender
- Reflex.Dom.Time
- Reflex.Dom.WebSocket
- Reflex.Dom.WebSocket.Query
- Reflex.Dom.Widget
- Reflex.Dom.Widget.Basic
- Reflex.Dom.Widget.Input
- Reflex.Dom.Widget.Lazy
- Reflex.Dom.Widget.Resize
- Reflex.Dom.Xhr
- Reflex.Dom.Xhr.FormData
- other-modules:
- Foreign.JavaScript.Internal.Utils
- Reflex.Dom.WebSocket.Foreign
- Reflex.Dom.Xhr.Foreign
- Reflex.Dom.Xhr.ResponseType
- Reflex.Dom.Xhr.Exception
-
- default-language: Haskell98
- ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fspecialise-aggressively
- ghc-prof-options: -fprof-auto
-
- if flag(expose-all-unfoldings)
- ghc-options: -fexpose-all-unfoldings
-
- if flag(use-reflex-optimizer)
- ghc-options: -fplugin=Reflex.Optimizer
-
- if flag(profile-reflex)
- cpp-options: -DPROFILE_REFLEX
-
- if flag(use-template-haskell)
- build-depends:
- dependent-sum-template >= 0.1 && < 0.2,
- template-haskell >= 2.12.0 && < 2.17
- other-extensions: TemplateHaskell
- cpp-options: -DUSE_TEMPLATE_HASKELL
+ exposed-modules:
+ Foreign.JavaScript.TH
+ Foreign.JavaScript.Orphans
+ Foreign.JavaScript.Utils
+ Reflex.Dom.Builder.Class
+ Reflex.Dom.Builder.Class.Events
+ Reflex.Dom.Builder.Immediate
+ Reflex.Dom.Builder.InputDisabled
+ Reflex.Dom.Builder.Hydratable
+ Reflex.Dom.Builder.Static
+ Reflex.Dom.Class
+ Reflex.Dom.Core
+ Reflex.Dom.Location
+ Reflex.Dom.Main
+ Reflex.Dom.Modals.Class
+ Reflex.Dom.Old
+ Reflex.Dom.Prerender
+ Reflex.Dom.Time
+ Reflex.Dom.WebSocket
+ Reflex.Dom.WebSocket.Query
+ Reflex.Dom.Widget
+ Reflex.Dom.Widget.Basic
+ Reflex.Dom.Widget.Input
+ Reflex.Dom.Widget.Lazy
+ Reflex.Dom.Widget.Resize
+ Reflex.Dom.Xhr
+ Reflex.Dom.Xhr.FormData
+
+ hs-source-dirs: src
other-modules:
- Reflex.Dom.Builder.Class.TH
+ Foreign.JavaScript.Internal.Utils
+ Reflex.Dom.WebSocket.Foreign
+ Reflex.Dom.Xhr.Foreign
+ Reflex.Dom.Xhr.ResponseType
+ Reflex.Dom.Xhr.Exception
+
+ default-language: Haskell98
+ ghc-options:
+ -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
+ -fspecialise-aggressively
+
+ ghc-prof-options: -fprof-auto
+ build-depends:
+ aeson >=0.8 && <2.3,
+ base >=4.7 && <4.21,
+ bifunctors >=4.2 && <6,
+ bimap >=0.3 && <0.6,
+ blaze-builder >=0.4.1 && <0.5,
+ bytestring >=0.10 && <0.13,
+ case-insensitive <1.3,
+ commutative-semigroups >=0.1 && <0.3,
+ containers >=0.6 && <0.8,
+ constraints >=0.9 && <0.15,
+ contravariant >=1.4 && <1.6,
+ data-default >=0.5 && <0.8,
+ dependent-map >=0.3 && <0.5,
+ dependent-sum >=0.6 && <0.8,
+ dependent-sum-template >=0.2 && <0.3,
+ directory >=1.2 && <1.4,
+ exception-transformers >=0.4 && <0.5,
+ ghcjs-dom >=0.9.1.0 && <0.10,
+ jsaddle >=0.9.0.0 && <0.10,
+ keycode >=0.2.1 && <0.3,
+ lens >=4.7 && <5.4,
+ monad-control >=1.0.1 && <1.1,
+ mtl >=2.1 && <2.4,
+ primitive >=0.5 && <0.10,
+ random >=1.1 && <1.3,
+ ref-tf >=0.4 && <0.6,
+ reflex >=0.8.2.1 && <1,
+ semigroups >=0.16 && <0.21,
+ stm >=2.4 && <2.6,
+ text >=1.2 && <2.2,
+ transformers >=0.3 && <0.7,
+ network-uri >=2.6.1 && <2.7,
+ zenc >=0.1 && <0.2
+
+ if (impl(ghcjs >=0) || arch(javascript))
+ hs-source-dirs: src-ghcjs
+ build-depends:
+ ghcjs-base,
+ hashable >=1.2 && <1.5
+
+ else
+ hs-source-dirs: src-ghc
+
+ if !os(windows)
+ build-depends: unix >=2.7 && <2.9
+
+ if flag(split-these)
+ build-depends:
+ semialign >=1 && <1.4,
+ these >=1 && <1.3
+
+ else
+ build-depends: these >=0.4 && <1.0
+
+ if flag(expose-all-unfoldings)
+ ghc-options: -fexpose-all-unfoldings
+
+ if flag(use-reflex-optimizer)
+ ghc-options: -fplugin=Reflex.Optimizer
+
+ if flag(profile-reflex)
+ cpp-options: -DPROFILE_REFLEX
+
+ if flag(use-template-haskell)
+ cpp-options: -DUSE_TEMPLATE_HASKELL
+ other-modules: Reflex.Dom.Builder.Class.TH
+ other-extensions: TemplateHaskell
+ build-depends:
+ dependent-sum-template >=0.1 && <0.3,
+ template-haskell >=2.12.0 && <2.23
test-suite hlint
- build-depends:
- base,
- hlint >= 2.0 && < 4.0
- hs-source-dirs: test
- main-is: hlint.hs
- type: exitcode-stdio-1.0
- default-language: Haskell98
+ type: exitcode-stdio-1.0
+ main-is: hlint.hs
+ hs-source-dirs: test
+ default-language: Haskell98
+ build-depends:
+ base,
+ hlint >=2.0 && <4.0
+
+ if arch(javascript)
+ buildable: False
test-suite hydration
- build-depends: base
- , aeson
- , async
- , bytestring
- , chrome-test-utils
- , constraints
- , constraints-extras
- , containers
- , dependent-map
- , dependent-sum
- , dependent-sum-template
- , directory
- , exceptions
- , filepath
- , ghcjs-dom
- , hspec
- , hspec-core
- , hspec-webdriver
- , http-types
- , HUnit
- , jsaddle
- , jsaddle-warp
- , lens
- , lifted-base
- , network
- , random
- , ref-tf
- , reflex
- , reflex-dom-core
- , process
- , silently
- , temporary
- , text
- , wai
- , wai-websockets
- , warp
- , webdriver
- , websockets
- , which
- hs-source-dirs: test
- ghc-options: -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
- ghc-prof-options: -fprof-auto -optP-DPROFILING
- main-is: hydration.hs
- type: exitcode-stdio-1.0
- default-language: Haskell98
- if !os(linux) || !arch(x86_64) || flag(profile-reflex) || !flag(hydration-tests)
- buildable: False
-
--- broken test on base 4.11 & ghc 8.4.3
--- needs to be updated for changes in GHC.Stats
+ type: exitcode-stdio-1.0
+ main-is: hydration.hs
+ hs-source-dirs: test
+ default-language: Haskell98
+ ghc-options:
+ -rtsopts "-with-rtsopts=-T -V0" -Wall -fwarn-tabs
+ -funbox-strict-fields -O2 -ferror-spans
+
+ ghc-prof-options: -fprof-auto -optP-DPROFILING
+ build-depends:
+ base,
+ aeson <2.3,
+ async <2.3,
+ bytestring,
+ chrome-test-utils,
+ constraints <0.15,
+ constraints-extras <0.5,
+ containers <0.7,
+ dependent-map <0.5,
+ dependent-sum <0.8,
+ dependent-sum-template <0.3,
+ directory,
+ exceptions,
+ filepath,
+ ghcjs-dom <0.10,
+ hspec <2.12,
+ hspec-core <2.12,
+ hspec-webdriver <1.3,
+ http-types <0.13,
+ HUnit <1.7,
+ jsaddle <0.10,
+ jsaddle-warp <0.10,
+ lens <5.4,
+ lifted-base <0.3,
+ network <3.3,
+ random <1.3,
+ ref-tf <0.6,
+ reflex <0.10,
+ reflex-dom-core,
+ process,
+ silently <1.3,
+ temporary <1.4,
+ text <2.2,
+ wai <3.3,
+ wai-websockets <3.1,
+ warp <3.5,
+ webdriver <0.13,
+ websockets <0.14,
+ which <0.3
+
+ if (((!os(linux) || !arch(x86_64)) || flag(profile-reflex)) || !flag(hydration-tests))
+ buildable: False
+
test-suite gc
- build-depends: base
- , chrome-test-utils
- , jsaddle
- , jsaddle-warp
- , process
- , reflex
- , reflex-dom-core
- , text
- hs-source-dirs: test
- ghc-options: -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
- ghc-prof-options: -fprof-auto -optP-DPROFILING
- main-is: gc.hs
- type: exitcode-stdio-1.0
- default-language: Haskell98
- if !os(linux) || !arch(x86_64) || !flag(gc-tests)
- buildable: False
+ type: exitcode-stdio-1.0
+ main-is: gc.hs
+ hs-source-dirs: test
+ default-language: Haskell98
+ ghc-options:
+ -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields
+ -O2 -ferror-spans
-source-repository head
- type: git
- location: https://github.com/reflex-frp/reflex-dom
- subdir: reflex-dom-core
+ ghc-prof-options: -fprof-auto -optP-DPROFILING
+ build-depends:
+ base,
+ chrome-test-utils,
+ jsaddle <0.10,
+ jsaddle-warp <0.10,
+ process,
+ reflex <0.10,
+ reflex-dom-core,
+ text <2.2
+
+ if ((!os(linux) || !arch(x86_64)) || !flag(gc-tests))
+ buildable: False
diff --git a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs
index 73d7a886..8bdd7adb 100644
--- a/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs
+++ b/reflex-dom-core/src-ghcjs/Foreign/JavaScript/Internal/Utils.hs
@@ -1,5 +1,8 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE ForeignFunctionInterface #-}
+#ifdef __GHCJS__
{-# LANGUAGE JavaScriptFFI #-}
+#endif
module Foreign.JavaScript.Internal.Utils
( synchronously
@@ -9,7 +12,11 @@ module Foreign.JavaScript.Internal.Utils
import GHCJS.Concurrent
import GHCJS.DOM.Types (JSM, JSVal, RequestAnimationFrameCallback (..))
+#ifdef __GHCJS__
import GHCJS.Foreign.Callback (releaseCallback)
+#else
+import GHC.JS.Foreign.Callback (releaseCallback)
+#endif
freeRequestAnimationFrameCallback :: RequestAnimationFrameCallback -> JSM ()
freeRequestAnimationFrameCallback (RequestAnimationFrameCallback cb) = releaseCallback cb
diff --git a/reflex-dom-core/src/Foreign/JavaScript/TH.hs b/reflex-dom-core/src/Foreign/JavaScript/TH.hs
index 602bd421..c5c2d004 100644
--- a/reflex-dom-core/src/Foreign/JavaScript/TH.hs
+++ b/reflex-dom-core/src/Foreign/JavaScript/TH.hs
@@ -10,13 +10,17 @@
{-# LANGUAGE UndecidableInstances #-}
#ifdef ghcjs_HOST_OS
{-# LANGUAGE ForeignFunctionInterface #-}
+#ifdef __GHCJS__
{-# LANGUAGE JavaScriptFFI #-}
#endif
-module Foreign.JavaScript.TH ( module Foreign.JavaScript.TH
+#endif
+
+module Foreign.JavaScript.TH
+ ( module Foreign.JavaScript.TH
#ifdef USE_TEMPLATE_HASKELL
- , Safety (..)
+ , Safety (..)
#endif
- ) where
+ ) where
import Foreign.JavaScript.Orphans ()
import Prelude hiding ((!!))
@@ -31,8 +35,9 @@ import Language.Haskell.TH
import GHCJS.DOM.Types (JSContextRef, askJSM)
#ifdef ghcjs_HOST_OS
-import qualified GHCJS.Buffer as JS
import GHCJS.DOM.Types (MonadJSM)
+#ifdef __GHCJS__
+import qualified GHCJS.Buffer as JS
import qualified GHCJS.DOM.Types as JS
import qualified GHCJS.Foreign as JS
import qualified GHCJS.Foreign.Callback as JS
@@ -48,6 +53,8 @@ import Data.Word
import Foreign.C.Types
import Foreign.Ptr
import Text.Encoding.Z
+#endif
+
#else
import GHCJS.DOM.Types (MonadJSM (..), runJSM)
#endif
diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs
index c75eb501..ebef16b3 100644
--- a/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class.hs
@@ -22,42 +22,29 @@
{-# LANGUAGE TemplateHaskell #-}
#endif
{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
-module Reflex.Dom.Builder.Class
- ( module Reflex.Dom.Builder.Class
- , module Reflex.Dom.Builder.Class.Events
- , module Reflex.NotReady.Class
- ) where
-import Reflex.Adjustable.Class
-import Reflex.Class as Reflex
-import Reflex.Dom.Builder.Class.Events
-#ifdef USE_TEMPLATE_HASKELL
-import Reflex.Dom.Builder.Class.TH
-#endif
-import Reflex.BehaviorWriter.Base
-import Reflex.DynamicWriter.Base
-import Reflex.EventWriter.Base
-import Reflex.NotReady.Class
-import Reflex.PerformEvent.Class
-import Reflex.PostBuild.Base
-import Reflex.Query.Base
-import Reflex.Query.Class
-import Reflex.Requester.Base
+module Reflex.Dom.Builder.Class
+ ( module Reflex.Dom.Builder.Class
+ , module Reflex.Dom.Builder.Class.Events
+ , module Reflex.NotReady.Class
+ ) where
import qualified Control.Category
import Control.Lens hiding (element)
+import Control.Monad.Fix
import Control.Monad.Reader
import qualified Control.Monad.State as Lazy
import Control.Monad.State.Strict
import Control.Monad.Trans.Control
import Data.Default
import Data.Functor.Misc
+import Data.Kind (Type)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
import Data.Proxy
-import Data.Semigroup
import Data.Semigroup.Commutative
import Data.String
import Data.Text (Text)
@@ -65,21 +52,41 @@ import Data.Type.Coercion
import GHCJS.DOM.Types (JSM)
import qualified GHCJS.DOM.Types as DOM
+#if !MIN_VERSION_base(4,18,0)
+import Data.Semigroup
+#endif
+
+import Reflex.Adjustable.Class
+import Reflex.Class as Reflex
+import Reflex.Dom.Builder.Class.Events
+#ifdef USE_TEMPLATE_HASKELL
+import Reflex.Dom.Builder.Class.TH
+#endif
+import Reflex.BehaviorWriter.Base
+import Reflex.DynamicWriter.Base
+import Reflex.EventWriter.Base
+import Reflex.NotReady.Class
+import Reflex.PerformEvent.Class
+import Reflex.PostBuild.Base
+import Reflex.Query.Base
+import Reflex.Query.Class
+import Reflex.Requester.Base
+
class Default (EventSpec d EventResult) => DomSpace d where
- type EventSpec d :: (EventTag -> *) -> *
- type RawDocument d :: *
- type RawTextNode d :: *
- type RawCommentNode d :: *
- type RawElement d :: *
- type RawInputElement d :: *
- type RawTextAreaElement d :: *
- type RawSelectElement d :: *
+ type EventSpec d :: (EventTag -> Type) -> Type
+ type RawDocument d :: Type
+ type RawTextNode d :: Type
+ type RawCommentNode d :: Type
+ type RawElement d :: Type
+ type RawInputElement d :: Type
+ type RawTextAreaElement d :: Type
+ type RawSelectElement d :: Type
addEventSpecFlags :: proxy d -> EventName en -> (Maybe (er en) -> EventFlags) -> EventSpec d er -> EventSpec d er
-- | @'DomBuilder' t m@ indicates that @m@ is a 'Monad' capable of building
-- dynamic DOM in the 'Reflex' timeline @t@
class (Monad m, Reflex t, DomSpace (DomBuilderSpace m), NotReady t m, Adjustable t m) => DomBuilder t m | m -> t where
- type DomBuilderSpace m :: *
+ type DomBuilderSpace m :: Type
textNode :: TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t)
default textNode :: ( MonadTrans f
, m ~ f m'
@@ -159,7 +166,7 @@ class (Monad m, Reflex t, DomSpace (DomBuilderSpace m), NotReady t m, Adjustable
{-# INLINABLE wrapRawElement #-}
class DomBuilder t m => MountableDomBuilder t m where
- type DomFragment m :: *
+ type DomFragment m :: Type
buildDomFragment :: m a -> m (DomFragment m, a)
mountDomFragment :: DomFragment m -> Event t (DomFragment m) -> m ()
@@ -307,6 +314,15 @@ inputElementConfig_elementConfig f (InputElementConfig a b c d e) = (\e' -> Inpu
{-# INLINE inputElementConfig_elementConfig #-}
#endif
+instance (Reflex t, er ~ EventResult, DomSpace s) => Default (ElementConfig er t s) where
+ {-# INLINABLE def #-}
+ def = ElementConfig
+ { _elementConfig_namespace = Nothing
+ , _elementConfig_initialAttributes = mempty
+ , _elementConfig_modifyAttributes = Nothing
+ , _elementConfig_eventSpec = def
+ }
+
instance (Reflex t, er ~ EventResult, DomSpace s) => Default (InputElementConfig er t s) where
{-# INLINABLE def #-}
def = InputElementConfig
@@ -542,15 +558,6 @@ instance HasNamespace (ElementConfig er t m) where
{-# INLINABLE namespace #-}
namespace = elementConfig_namespace
-instance (Reflex t, er ~ EventResult, DomSpace s) => Default (ElementConfig er t s) where
- {-# INLINABLE def #-}
- def = ElementConfig
- { _elementConfig_namespace = Nothing
- , _elementConfig_initialAttributes = mempty
- , _elementConfig_modifyAttributes = Nothing
- , _elementConfig_eventSpec = def
- }
-
instance (DomBuilder t m, PerformEvent t m, MonadFix m, MonadHold t m) => DomBuilder t (PostBuildT t m) where
type DomBuilderSpace (PostBuildT t m) = DomBuilderSpace m
wrapRawElement e = lift . wrapRawElement e
@@ -641,7 +648,7 @@ instance (DomBuilder t m, MonadFix m, MonadHold t m, Group q, Query q, Commutati
-- * Convenience functions
class HasDomEvent t target eventName | target -> t where
- type DomEventType target eventName :: *
+ type DomEventType target eventName :: Type
domEvent :: EventName eventName -> target -> Event t (DomEventType target eventName)
instance Reflex t => HasDomEvent t (Element EventResult d t) en where
@@ -748,9 +755,9 @@ instance HasDocument m => HasDocument (RequesterT t request response m)
instance HasDocument m => HasDocument (QueryT t q m)
class HasSetValue a where
- type SetValue a :: *
+ type SetValue a :: Type
setValue :: Lens' a (SetValue a)
-
+
instance Reflex t => HasSetValue (TextAreaElementConfig er t m) where
type SetValue (TextAreaElementConfig er t m) = Event t Text
setValue = textAreaElementConfig_setValue
diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs
index 84085b3a..05721ad9 100644
--- a/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs
@@ -6,6 +6,7 @@
{-# LANGUAGE TemplateHaskell #-}
#endif
{-# LANGUAGE TypeFamilies #-}
+
module Reflex.Dom.Builder.Class.Events where
#ifdef USE_TEMPLATE_HASKELL
@@ -15,6 +16,7 @@ import Data.Type.Equality ((:~:)(..))
import Data.GADT.Compare
(GOrdering(..), GEq(..), GCompare(..))
#endif
+import Data.Kind (Type)
import Data.Text (Text)
data EventTag
@@ -65,7 +67,7 @@ data EventTag
| TouchendTag
| TouchcancelTag
-data EventName :: EventTag -> * where
+data EventName :: EventTag -> Type where
Abort :: EventName 'AbortTag
Blur :: EventName 'BlurTag
Change :: EventName 'ChangeTag
@@ -115,7 +117,7 @@ data EventName :: EventTag -> * where
newtype EventResult en = EventResult { unEventResult :: EventResultType en }
-type family EventResultType (en :: EventTag) :: * where
+type family EventResultType (en :: EventTag) :: Type where
EventResultType 'ClickTag = ()
EventResultType 'DblclickTag = (Int, Int)
EventResultType 'KeypressTag = Word
diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs
index f864a756..32bcb62b 100644
--- a/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs
@@ -6,6 +6,7 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
+
module Reflex.Dom.Builder.Hydratable where
import Control.Monad.Fix
@@ -18,9 +19,10 @@ import qualified Data.Map as Map
#ifndef ghcjs_HOST_OS
import GHCJS.DOM.Types (MonadJSM (..))
#endif
+
import Reflex
import Reflex.Dom.Builder.Class
-import Reflex.Dom.Builder.Immediate (HasDocument (..), hydratableAttribute)
+import Reflex.Dom.Builder.Immediate (hydratableAttribute)
import Reflex.Host.Class
-- | A DomBuilder transformer that adds an attribute to all elements such that the
diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs
index fce08d03..2b715e4c 100644
--- a/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs
@@ -25,8 +25,11 @@
{-# LANGUAGE UndecidableInstances #-}
#ifdef ghcjs_HOST_OS
{-# LANGUAGE ForeignFunctionInterface #-}
+#ifdef __GHCJS__
{-# LANGUAGE JavaScriptFFI #-}
#endif
+#endif
+
-- | This is a builder to be used on the client side. It can be run in two modes:
--
-- 1. in "hydration mode", reusing DOM nodes already in the page (as produced
@@ -120,7 +123,9 @@ module Reflex.Dom.Builder.Immediate
import Control.Concurrent
import Control.Exception (bracketOnError)
import Control.Lens (Identity(..), imapM_, iforM_, (^.), makeLenses)
+import Control.Monad
import Control.Monad.Exception
+import Control.Monad.Fix
import Control.Monad.Primitive
import Control.Monad.Reader
import Control.Monad.Ref
@@ -129,7 +134,6 @@ import Data.Bitraversable
import Data.Default
import Data.Dependent.Map (DMap)
import Data.Dependent.Sum
-import Data.FastMutableIntMap (PatchIntMap (..))
import Data.Foldable (for_, traverse_)
import Data.Functor.Compose
import Data.Functor.Constant
@@ -138,8 +142,8 @@ import Data.Functor.Product
import Data.GADT.Compare (GCompare)
import Data.IORef
import Data.IntMap.Strict (IntMap)
+import Data.Kind (Type)
import Data.Maybe
-import Data.Monoid ((<>))
import Data.Some (Some(..))
import Data.String (IsString)
import Data.Text (Text)
@@ -152,30 +156,11 @@ import GHCJS.DOM.EventM (EventM, event, on)
import GHCJS.DOM.KeyboardEvent as KeyboardEvent
import GHCJS.DOM.MouseEvent
import GHCJS.DOM.Node (appendChild_, getOwnerDocumentUnchecked, getParentNodeUnchecked, setNodeValue, toNode)
-import GHCJS.DOM.Types (liftJSM, askJSM, runJSM, JSM, MonadJSM, FocusEvent, IsElement, IsEvent, IsNode, KeyboardEvent, Node, TouchEvent, WheelEvent, uncheckedCastTo, ClipboardEvent)
+import GHCJS.DOM.Types (liftJSM, askJSM, runJSM, JSM, MonadJSM, FocusEvent, IsElement, IsEvent, IsNode, Node, TouchEvent, WheelEvent, uncheckedCastTo)
import GHCJS.DOM.UIEvent
#ifndef ghcjs_HOST_OS
import Language.Javascript.JSaddle (call, eval) -- Avoid using eval in ghcjs. Use ffi instead
#endif
-import Reflex.Adjustable.Class
-import Reflex.Class as Reflex
-import Reflex.Dom.Builder.Class
-import Reflex.Dynamic
-import Reflex.Host.Class
-import Reflex.Patch.DMapWithMove (PatchDMapWithMove(..))
-import Reflex.Patch.MapWithMove (PatchMapWithMove(..))
-import Reflex.PerformEvent.Base (PerformEventT)
-import Reflex.PerformEvent.Class
-import Reflex.PostBuild.Base (PostBuildT)
-import Reflex.PostBuild.Class
-#ifdef PROFILE_REFLEX
-import Reflex.Profiled
-#endif
-import Reflex.Requester.Base
-import Reflex.Requester.Class
-import Reflex.Spider (Spider, SpiderHost, Global)
-import Reflex.TriggerEvent.Base hiding (askEvents)
-import Reflex.TriggerEvent.Class
import qualified Data.Dependent.Map as DMap
import qualified Data.FastMutableIntMap as FastMutableIntMap
@@ -202,6 +187,31 @@ import qualified GHCJS.DOM.TouchList as TouchList
import qualified GHCJS.DOM.Types as DOM
import qualified GHCJS.DOM.Window as Window
import qualified GHCJS.DOM.WheelEvent as WheelEvent
+
+#if !MIN_VERSION_base(4,18,0)
+import Data.FastMutableIntMap (PatchIntMap (..))
+import Data.Monoid ((<>))
+import GHCJS.DOM.Types (KeyboardEvent, ClipboardEvent)
+#endif
+
+import Reflex.Adjustable.Class
+import Reflex.Class as Reflex
+import Reflex.Dom.Builder.Class
+import Reflex.Dynamic
+import Reflex.Host.Class
+import Reflex.Patch.MapWithMove (PatchMapWithMove(..))
+import Reflex.PerformEvent.Base (PerformEventT)
+import Reflex.PerformEvent.Class
+import Reflex.PostBuild.Base (PostBuildT)
+import Reflex.PostBuild.Class
+#ifdef PROFILE_REFLEX
+import Reflex.Profiled
+#endif
+import Reflex.Requester.Base
+import Reflex.Requester.Class
+import Reflex.Spider (Spider, SpiderHost, Global)
+import Reflex.TriggerEvent.Base hiding (askEvents)
+import Reflex.TriggerEvent.Class
import qualified Reflex.Patch.DMap as PatchDMap
import qualified Reflex.Patch.DMapWithMove as PatchDMapWithMove
import qualified Reflex.Patch.MapWithMove as PatchMapWithMove
@@ -464,7 +474,11 @@ removeSubsequentNodes :: (MonadJSM m, IsNode n) => n -> m ()
#ifdef ghcjs_HOST_OS
--NOTE: Although wrapping this javascript in a function seems unnecessary, GHCJS's optimizer will break it if it is entered without that wrapping (as of 2021-11-06)
foreign import javascript unsafe
+#ifdef __GHCJS__
"(function() { var n = $1; while (n['nextSibling']) { n['parentNode']['removeChild'](n['nextSibling']); }; })()"
+#else
+ "(function(n) { while (n['nextSibling']) { n['parentNode']['removeChild'](n['nextSibling']); }; })"
+#endif
removeSubsequentNodes_ :: DOM.Node -> IO ()
removeSubsequentNodes n = liftJSM $ removeSubsequentNodes_ (toNode n)
#else
@@ -487,7 +501,11 @@ extractBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => DOM.Documen
#ifdef ghcjs_HOST_OS
--NOTE: Although wrapping this javascript in a function seems unnecessary, GHCJS's optimizer will break it if it is entered without that wrapping (as of 2021-11-06)
foreign import javascript unsafe
+#ifdef __GHCJS__
"(function() { var df = $1; var s = $2; var e = $3; var x; for(;;) { x = s['nextSibling']; if(e===x) { break; }; df['appendChild'](x); } })()"
+#else
+ "(function(df, s, e) { var x; for(;;) { x = s['nextSibling']; if(e===x) { break; }; df['appendChild'](x); } })"
+#endif
extractBetweenExclusive_ :: DOM.DocumentFragment -> DOM.Node -> DOM.Node -> IO ()
extractBetweenExclusive df s e = liftJSM $ extractBetweenExclusive_ df (toNode s) (toNode e)
#else
@@ -508,7 +526,11 @@ extractUpTo :: (MonadJSM m, IsNode start, IsNode end) => DOM.DocumentFragment ->
#ifdef ghcjs_HOST_OS
--NOTE: Although wrapping this javascript in a function seems unnecessary, GHCJS's optimizer will break it if it is entered without that wrapping (as of 2017-09-04)
foreign import javascript unsafe
+#ifdef __GHCJS__
"(function() { var x = $2; while(x !== $3) { var y = x['nextSibling']; $1['appendChild'](x); x = y; } })()"
+#else
+ "(function($1, x, $3) { while(x !== $3) { var y = x['nextSibling']; $1['appendChild'](x); x = y; } })"
+#endif
extractUpTo_ :: DOM.DocumentFragment -> DOM.Node -> DOM.Node -> IO ()
extractUpTo df s e = liftJSM $ extractUpTo_ df (toNode s) (toNode e)
#else
@@ -662,7 +684,7 @@ instance DomSpace GhcjsDomSpace where
newtype GhcjsEventFilter er en = GhcjsEventFilter (GhcjsDomEvent en -> JSM (EventFlags, JSM (Maybe (er en))))
-data Pair1 (f :: k -> *) (g :: k -> *) (a :: k) = Pair1 (f a) (g a)
+data Pair1 (f :: k -> Type) (g :: k -> Type) (a :: k) = Pair1 (f a) (g a)
data Maybe1 f a = Nothing1 | Just1 (f a)
@@ -1689,7 +1711,7 @@ instance (Adjustable t m, MonadJSM m, MonadHold t m, MonadFix m, PrimMonad m, Ra
{-# INLINABLE traverseDMapWithKeyWithAdjust' #-}
traverseDMapWithKeyWithAdjust'
- :: forall s t m (k :: * -> *) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document)
+ :: forall s t m (k :: Type -> Type) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document)
=> (forall a. k a -> v a -> HydrationDomBuilderT s t m (v' a))
-> DMap k v
-> Event t (PatchDMap k v)
diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs b/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs
index 2bc8b50e..4ab6987d 100644
--- a/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Builder/InputDisabled.hs
@@ -6,6 +6,7 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
+
module Reflex.Dom.Builder.InputDisabled where
import Control.Monad.Fix
@@ -20,7 +21,6 @@ import GHCJS.DOM.Types (MonadJSM (..))
#endif
import Reflex
import Reflex.Dom.Builder.Class
-import Reflex.Dom.Builder.Immediate (HasDocument (..))
import Reflex.Host.Class
-- | A DomBuilder transformer that disables all 'inputElement's,
diff --git a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs
index 140c25ae..2835667a 100644
--- a/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Builder/Static.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
@@ -13,13 +14,15 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
+
module Reflex.Dom.Builder.Static where
import Data.IORef (IORef)
import Blaze.ByteString.Builder.Html.Utf8
import Control.Lens hiding (element)
+import Control.Monad
import Control.Monad.Exception
-import Control.Monad.Identity
+import Control.Monad.Fix
import Control.Monad.Primitive
import Control.Monad.Ref
import Control.Monad.State.Strict
@@ -35,16 +38,22 @@ import Data.Functor.Compose
import Data.Functor.Constant
import Data.IntMap (IntMap)
import qualified Data.IntMap as IntMap
+import Data.Kind (Type)
import qualified Data.Map as Map
import Data.Map.Misc (applyMap)
import Data.Maybe (fromMaybe)
-import Data.Monoid ((<>))
import qualified Data.Set as Set
import Data.Text (Text)
import qualified Data.Text as T
import Data.Text.Encoding
import Data.Tuple
import GHC.Generics
+
+#if !MIN_VERSION_base(4,18,0)
+import Control.Monad.Identity
+import Data.Monoid ((<>))
+#endif
+
import Reflex.Adjustable.Class
import Reflex.Class
import Reflex.Dom.Main (DomHost, DomTimeline, runDomHost)
@@ -144,7 +153,7 @@ data StaticDomEvent (a :: k)
-- | Static documents don't process events, so all handlers are equivalent
data StaticDomHandler (a :: k) (b :: k) = StaticDomHandler
-data StaticEventSpec (er :: EventTag -> *) = StaticEventSpec deriving (Generic)
+data StaticEventSpec (er :: EventTag -> Type) = StaticEventSpec deriving (Generic)
instance Default (StaticEventSpec er)
@@ -219,7 +228,7 @@ hoistIntMapWithKeyWithAdjust base f im0 im' = do
sample o
return (result0, result')
-hoistDMapWithKeyWithAdjust :: forall (k :: * -> *) v v' t m p.
+hoistDMapWithKeyWithAdjust :: forall (k :: Type -> Type) v v' t m p.
( Adjustable t m
, MonadHold t m
, PatchTarget (p k (Constant (Behavior t Builder))) ~ DMap k (Constant (Behavior t Builder))
diff --git a/reflex-dom-core/src/Reflex/Dom/Class.hs b/reflex-dom-core/src/Reflex/Dom/Class.hs
index f774b69b..97452eb5 100644
--- a/reflex-dom-core/src/Reflex/Dom/Class.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Class.hs
@@ -1,8 +1,10 @@
{-# LANGUAGE MultiParamTypeClasses #-}
-module Reflex.Dom.Class ( module Reflex.Dom.Class
- , module Foreign.JavaScript.TH
- , module Web.KeyCode
- ) where
+
+module Reflex.Dom.Class
+ ( module Reflex.Dom.Class
+ , module Foreign.JavaScript.TH
+ , module Web.KeyCode
+ ) where
import Control.Lens
import Reflex.Class
diff --git a/reflex-dom-core/src/Reflex/Dom/Core.hs b/reflex-dom-core/src/Reflex/Dom/Core.hs
index eb0b24c1..6a414b6a 100644
--- a/reflex-dom-core/src/Reflex/Dom/Core.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Core.hs
@@ -2,6 +2,7 @@
-- reexporting on ghc > 8.2.
-- https://github.com/haskell/haddock/issues/979
{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-}
+
module Reflex.Dom.Core (module X) where
import Reflex as X hiding (askEvents)
diff --git a/reflex-dom-core/src/Reflex/Dom/Location.hs b/reflex-dom-core/src/Reflex/Dom/Location.hs
index 2408f870..7f68d83e 100644
--- a/reflex-dom-core/src/Reflex/Dom/Location.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Location.hs
@@ -1,8 +1,10 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
+
module Reflex.Dom.Location
( browserHistoryWith
, getLocationAfterHost
@@ -21,14 +23,10 @@ module Reflex.Dom.Location
, popHistoryState
) where
-import Reflex
-import Reflex.Dom.Builder.Immediate (wrapDomEvent)
-
import Control.Lens ((^.))
import Control.Monad ((>=>))
import Control.Monad.Fix (MonadFix)
import Data.Align (align)
-import Data.Monoid
import Data.Text (Text)
import Data.These (These(..))
import qualified GHCJS.DOM as DOM
@@ -43,6 +41,13 @@ import qualified GHCJS.DOM.WindowEventHandlers as DOM
import Language.Javascript.JSaddle (FromJSString, MonadJSM, ToJSString, fromJSValUnchecked, js1, ToJSVal (..), FromJSVal (..))
import Network.URI
+#if !MIN_VERSION_base(4,18,0)
+import Data.Monoid
+#endif
+
+import Reflex
+import Reflex.Dom.Builder.Immediate (wrapDomEvent)
+
withLocation :: (MonadJSM m) => (Location -> m a) -> m a
withLocation f = DOM.currentWindowUnchecked >>= Window.getLocation >>= f
diff --git a/reflex-dom-core/src/Reflex/Dom/Main.hs b/reflex-dom-core/src/Reflex/Dom/Main.hs
index 24219c77..3345fba8 100644
--- a/reflex-dom-core/src/Reflex/Dom/Main.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Main.hs
@@ -12,35 +12,25 @@
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fspecialise-aggressively #-}
+
module Reflex.Dom.Main where
import Prelude hiding (concat, mapM, mapM_, sequence, sequence_)
-import Reflex.Adjustable.Class
-import Reflex.Class
-import Reflex.Dom.Builder.Immediate
-import Reflex.Dom.Class
-import Reflex.Host.Class
-import Reflex.PerformEvent.Base
-import Reflex.PostBuild.Base
-import Reflex.Spider (Global, Spider, SpiderHost, runSpiderHost)
-import Reflex.TriggerEvent.Base
-import Reflex.TriggerEvent.Class
-#ifdef PROFILE_REFLEX
-import Reflex.Profiled
-#endif
-
import Control.Concurrent
import Control.Lens
import Control.Monad
+#if MIN_VERSION_base(4,18,0)
+import Control.Monad.Reader
+#else
import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_)
+#endif
import Control.Monad.Ref
import Data.ByteString (ByteString)
import Data.Dependent.Sum (DSum (..))
import Data.Foldable (for_)
import Data.IORef
import Data.Maybe
-import Data.Monoid ((<>))
import Data.Text (Text)
import qualified Data.Text as T
import Data.Text.Encoding
@@ -52,13 +42,27 @@ import GHCJS.DOM.NonElementParentNode
import GHCJS.DOM.Types (JSM)
import qualified GHCJS.DOM.Types as DOM
+#if !MIN_VERSION_base(4,18,0)
+import Data.Monoid ((<>))
+#endif
+
+import Reflex.Adjustable.Class
+import Reflex.Class
+import Reflex.Dom.Builder.Immediate
+import Reflex.Dom.Class
+import Reflex.Host.Class
+import Reflex.PerformEvent.Base
+import Reflex.PostBuild.Base
+import Reflex.Spider (Global, Spider, SpiderHost, runSpiderHost)
+import Reflex.TriggerEvent.Base
+import Reflex.TriggerEvent.Class
#ifdef PROFILE_REFLEX
import Reflex.Profiled
#endif
{-# INLINE mainHydrationWidgetWithHead #-}
mainHydrationWidgetWithHead :: (forall x. HydrationWidget x ()) -> (forall x. HydrationWidget x ()) -> JSM ()
-mainHydrationWidgetWithHead = mainHydrationWidgetWithHead'
+mainHydrationWidgetWithHead head' body = mainHydrationWidgetWithHead' head' body
{-# INLINABLE mainHydrationWidgetWithHead' #-}
-- | Warning: `mainHydrationWidgetWithHead'` is provided only as performance tweak. It is expected to disappear in future releases.
@@ -67,7 +71,7 @@ mainHydrationWidgetWithHead' = mainHydrationWidgetWithSwitchoverAction' (pure ()
{-# INLINE mainHydrationWidgetWithSwitchoverAction #-}
mainHydrationWidgetWithSwitchoverAction :: JSM () -> (forall x. HydrationWidget x ()) -> (forall x. HydrationWidget x ()) -> JSM ()
-mainHydrationWidgetWithSwitchoverAction = mainHydrationWidgetWithSwitchoverAction'
+mainHydrationWidgetWithSwitchoverAction switchoverAction head' body = mainHydrationWidgetWithSwitchoverAction' switchoverAction head' body
{-# INLINABLE mainHydrationWidgetWithSwitchoverAction' #-}
-- | Warning: `mainHydrationWidgetWithSwitchoverAction'` is provided only as performance tweak. It is expected to disappear in future releases.
@@ -187,7 +191,7 @@ runHydrationWidgetWithHeadAndBodyWithFailure onFailure switchoverAction app = wi
{-# INLINE mainWidget #-}
mainWidget :: (forall x. Widget x ()) -> JSM ()
-mainWidget = mainWidget'
+mainWidget w = mainWidget' w
{-# INLINABLE mainWidget' #-}
-- | Warning: `mainWidget'` is provided only as performance tweak. It is expected to disappear in future releases.
diff --git a/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs b/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs
index f115e94d..03b0fa28 100644
--- a/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Modals/Class.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE MultiParamTypeClasses #-}
+
module Reflex.Dom.Modals.Class where
import Reflex
diff --git a/reflex-dom-core/src/Reflex/Dom/Old.hs b/reflex-dom-core/src/Reflex/Dom/Old.hs
index aa113979..9b1fa9a7 100644
--- a/reflex-dom-core/src/Reflex/Dom/Old.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Old.hs
@@ -6,43 +6,45 @@
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE LambdaCase #-}
#ifdef USE_TEMPLATE_HASKELL
{-# LANGUAGE TemplateHaskell #-}
#endif
+
module Reflex.Dom.Old
- ( MonadWidget
- , El
- , ElConfig (..)
- , elConfig_namespace
- , elConfig_attributes
- , _el_clicked
- , _el_element
- , _el_events
- , addVoidAction
- , AttributeMap
- , Attributes (..)
- , buildElement
- , buildElementNS
- , buildEmptyElement
- , buildEmptyElementNS
- , elDynHtml'
- , elDynHtmlAttr'
- , elStopPropagationNS
- , elWith
- , elWith'
- , emptyElWith
- , emptyElWith'
- , namedNodeMapGetNames
- , nodeClear
- , onEventName
- , schedulePostBuild
- , text'
- , unsafePlaceElement
- , WidgetHost
- , wrapElement
- ) where
+ ( MonadWidget
+ , El
+ , ElConfig (..)
+ , elConfig_namespace
+ , elConfig_attributes
+ , _el_clicked
+ , _el_element
+ , _el_events
+ , addVoidAction
+ , AttributeMap
+ , Attributes (..)
+ , buildElement
+ , buildElementNS
+ , buildEmptyElement
+ , buildEmptyElementNS
+ , elDynHtml'
+ , elDynHtmlAttr'
+ , elStopPropagationNS
+ , elWith
+ , elWith'
+ , emptyElWith
+ , emptyElWith'
+ , namedNodeMapGetNames
+ , nodeClear
+ , onEventName
+ , schedulePostBuild
+ , text'
+ , unsafePlaceElement
+ , WidgetHost
+ , wrapElement
+ ) where
import Control.Arrow (first)
#ifdef USE_TEMPLATE_HASKELL
diff --git a/reflex-dom-core/src/Reflex/Dom/Prerender.hs b/reflex-dom-core/src/Reflex/Dom/Prerender.hs
index b7e9cbda..702b4587 100644
--- a/reflex-dom-core/src/Reflex/Dom/Prerender.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Prerender.hs
@@ -11,27 +11,41 @@
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
-- | Render the first widget on the server, and the second on the client.
module Reflex.Dom.Prerender
- ( Prerender (..)
- , prerender_
- , PrerenderClientConstraint
- , PrerenderBaseConstraints
- ) where
+ ( Prerender (..)
+ , prerender_
+ , PrerenderClientConstraint
+ , PrerenderBaseConstraints
+ ) where
+import Control.Monad
+import Control.Monad.Fix
import Control.Monad.Primitive (PrimMonad(..))
import Control.Monad.Reader
import Control.Monad.Ref (MonadRef(..), MonadAtomicRef(..))
import Data.IORef (IORef, newIORef)
-import Data.Semigroup (Semigroup)
+import Data.Kind (Type)
import Data.Semigroup.Commutative
import Data.Text (Text)
import Data.Void
+import Data.IntMap.Strict (IntMap)
+import qualified Data.IntMap.Strict as IntMap
+
+#if !MIN_VERSION_base(4,18,0)
+import Data.Semigroup (Semigroup)
import Foreign.JavaScript.TH
+#endif
+
import GHCJS.DOM.Types (MonadJSM)
+import qualified GHCJS.DOM.Document as Document
+import qualified GHCJS.DOM.Node as Node
+import qualified GHCJS.DOM.Types as DOM
+
import Reflex hiding (askEvents)
import Reflex.Dom.Builder.Class
import Reflex.Dom.Builder.Hydratable
@@ -39,12 +53,6 @@ import Reflex.Dom.Builder.Immediate
import Reflex.Dom.Builder.InputDisabled
import Reflex.Dom.Builder.Static
import Reflex.Host.Class
-import Data.IntMap.Strict (IntMap)
-import qualified Data.IntMap.Strict as IntMap
-
-import qualified GHCJS.DOM.Document as Document
-import qualified GHCJS.DOM.Node as Node
-import qualified GHCJS.DOM.Types as DOM
type PrerenderClientConstraint t m =
( DomBuilder t m
@@ -80,7 +88,7 @@ prerender_ server client = void $ prerender server client
class (PrerenderClientConstraint t (Client m), Client (Client m) ~ Client m, Prerender t (Client m)) => Prerender t m | m -> t where
-- | Monad in which the client widget is built
- type Client m :: * -> *
+ type Client m :: Type -> Type
-- | Render the first widget on the server, and the second on the client. The
-- hydration builder will run *both* widgets, updating the result dynamic at
-- switchover time.
diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs
index 13e6fedc..fb9770b5 100644
--- a/reflex-dom-core/src/Reflex/Dom/WebSocket.hs
+++ b/reflex-dom-core/src/Reflex/Dom/WebSocket.hs
@@ -8,7 +8,9 @@
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+#ifdef __GHCJS__
{-# LANGUAGE JavaScriptFFI #-}
+#endif
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
@@ -30,19 +32,16 @@ module Reflex.Dom.WebSocket
import Prelude hiding (all, concat, concatMap, div, mapM, mapM_, sequence, span)
-import Reflex.Class
-import Reflex.Dom.WebSocket.Foreign
-import Reflex.PerformEvent.Class
-import Reflex.PostBuild.Class
-import Reflex.TriggerEvent.Class
-
import Control.Concurrent
import Control.Concurrent.STM
import Control.Exception
import Control.Lens
+#if MIN_VERSION_base(4,18,0)
+import Control.Monad hiding (forM, mapM, mapM_, sequence)
+#else
import Control.Monad hiding (forM, forM_, mapM, mapM_, sequence)
+#endif
import Control.Monad.IO.Class
-import Control.Monad.State
import Data.Aeson
import Data.ByteString (ByteString)
import Data.ByteString.Lazy (toStrict)
@@ -58,6 +57,16 @@ import GHCJS.DOM.WebSocket (getReadyState)
import GHCJS.Marshal
import qualified Language.Javascript.JSaddle.Monad as JS (catch)
+#if !MIN_VERSION_base(4,18,0)
+import Control.Monad.State
+#endif
+
+import Reflex.Class
+import Reflex.Dom.WebSocket.Foreign
+import Reflex.PerformEvent.Class
+import Reflex.PostBuild.Class
+import Reflex.TriggerEvent.Class
+
data WebSocketConfig t a
= WebSocketConfig { _webSocketConfig_send :: Event t [a]
, _webSocketConfig_close :: Event t (Word, Text)
diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs
index 1ad06a2a..753e6c13 100644
--- a/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs
+++ b/reflex-dom-core/src/Reflex/Dom/WebSocket/Foreign.hs
@@ -1,8 +1,10 @@
{-# LANGUAGE CPP #-}
#ifdef ghcjs_HOST_OS
{-# LANGUAGE ForeignFunctionInterface #-}
+#ifdef __GHCJS__
{-# LANGUAGE JavaScriptFFI #-}
#endif
+#endif
{-# LANGUAGE LambdaCase #-}
module Reflex.Dom.WebSocket.Foreign
diff --git a/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs b/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs
index a8c4266a..3c79a0b4 100644
--- a/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs
+++ b/reflex-dom-core/src/Reflex/Dom/WebSocket/Query.hs
@@ -1,6 +1,10 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RecursiveDo #-}
-module Reflex.Dom.WebSocket.Query (cropQueryT, runWebSocketQuery) where
+
+module Reflex.Dom.WebSocket.Query
+ ( cropQueryT
+ , runWebSocketQuery
+ ) where
import Data.Default
import Control.Monad.Fix
diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs
index 66e6d5ab..95ce2f55 100644
--- a/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
@@ -9,6 +10,7 @@
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
+
module Reflex.Dom.Widget.Basic
(
-- * Displaying Values
@@ -60,24 +62,15 @@ module Reflex.Dom.Widget.Basic
, partitionMapBySetLT
) where
-import Reflex.Adjustable.Class
-import Reflex.Class
-import Reflex.Collection
-import Reflex.Dom.Builder.Class
-import Reflex.Dom.Class
-import Reflex.Dynamic
-import Reflex.Network
-import Reflex.PostBuild.Class
-import Reflex.Workflow
+import Prelude hiding (mapM, mapM_, sequence, sequence_)
-import Control.Arrow
import Control.Lens hiding (children, element)
-import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_)
+import Control.Monad.Fix
import Data.Align
import Data.Default
-import Data.Either
import Data.Foldable
import Data.Functor (void)
+import Data.Kind (Type)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Map.Misc
@@ -88,7 +81,22 @@ import Data.Text (Text)
import qualified Data.Text as T
import Data.These
import Data.Traversable
-import Prelude hiding (mapM, mapM_, sequence, sequence_)
+
+#if !MIN_VERSION_base(4,18,0)
+import Control.Arrow
+import Control.Monad.Reader hiding (forM, forM_, mapM, mapM_, sequence, sequence_)
+import Data.Either
+#endif
+
+import Reflex.Adjustable.Class
+import Reflex.Class
+import Reflex.Collection
+import Reflex.Dom.Builder.Class
+import Reflex.Dom.Class
+import Reflex.Dynamic
+import Reflex.Network
+import Reflex.PostBuild.Class
+import Reflex.Workflow
-- | Breaks the given Map into pieces based on the given Set. Each piece will contain only keys that are less than the key of the piece, and greater than or equal to the key of the piece with the next-smaller key. There will be one additional piece containing all keys from the original Map that are larger or equal to the largest key in the Set.
-- Either k () is used instead of Maybe k so that the resulting map of pieces is sorted so that the additional piece has the largest key.
@@ -341,5 +349,5 @@ tabDisplay ulClass activeClass tabItems = do
return $ fmap (const k) (_link_clicked a)
class HasAttributes a where
- type Attrs a :: *
+ type Attrs a :: Type
attributes :: Lens' a (Attrs a)
diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs
index 2c67fcd3..e745b7b8 100644
--- a/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Widget/Input.hs
@@ -13,12 +13,18 @@
{-# LANGUAGE TemplateHaskell #-}
#endif
{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
-module Reflex.Dom.Widget.Input (module Reflex.Dom.Widget.Input, def, (&), (.~)) where
+
+module Reflex.Dom.Widget.Input
+ ( module Reflex.Dom.Widget.Input
+ , def, (&), (.~)
+ ) where
import Prelude
import Control.Lens hiding (element, ix)
+import Control.Monad
import Control.Monad.Fix
import Control.Monad.IO.Class
import Control.Monad.Reader
@@ -27,16 +33,25 @@ import Data.Default
import Data.Dependent.Map (DMap)
import qualified Data.Dependent.Map as DMap
import Data.Functor.Misc
+import Data.Kind (Type)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
-import Data.Semigroup
import Data.Text (Text)
import qualified Data.Text as T
+import qualified Text.Read as T
+
+#if !MIN_VERSION_base(4,18,0)
+import Data.Semigroup
+#endif
+
+import qualified GHCJS.DOM.Event as Event
+import qualified GHCJS.DOM.HTMLInputElement as Input
import GHCJS.DOM.HTMLInputElement (HTMLInputElement)
import GHCJS.DOM.HTMLTextAreaElement (HTMLTextAreaElement)
import GHCJS.DOM.Types (MonadJSM, File, uncheckedCastTo)
import qualified GHCJS.DOM.Types as DOM (HTMLElement(..), EventTarget(..))
+
import Reflex.Class
import Reflex.Collection
import Reflex.Dom.Builder.Class
@@ -46,10 +61,6 @@ import Reflex.Dom.Widget.Basic
import Reflex.Dynamic
import Reflex.PostBuild.Class
import Reflex.TriggerEvent.Class
-import qualified Text.Read as T
-
-import qualified GHCJS.DOM.Event as Event
-import qualified GHCJS.DOM.HTMLInputElement as Input
{-# DEPRECATED TextInput, _textInput_element, TextInputConfig, textInput "Use 'inputElement' directly" #-}
data TextInput t
@@ -232,7 +243,7 @@ checkbox checked config = do
, _checkbox_change = _inputElement_checkedChange i
}
-type family CheckboxViewEventResultType (en :: EventTag) :: * where
+type family CheckboxViewEventResultType (en :: EventTag) :: Type where
CheckboxViewEventResultType 'ClickTag = Bool
CheckboxViewEventResultType t = EventResultType t
@@ -368,7 +379,7 @@ instance Reflex t => Default (DropdownConfig t k) where
, _dropdownConfig_attributes = constDyn mempty
}
-type family DropdownViewEventResultType (en :: EventTag) :: * where
+type family DropdownViewEventResultType (en :: EventTag) :: Type where
DropdownViewEventResultType 'ChangeTag = Text
DropdownViewEventResultType t = EventResultType t
@@ -648,7 +659,7 @@ instance HasSetValue (CheckboxConfig t) where
setValue = checkboxConfig_setValue
class HasValue a where
- type Value a :: *
+ type Value a :: Type
value :: a -> Value a
instance HasValue (InputElement er d t) where
diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs
index dd2aeecb..db67c92d 100644
--- a/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Widget/Lazy.hs
@@ -1,11 +1,27 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+
module Reflex.Dom.Widget.Lazy where
+import Control.Monad.Fix
+import Data.Fixed
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Text (Text)
+import qualified Data.Text as T
+import GHCJS.DOM.Element
+import GHCJS.DOM.Types (MonadJSM)
+
+#if !MIN_VERSION_base(4,18,0)
+import Data.Monoid
+#endif
+
import Reflex.Class
import Reflex.Collection
import Reflex.Dom.Builder.Class
@@ -16,16 +32,6 @@ import Reflex.Dynamic
import Reflex.PerformEvent.Class
import Reflex.PostBuild.Class
-import Control.Monad.Fix
-import Data.Fixed
-import Data.Map (Map)
-import qualified Data.Map as Map
-import Data.Monoid
-import Data.Text (Text)
-import qualified Data.Text as T
-import GHCJS.DOM.Element
-import GHCJS.DOM.Types (MonadJSM)
-
-- |A list view for long lists. Creates a scrollable element and only renders child row elements near the current scroll position.
virtualListWithSelection :: forall t m k v. (DomBuilder t m, PostBuild t m, MonadHold t m, PerformEvent t m, MonadJSM (Performable m), DomBuilderSpace m ~ GhcjsDomSpace, MonadFix m, Ord k, Eq v)
=> Dynamic t Int -- ^ The height of the visible region in pixels
diff --git a/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs b/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs
index f6fd95ed..65b71930 100644
--- a/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Widget/Resize.hs
@@ -1,27 +1,18 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
-module Reflex.Dom.Widget.Resize where
+{-# LANGUAGE TypeOperators #-}
-import Reflex.Class
-import Reflex.Time
-import Reflex.Dom.Builder.Class
-import Reflex.Dom.Builder.Immediate
-import Reflex.Dom.Class
-import Reflex.Dom.Widget.Basic
-import Reflex.PerformEvent.Class
-import Reflex.PostBuild.Class
-import Reflex.TriggerEvent.Class
+module Reflex.Dom.Widget.Resize where
-import Control.Monad
import Control.Monad.Fix
import Control.Monad.IO.Class
import Data.Map (Map)
import qualified Data.Map as Map
-import Data.Monoid
import Data.Text (Text)
import qualified Data.Text as T
import GHCJS.DOM.Element
@@ -31,6 +22,21 @@ import GHCJS.DOM.Types (MonadJSM, liftJSM, uncheckedCastTo, HTMLElement(..))
import GHCJS.DOM.HTMLElement (getOffsetWidth, getOffsetHeight)
import qualified GHCJS.DOM.Types as DOM
+#if !MIN_VERSION_base(4,18,0)
+import Control.Monad
+import Data.Monoid
+#endif
+
+import Reflex.Class
+import Reflex.Time
+import Reflex.Dom.Builder.Class
+import Reflex.Dom.Builder.Immediate
+import Reflex.Dom.Class
+import Reflex.Dom.Widget.Basic
+import Reflex.PerformEvent.Class
+import Reflex.PostBuild.Class
+import Reflex.TriggerEvent.Class
+
-- | A widget that wraps the given widget in a div and fires an event when resized.
-- Adapted from @github.com\/marcj\/css-element-queries@
--
diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr.hs b/reflex-dom-core/src/Reflex/Dom/Xhr.hs
index 874938b2..31095e5a 100644
--- a/reflex-dom-core/src/Reflex/Dom/Xhr.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Xhr.hs
@@ -8,6 +8,7 @@
#ifdef USE_TEMPLATE_HASKELL
{-# LANGUAGE TemplateHaskell #-}
#endif
+{-# LANGUAGE TypeOperators #-}
-- | A module for performing asynchronous HTTP calls from JavaScript
-- using the
diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs
index 210ac82e..09d476ad 100644
--- a/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs
@@ -1,12 +1,15 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
+#ifdef __GHCJS__
{-# LANGUAGE JavaScriptFFI #-}
+#endif
{-# LANGUAGE OverloadedStrings #-}
-module Reflex.Dom.Xhr.Foreign (
- XMLHttpRequest
+module Reflex.Dom.Xhr.Foreign
+ ( XMLHttpRequest
, XMLHttpRequestResponseType(..)
, module Reflex.Dom.Xhr.Foreign
-) where
+ ) where
import Control.Exception (throwIO)
import Control.Monad.IO.Class (MonadIO(..))
diff --git a/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs b/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs
index 664e003f..556e0e64 100644
--- a/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs
+++ b/reflex-dom-core/src/Reflex/Dom/Xhr/FormData.hs
@@ -1,12 +1,13 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
+
module Reflex.Dom.Xhr.FormData
( postForms
, postForms'
, FormValue (..)
, fileToFormValue
- )
- where
+ ) where
import Control.Lens
import Data.Default
@@ -14,10 +15,14 @@ import Data.Map (Map)
import Data.Text (Text)
import Data.Traversable
import qualified GHCJS.DOM.FormData as FD
-import Foreign.JavaScript.TH
import GHCJS.DOM.File (getName)
import GHCJS.DOM.Types (File, IsBlob)
import Language.Javascript.JSaddle.Monad (MonadJSM, liftJSM)
+
+#if !MIN_VERSION_base(4,18,0)
+import Foreign.JavaScript.TH
+#endif
+
import Reflex
import Reflex.Dom.Xhr
diff --git a/reflex-dom-core/test/hlint.hs b/reflex-dom-core/test/hlint.hs
index f4137f2c..a2b4d361 100644
--- a/reflex-dom-core/test/hlint.hs
+++ b/reflex-dom-core/test/hlint.hs
@@ -20,6 +20,7 @@ main = do
, "--ignore=Unnecessary hiding" -- Interferes with cross-version compatibility
, "--ignore=Use <$>"
, "--ignore=Reduce duplication" --TODO: Re-enable this test
+ , "--ignore=Eta reduce" -- simplified subsumption
, "--ignore=Use list comprehension"
, "--ignore=Evaluate"
, "--cpp-define=USE_TEMPLATE_HASKELL"
diff --git a/reflex-dom-core/test/hydration.hs b/reflex-dom-core/test/hydration.hs
index 16269a73..564a6e8c 100644
--- a/reflex-dom-core/test/hydration.hs
+++ b/reflex-dom-core/test/hydration.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
@@ -89,8 +90,10 @@ import qualified Test.WebDriver.Capabilities as WD
import Test.Util.ChromeFlags
import Test.Util.UnshareNetwork
--- ORPHAN: https://github.com/kallisti-dev/hs-webdriver/pull/167
+
+#if !MIN_VERSION_webdriver(0,10,0)
deriving instance MonadMask WD
+#endif
chromium :: FilePath
chromium = $(staticWhich "chromium")
@@ -118,18 +121,11 @@ assertBool msg bool = liftIO $ HUnit.assertBool msg bool
chromeConfig :: Text -> [Text] -> WD.WDConfig
chromeConfig fp flags = WD.useBrowser (WD.chrome { WD.chromeBinary = Just $ T.unpack fp, WD.chromeOptions = T.unpack <$> flags }) WD.defaultConfig
-keyMap :: DMap DKey Identity
-keyMap = DMap.fromList
- [ Key_Int ==> 0
- , Key_Char ==> 'A'
- ]
-
data DKey a where
Key_Int :: DKey Int
Key_Char :: DKey Char
Key_Bool :: DKey Bool
-
textKey :: DKey a -> Text
textKey = \case
Key_Int -> "Key_Int"
@@ -141,6 +137,21 @@ deriveGEq ''DKey
deriveGCompare ''DKey
deriveGShow ''DKey
+keyMap :: DMap DKey Identity
+keyMap = DMap.fromList
+ [ Key_Int ==> 0
+ , Key_Char ==> 'A'
+ ]
+
+data Key2 a where
+ Key2_Int :: Int -> Key2 Int
+ Key2_Char :: Char -> Key2 Char
+
+deriveGEq ''Key2
+deriveGCompare ''Key2
+deriveGShow ''Key2
+deriveArgDict ''Key2
+
deriving instance MonadFail WD
main :: IO ()
@@ -166,11 +177,11 @@ tests withDebugging wdConfig caps _selenium = do
r <- m
putStrLnDebug "after"
return r
- testWidgetStatic :: WD b -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) -> WD b
+ testWidgetStatic :: WD b -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -> WD b
testWidgetStatic = testWidgetStaticDebug withDebugging
- testWidget :: WD () -> WD b -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) -> WD b
+ testWidget :: WD () -> WD b -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -> WD b
testWidget = testWidgetDebug True withDebugging
- testWidget' :: WD a -> (a -> WD b) -> (forall m js. TestWidget (SpiderTimeline Global) m => m ()) -> WD b
+ testWidget' :: WD a -> (a -> WD b) -> (forall m. TestWidget (SpiderTimeline Global) m => m ()) -> WD b
testWidget' = testWidgetDebug' True withDebugging
session' "text" $ do
it "works" $ runWD $ do
@@ -1722,7 +1733,7 @@ testWidgetStaticDebug
:: Bool
-> WD b
-- ^ Webdriver commands to run before JS runs and after hydration switchover
- -> (forall m js. TestWidget (SpiderTimeline Global) m => m ())
+ -> (forall m. TestWidget (SpiderTimeline Global) m => m ())
-- ^ Widget we are testing
-> WD b
testWidgetStaticDebug withDebugging w = testWidgetDebug True withDebugging (void w) w
@@ -1735,7 +1746,7 @@ testWidgetDebug
-- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page)
-> WD b
-- ^ Webdriver commands to run after hydration switchover
- -> (forall m js. TestWidget (SpiderTimeline Global) m => m ())
+ -> (forall m. TestWidget (SpiderTimeline Global) m => m ())
-- ^ Widget we are testing
-> WD b
testWidgetDebug hardFailure withDebugging beforeJS afterSwitchover =
@@ -1752,7 +1763,7 @@ testWidgetDebug'
-- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page)
-> (a -> WD b)
-- ^ Webdriver commands to run after hydration switchover
- -> (forall m js. TestWidget (SpiderTimeline Global) m => m ())
+ -> (forall m. TestWidget (SpiderTimeline Global) m => m ())
-- ^ Widget we are testing (contents of body)
-> WD b
testWidgetDebug' hardFailure withDebugging beforeJS afterSwitchover bodyWidget = do
@@ -1817,12 +1828,3 @@ withAsync' f g = bracket
(liftIO $ Async.async f)
(liftIO . Async.uninterruptibleCancel)
(const g)
-
-data Key2 a where
- Key2_Int :: Int -> Key2 Int
- Key2_Char :: Char -> Key2 Char
-
-deriveGEq ''Key2
-deriveGCompare ''Key2
-deriveGShow ''Key2
-deriveArgDict ''Key2
diff --git a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal
index df4106fc..a536b3bd 100644
--- a/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal
+++ b/reflex-dom-test-selenium/reflex-dom-test-selenium.cabal
@@ -1,42 +1,45 @@
cabal-version: 1.24
-Name: reflex-dom-test-selenium
-Version: 0.0.0.1
-Synopsis: Testing framework for selenium tests
-Description:
-License: BSD3
-License-file: LICENSE
-Author: Ryan Trinkle
-Maintainer: ryan.trinkle@gmail.com
-Stability: Experimental
-Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
-Build-type: Simple
+name: reflex-dom-test-selenium
+version: 0.0.0.1
+license: BSD3
+license-file: LICENSE
+maintainer: ryan.trinkle@gmail.com
+author: Ryan Trinkle
+stability: Experimental
+synopsis: Testing framework for selenium tests
+category:
+ FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
+
+build-type: Simple
library
- hs-source-dirs: src
- build-depends:
- async,
- base >= 4.7 && < 4.15,
- bytestring == 0.10.*,
- chrome-test-utils,
- exceptions,
- -- Until hspec-webdriver supports newer hspec-core versions
- hspec-core < 2.8,
- hspec-webdriver >= 1.2.1,
- http-types,
- jsaddle >= 0.9.0.0 && < 0.10,
- jsaddle-warp,
- network,
- process,
- reflex-dom-core,
- silently,
- text == 1.2.*,
- wai,
- warp,
- webdriver,
- websockets
+ exposed-modules: Reflex.Dom.Test.Selenium
+ hs-source-dirs: src
+ default-language: Haskell98
+ ghc-options:
+ -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
+ -fspecialise-aggressively
- exposed-modules:
- Reflex.Dom.Test.Selenium
+ build-depends:
+ async <2.3,
+ base >=4.7 && <=4.21,
+ bytestring >=0.10 && <0.13,
+ chrome-test-utils,
+ exceptions,
+ hspec-core <2.12,
+ hspec-webdriver >=1.2.2 && <1.3,
+ http-types <0.13,
+ jsaddle >=0.9.0.0 && <0.10,
+ jsaddle-warp <0.10,
+ network <3.3,
+ process,
+ reflex-dom-core,
+ silently <1.3,
+ text >=1.2 && <2.2,
+ wai <3.3,
+ warp <3.5,
+ webdriver <0.13,
+ websockets <0.14
- default-language: Haskell98
- ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fspecialise-aggressively
+ if (!os(linux) || !arch(x86_64))
+ buildable: False
diff --git a/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs b/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs
index b0c14cf2..be7ead10 100644
--- a/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs
+++ b/reflex-dom-test-selenium/src/Reflex/Dom/Test/Selenium.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
@@ -54,7 +55,9 @@ import qualified Test.Hspec.Core.Spec as Hspec
import qualified Test.WebDriver as WD
import qualified Test.WebDriver.Capabilities as WD
+#if !MIN_VERSION_webdriver(0,10,0)
deriving instance MonadMask WD
+#endif
data SeleniumSetupConfig = SeleniumSetupConfig
{ _seleniumSetupConfig_chromiumPath :: FilePath
@@ -116,7 +119,7 @@ type TestWidget t m =
data TestWidgetConfig = TestWidgetConfig
{ _testWidgetConfig_debug :: Bool
-- ^ If this flag is set to True, during the test we will emit debug messages
- , _testWidgetConfig_headWidget :: (forall m js. TestWidget js (SpiderTimeline Global) m => m ())
+ , _testWidgetConfig_headWidget :: (forall m. TestWidget (SpiderTimeline Global) m => m ())
-- ^ We can add widgets here that will be included in the head of the page
-- (useful for example to include external js libraries in the tests)
, _testWidgetConfig_jsaddlePort :: PortNumber
@@ -131,7 +134,7 @@ testWidget
-- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page)
-> WD b
-- ^ Webdriver commands to run after hydration switchover
- -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ())
+ -> (forall m. TestWidget (SpiderTimeline Global) m => m ())
-- ^ Widget we are testing (contents of body)
-> WD b
testWidget cfg before after widget = testWidget' cfg before (const after) widget
@@ -142,7 +145,7 @@ testWidgetStatic
:: TestWidgetConfig
-> WD a
-- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page)
- -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ())
+ -> (forall m. TestWidget (SpiderTimeline Global) m => m ())
-- ^ Widget we are testing (contents of body)
-> WD a
testWidgetStatic cfg before widget = testWidget' cfg before pure widget
@@ -152,7 +155,7 @@ testWidgetHydrated
:: TestWidgetConfig
-> WD b
-- ^ Webdriver commands to run after hydration switchover
- -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ())
+ -> (forall m . TestWidget (SpiderTimeline Global) m => m ())
-- ^ Widget we are testing (contents of body)
-> WD b
testWidgetHydrated cfg after widget = testWidget' cfg (pure ()) (const after) widget
@@ -166,7 +169,7 @@ testWidget'
-- ^ Webdriver commands to run before the JS runs (i.e. on the statically rendered page)
-> (a -> WD b)
-- ^ Webdriver commands to run after hydration switchover
- -> (forall m js. TestWidget js (SpiderTimeline Global) m => m ())
+ -> (forall m. TestWidget (SpiderTimeline Global) m => m ())
-- ^ Widget we are testing (contents of body)
-> WD b
testWidget' (TestWidgetConfig withDebugging headWidget jsaddlePort) beforeJS afterSwitchover bodyWidget = do
diff --git a/reflex-dom/reflex-dom.cabal b/reflex-dom/reflex-dom.cabal
index 55caaca3..487db377 100644
--- a/reflex-dom/reflex-dom.cabal
+++ b/reflex-dom/reflex-dom.cabal
@@ -1,211 +1,238 @@
-cabal-version: 1.24
-Name: reflex-dom
-Version: 0.6.3.1
-Synopsis: Functional Reactive Web Apps with Reflex
-Description:
- Web applications without callbacks or side-effects.
- Reflex-DOM brings the power of functional reactive programming (FRP) to the web.
- Build HTML and other Document Object Model (DOM) data with a pure functional interface.
- .
- Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: .
- .
- The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the
- correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.).
- Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@.
- All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@.
- .
- For Hackage documentation, please see: .
-License: BSD3
-License-file: LICENSE
-Author: Ryan Trinkle
-Maintainer: ryan.trinkle@gmail.com
-Stability: Experimental
-Category: FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
-Build-type: Simple
+cabal-version: 1.24
+name: reflex-dom
+version: 0.6.3.1
+license: BSD3
+license-file: LICENSE
+maintainer: ryan.trinkle@gmail.com
+author: Ryan Trinkle
+stability: Experimental
+synopsis: Functional Reactive Web Apps with Reflex
+description:
+ Web applications without callbacks or side-effects.
+ Reflex-DOM brings the power of functional reactive programming (FRP) to the web.
+ Build HTML and other Document Object Model (DOM) data with a pure functional interface.
+ .
+ Reflex-DOM is a Functional Reactive web framework based on the Reflex FRP engine: .
+ .
+ The @reflex-dom@ package is a small wrapper around the @reflex-dom-core@ package. It pulls in the
+ correct set of dependencies for each target platform (GHCJS, WebKitGTK, WASM, mobile, etc.).
+ Libraries should depend on @reflex-dom-core@ and executables will usually depend on @reflex-dom@.
+ All of @reflex-dom-core@'s modules are re-exported by @reflex-dom@.
+ .
+ For Hackage documentation, please see: .
+
+category:
+ FRP, Web, GUI, HTML, Javascript, Reactive, Reactivity, User Interfaces, User-interface
+
+build-type: Simple
extra-source-files:
- java/org/reflexfrp/reflexdom/MainWidget.java
- ChangeLog.md
+ java/org/reflexfrp/reflexdom/MainWidget.java
+ ChangeLog.md
+
+source-repository head
+ type: git
+ location: https://github.com/reflex-frp/reflex-dom
+ subdir: reflex-dom
flag use-warp
- description: Use jsaddle-warp server
- default: False
- manual: True
+ description: Use jsaddle-warp server
+ default: False
+ manual: True
flag webkit2gtk
- description: Use WebKit2 version of WebKitGTK.
- default: True
+ description: Use WebKit2 version of WebKitGTK.
flag use-reflex-optimizer
- description: Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental.
- default: False
- manual: True
+ description:
+ Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental.
+
+ default: False
+ manual: True
flag expose-all-unfoldings
- description: Build the library with -fexpose-all-unfoldings which can help client code specialize better
- default: False
- manual: True
+ description:
+ Build the library with -fexpose-all-unfoldings which can help client code specialize better
+
+ default: False
+ manual: True
flag build-examples
- description: Build the executables in ./examples
- default: False
- manual: True
+ description: Build the executables in ./examples
+ default: False
+ manual: True
flag wasm32
- description: Build for wasm32 architecture
- default: False
- manual: True
+ description: Build for wasm32 architecture
+ default: False
+ manual: True
library
- hs-source-dirs: src
- if os(android)
- hs-source-dirs: src-android
- other-modules: Reflex.Dom.Android.MainWidget
+ exposed-modules:
+ Reflex.Dom
+ Reflex.Dom.Internal
+ Reflex.Dom.Location.Platform
+
+ reexported-modules:
+ Foreign.JavaScript.Orphans,
+ Foreign.JavaScript.TH,
+ Foreign.JavaScript.Utils,
+ Reflex.Dom.Builder.Class,
+ Reflex.Dom.Builder.Class.Events,
+ Reflex.Dom.Builder.Hydratable,
+ Reflex.Dom.Builder.Immediate,
+ Reflex.Dom.Builder.InputDisabled,
+ Reflex.Dom.Builder.Static,
+ Reflex.Dom.Class,
+ Reflex.Dom.Core,
+ Reflex.Dom.Location,
+ Reflex.Dom.Main,
+ Reflex.Dom.Modals.Class,
+ Reflex.Dom.Old,
+ Reflex.Dom.Prerender,
+ Reflex.Dom.Time,
+ Reflex.Dom.WebSocket,
+ Reflex.Dom.WebSocket.Query,
+ Reflex.Dom.Widget,
+ Reflex.Dom.Widget.Basic,
+ Reflex.Dom.Widget.Input,
+ Reflex.Dom.Widget.Lazy,
+ Reflex.Dom.Widget.Resize,
+ Reflex.Dom.Xhr,
+ Reflex.Dom.Xhr.FormData
+
+ cc-options: -fPIC
+ hs-source-dirs: src
+ default-language: Haskell2010
+ ghc-options:
+ -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fPIC
+
build-depends:
- aeson >= 1.4 && < 2.2,
- android-activity == 0.2.*,
- data-default == 0.7.*,
- jsaddle >= 0.9.6 && < 0.10
- c-sources: cbits/MainWidget.c
- include-dirs: cbits/include
- install-includes: MainWidget.h
- cpp-options: -DANDROID
- build-tools: hsc2hs
- build-depends:
- base >= 4.7 && < 4.15,
- bytestring == 0.10.*,
- reflex >= 0.8 && < 1,
- reflex-dom-core >= 0.6.1.0 && <0.9,
- text == 1.2.*
- if !impl(ghcjs)
- if flag(use-warp)
- build-depends:
- jsaddle >= 0.9.6 && < 0.10,
- jsaddle-warp >= 0.9.6 && < 0.10
- else
- if os(osx) || os(ios)
+ base >=4.7 && <4.21,
+ bytestring >=0.10 && <0.13,
+ reflex >=0.8 && <1,
+ reflex-dom-core >=0.6.1.0 && <0.9,
+ text >=1.2 && <2.2
+
+ if os(android)
+ build-tools: hsc2hs >=0
+ cpp-options: -DANDROID
+ c-sources: cbits/MainWidget.c
+ hs-source-dirs: src-android
+ other-modules: Reflex.Dom.Android.MainWidget
+ include-dirs: cbits/include
+ install-includes: MainWidget.h
build-depends:
- data-default == 0.7.*,
- jsaddle >= 0.9.6 && < 0.10,
- jsaddle-wkwebview >= 0.9.6 && < 0.10
- else
- if flag(wasm32)
- build-depends:
- jsaddle >= 0.9.6 && < 0.10,
- jsaddle-wasm >= 0.1 && < 0.2
- else
- if flag(webkit2gtk) && !os(android)
+ aeson >=1.4 && <2.3,
+ android-activity >=0.2 && <0.3,
+ data-default >=0.7 && <0.8,
+ jsaddle >=0.9.6 && <0.10
+
+ if !(impl(ghcjs >=0) || arch(javascript))
+ if flag(use-warp)
build-depends:
- jsaddle-webkit2gtk >= 0.9.6 && < 0.10
-
- exposed-modules:
- Reflex.Dom
- Reflex.Dom.Internal
- Reflex.Dom.Location.Platform
- reexported-modules:
- Foreign.JavaScript.Orphans
- , Foreign.JavaScript.TH
- , Foreign.JavaScript.Utils
- , Reflex.Dom.Builder.Class
- , Reflex.Dom.Builder.Class.Events
- , Reflex.Dom.Builder.Hydratable
- , Reflex.Dom.Builder.Immediate
- , Reflex.Dom.Builder.InputDisabled
- , Reflex.Dom.Builder.Static
- , Reflex.Dom.Class
- , Reflex.Dom.Core
- , Reflex.Dom.Location
- , Reflex.Dom.Main
- , Reflex.Dom.Modals.Class
- , Reflex.Dom.Old
- , Reflex.Dom.Prerender
- , Reflex.Dom.Time
- , Reflex.Dom.WebSocket
- , Reflex.Dom.WebSocket.Query
- , Reflex.Dom.Widget
- , Reflex.Dom.Widget.Basic
- , Reflex.Dom.Widget.Input
- , Reflex.Dom.Widget.Lazy
- , Reflex.Dom.Widget.Resize
- , Reflex.Dom.Xhr
- , Reflex.Dom.Xhr.FormData
- ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fPIC
- cc-options: -fPIC
- if flag(expose-all-unfoldings)
- ghc-options: -fexpose-all-unfoldings
- if flag(use-reflex-optimizer)
- ghc-options: -fplugin=Reflex.Optimizer
- default-language: Haskell2010
+ jsaddle >=0.9.6 && <0.10,
+ jsaddle-warp >=0.9.6 && <0.10
+
+ else
+ if (os(osx) || os(ios))
+ build-depends:
+ data-default >=0.7 && <0.8,
+ jsaddle >=0.9.6 && <0.10,
+ jsaddle-wkwebview >=0.9.6 && <0.10
+
+ else
+ if flag(wasm32)
+ build-depends:
+ jsaddle >=0.9.6 && <0.10,
+ jsaddle-wasm >=0.1 && <0.2
+
+ else
+ if (flag(webkit2gtk) && !os(android))
+ build-depends: jsaddle-webkit2gtk >=0.9.6 && <0.10
+
+ if flag(expose-all-unfoldings)
+ ghc-options: -fexpose-all-unfoldings
+
+ if flag(use-reflex-optimizer)
+ ghc-options: -fplugin=Reflex.Optimizer
executable sortableList
- build-depends: base
- , containers
- , dependent-map
- , lens
- , mtl
- , random
- , reflex
- , reflex-dom
- , text
- , time
- , transformers
- hs-source-dirs: examples
- main-is: sortableList.hs
- ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans -fspecialise-aggressively
- if !flag(build-examples)
- buildable: False
- if flag(expose-all-unfoldings)
- ghc-options: -fexpose-all-unfoldings
- if flag(use-reflex-optimizer)
- ghc-options: -fplugin=Reflex.Optimizer
- default-language: Haskell2010
+ main-is: sortableList.hs
+ hs-source-dirs: examples
+ default-language: Haskell2010
+ ghc-options:
+ -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
+ -fspecialise-aggressively
+
+ build-depends:
+ base,
+ containers <0.8,
+ dependent-map <0.5,
+ lens <5.4,
+ mtl,
+ random <1.3,
+ reflex <0.10,
+ reflex-dom,
+ text <2.2,
+ time,
+ transformers
+
+ if !flag(build-examples)
+ buildable: False
+
+ if flag(expose-all-unfoldings)
+ ghc-options: -fexpose-all-unfoldings
+
+ if flag(use-reflex-optimizer)
+ ghc-options: -fplugin=Reflex.Optimizer
executable benchmark
- build-depends: base
- , containers
- , dependent-map
- , dependent-sum
- , ghc-prim
- , ghcjs-dom
- , mtl
- , prim-uniq
- , random
- , reflex
- , reflex-dom
- , text
- , transformers
- hs-source-dirs: .
- main-is: benchmark.hs
- ghc-options: -O2 -fspecialise-aggressively
- if !impl(ghcjs)
- buildable: False
- default-language: Haskell2010
+ main-is: benchmark.hs
+ hs-source-dirs: .
+ default-language: Haskell2010
+ ghc-options: -O2 -fspecialise-aggressively
+ build-depends:
+ base,
+ containers <0.8,
+ dependent-map <0.5,
+ dependent-sum <0.8,
+ ghc-prim,
+ ghcjs-dom <0.10,
+ mtl,
+ prim-uniq <0.3,
+ random <1.3,
+ reflex <0.10,
+ reflex-dom,
+ text <2.2,
+ transformers
+
+ if !impl(ghcjs >=0)
+ buildable: False
executable krausest
- build-depends: base
- , containers
- , dependent-map
- , dependent-sum
- , ghc-prim
- , ghcjs-dom
- , mtl
- , prim-uniq
- , random
- , reflex
- , reflex-dom
- , text
- , transformers
- , vector
- hs-source-dirs: benchmarks
- main-is: krausest.hs
- ghc-options: -O2 -fspecialise-aggressively
- if impl(ghcjs)
- ghcjs-options: -dedupe
- cpp-options: -DGHCJS_BROWSER -DGHCJS_GC_INTERVAL=60000
- else
- buildable: False
- default-language: Haskell2010
+ main-is: krausest.hs
+ hs-source-dirs: benchmarks
+ default-language: Haskell2010
+ ghc-options: -O2 -fspecialise-aggressively
+ build-depends:
+ base,
+ containers <0.8,
+ dependent-map <0.5,
+ dependent-sum <0.8,
+ ghc-prim,
+ ghcjs-dom <0.10,
+ mtl,
+ prim-uniq <0.3,
+ random <1.3,
+ reflex <0.10,
+ reflex-dom,
+ text <2.2,
+ transformers,
+ vector <0.14
-source-repository head
- type: git
- location: https://github.com/reflex-frp/reflex-dom
- subdir: reflex-dom
+ if impl(ghcjs >=0)
+ cpp-options: -DGHCJS_BROWSER -DGHCJS_GC_INTERVAL=60000
+ ghcjs-options: -dedupe
+
+ else
+ buildable: False
diff --git a/reflex-dom/src/Reflex/Dom.hs b/reflex-dom/src/Reflex/Dom.hs
index aad89735..8d86e316 100644
--- a/reflex-dom/src/Reflex/Dom.hs
+++ b/reflex-dom/src/Reflex/Dom.hs
@@ -5,7 +5,9 @@
module Reflex.Dom (module X) where
import Foreign.JavaScript.Orphans ()
-import Reflex.Dom.Core as X hiding (mainWidget, mainWidgetInElementById, mainWidgetWithCss,
- mainWidgetWithHead, mainWidgetWithHead', runApp',
- mainHydrationWidgetWithHead, mainHydrationWidgetWithHead')
+import Reflex.Dom.Core as X hiding
+ ( mainWidget, mainWidgetInElementById, mainWidgetWithCss
+ , mainWidgetWithHead, mainWidgetWithHead', runApp'
+ , mainHydrationWidgetWithHead, mainHydrationWidgetWithHead'
+ )
import Reflex.Dom.Internal as X
diff --git a/reflex-dom/src/Reflex/Dom/Internal.hs b/reflex-dom/src/Reflex/Dom/Internal.hs
index bacf0a64..1139e4f5 100644
--- a/reflex-dom/src/Reflex/Dom/Internal.hs
+++ b/reflex-dom/src/Reflex/Dom/Internal.hs
@@ -3,6 +3,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
+
module Reflex.Dom.Internal
( module Main
, run
@@ -13,15 +14,16 @@ module Reflex.Dom.Internal
import Data.ByteString (ByteString)
import Data.Text (Text)
-import Reflex.Dom.Core (Widget)
import Reflex.Dom.Main as Main hiding
- (mainWidget, mainWidgetWithHead, mainWidgetWithCss,
- mainWidgetWithHead', mainWidgetInElementById, runApp',
- mainHydrationWidgetWithHead, mainHydrationWidgetWithHead')
+ ( mainWidget, mainWidgetWithHead, mainWidgetWithCss
+ , mainWidgetWithHead', mainWidgetInElementById, runApp'
+ , mainHydrationWidgetWithHead, mainHydrationWidgetWithHead'
+ )
import qualified Reflex.Dom.Main as Main
- (mainWidget, mainWidgetWithHead, mainWidgetWithCss,
- mainWidgetWithHead', mainWidgetInElementById, runApp',
- mainHydrationWidgetWithHead, mainHydrationWidgetWithHead')
+ ( mainWidget, mainWidgetWithHead, mainWidgetWithCss
+ , mainWidgetWithHead', mainWidgetInElementById, runApp'
+ , mainHydrationWidgetWithHead, mainHydrationWidgetWithHead'
+ )
#if defined(ghcjs_HOST_OS)
run :: a -> a
diff --git a/reflex-dom/src/Reflex/Dom/Location/Platform.hs b/reflex-dom/src/Reflex/Dom/Location/Platform.hs
index 220111ec..10c1edc1 100644
--- a/reflex-dom/src/Reflex/Dom/Location/Platform.hs
+++ b/reflex-dom/src/Reflex/Dom/Location/Platform.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
+
#if defined(ANDROID)
module Reflex.Dom.Location.Platform where