Skip to content

Commit

Permalink
Merge branch 'develop' into release/reflex-dom-core/0.8.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfmpe authored Jan 12, 2025
2 parents aa72166 + f5a7451 commit a37df57
Show file tree
Hide file tree
Showing 35 changed files with 181 additions and 182 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
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']
os: ['ubuntu-latest', 'macos-latest']
exclude:
# There are some linker warnings in 802 on darwin that
# cause compilation to fail
# See https://github.com/NixOS/nixpkgs/issues/25139
- ghc: '8.0.2'
os: 'macos-latest'
ghc: ['8.6', '8.8', '8.10', '9.0', '9.2', '9.4', '9.6', '9.8', '9.10']
os: ['ubuntu-latest']
runs-on: ${{ matrix.os }}

name: GHC ${{ matrix.ghc }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-haskell@v1
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
- name: Cache
uses: actions/cache@v1
uses: actions/cache@v3
env:
cache-name: cache-cabal
with:
Expand All @@ -43,5 +37,6 @@ jobs:
cabal build --only-dependencies --enable-tests --enable-benchmarks all
- name: Build
run: cabal build --enable-tests --enable-benchmarks all
- name: Run tests
run: cabal test all
# Temporarily disabled until either a newer hlint is released or chrome-test-utils is released on hackage
# - name: Run tests
# run: cabal test all
6 changes: 2 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ packages:
chrome-test-utils/
reflex-dom-test-selenium/

source-repository-package
type: git
location: https://github.com/dfordivam/hspec-webdriver-clone
tag: 0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8
tests: True
benchmarks: True
7 changes: 1 addition & 6 deletions cabal.project-nogtk
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ packages:
reflex-dom/

package reflex-dom-core
flags: -hydration-tests -gc-tests
flags: -hlint-tests -hydration-tests -gc-tests

package reflex-dom
flags: +use-warp -webkit2gtk

source-repository-package
type: git
location: https://github.com/dfordivam/hspec-webdriver-clone
tag: 0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8
1 change: 0 additions & 1 deletion chrome-test-utils/src/Test/Util/ChromeFlags.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
module Test.Util.ChromeFlags where

import Data.Semigroup
import Data.Text
import System.IO.Temp

Expand Down
6 changes: 3 additions & 3 deletions dep/reflex-platform/github.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"owner": "reflex-frp",
"repo": "reflex-platform",
"branch": "release/1.0.1.0",
"branch": "release/1.2.0.0",
"private": false,
"rev": "50099ce2bca93ef69cea615ec72152b4a7648de4",
"sha256": "1ldzf3qznpysf4drkrvj7ysmdvrv6ddprnniylvcxccpp0f4krb7"
"rev": "f231e2425ac92339b8491cdd970930d63d9ad1ad",
"sha256": "0b042x423p04shhidni08f47ydgpfj0rpqhb0m6gj2lg8b3s9l8k"
}
55 changes: 31 additions & 24 deletions reflex-dom-core/reflex-dom-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,61 +64,66 @@ flag gc-tests
default: True
manual: True

flag hlint-tests
description: Whether to run the hlint tests
default: False
manual: True

library
hs-source-dirs: src
build-depends:
aeson >= 0.8 && < 2.2,
base >= 4.7 && < 4.15,
aeson >= 0.8 && < 2.3,
base >= 4.7 && < 4.21,
bifunctors >= 4.2 && < 6,
bimap >= 0.3 && < 0.5,
bimap >= 0.3 && < 0.6,
blaze-builder >= 0.4.1 && < 0.5,
bytestring == 0.10.*,
bytestring >= 0.10 && < 0.13,
case-insensitive < 1.3,
commutative-semigroups >=0.1 && <0.2,
containers >= 0.6 && < 0.7,
constraints >= 0.9 && < 0.14,
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,
data-default >= 0.5 && < 0.9,
dependent-map >= 0.3 && < 0.5,
dependent-sum >= 0.6 && < 0.8,
dependent-sum-template >= 0.1 && < 0.2,
dependent-sum-template >= 0.1 && < 0.3,
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,
lens >= 4.7 && < 5.4,
monad-control >= 1.0.1 && < 1.1,
mtl >= 2.1 && < 2.3,
primitive >= 0.5 && < 0.8,
random >= 1.1 && < 1.3,
mtl >= 2.1 && < 2.4,
primitive >= 0.5 && < 0.10,
random >= 1.1 && < 1.4,
ref-tf >= 0.4 && < 0.6,
reflex >= 0.8.2.1 && < 1,
semigroups >= 0.16 && < 0.20,
semigroups >= 0.16 && < 0.21,
stm >= 2.4 && < 2.6,
text == 1.2.*,
transformers >= 0.3 && < 0.6,
text >= 1.2 && < 2.2,
transformers >= 0.3 && < 0.7,
network-uri >= 2.6.1 && < 2.7,
zenc == 0.1.*

if impl(ghcjs)
if impl(ghcjs) || arch(javascript)
hs-source-dirs: src-ghcjs
build-depends:
ghcjs-base,
hashable >= 1.2 && < 1.4
hashable >= 1.2 && < 1.5
else
hs-source-dirs: src-ghc
if !os(windows)
build-depends: unix == 2.7.*
build-depends: unix >= 2.7 && <2.9

if flag(split-these)
build-depends:
semialign >= 1 && < 1.3,
semialign >= 1 && < 1.4,
these >= 1 && < 1.3
else
build-depends:
these >= 0.4 && < 0.9
these >= 0.4 && < 1.0

exposed-modules:
Foreign.JavaScript.TH
Expand Down Expand Up @@ -169,8 +174,8 @@ library

if flag(use-template-haskell)
build-depends:
dependent-sum-template >= 0.1 && < 0.2,
template-haskell >= 2.12.0 && < 2.17
dependent-sum-template >= 0.1 && < 0.3,
template-haskell >= 2.12.0 && < 2.23
other-extensions: TemplateHaskell
cpp-options: -DUSE_TEMPLATE_HASKELL
other-modules:
Expand All @@ -184,6 +189,8 @@ test-suite hlint
main-is: hlint.hs
type: exitcode-stdio-1.0
default-language: Haskell98
if !flag(hlint-tests)
buildable: False

test-suite hydration
build-depends: base
Expand Down Expand Up @@ -226,7 +233,7 @@ test-suite hydration
, websockets
, which
hs-source-dirs: test
ghc-options: -rtsopts -with-rtsopts=-T -Wall -fwarn-tabs -funbox-strict-fields -O2 -ferror-spans
ghc-options: -rtsopts "-with-rtsopts=-T -V0" -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ForeignFunctionInterface #-}
#ifdef __ghcjs_HOST_OS
{-# LANGUAGE JavaScriptFFI #-}
#endif

module Foreign.JavaScript.Internal.Utils
( synchronously
Expand All @@ -9,7 +12,11 @@ module Foreign.JavaScript.Internal.Utils

import GHCJS.Concurrent
import GHCJS.DOM.Types (JSM, JSVal, RequestAnimationFrameCallback (..))
#if __GLASGOW_HASKELL__ < 900
import GHCJS.Foreign.Callback (releaseCallback)
#else
import GHC.JS.Foreign.Callback (releaseCallback)
#endif

freeRequestAnimationFrameCallback :: RequestAnimationFrameCallback -> JSM ()
freeRequestAnimationFrameCallback (RequestAnimationFrameCallback cb) = releaseCallback cb
Expand Down
4 changes: 4 additions & 0 deletions reflex-dom-core/src/Foreign/JavaScript/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ import qualified GHCJS.Buffer as JS
import GHCJS.DOM.Types (MonadJSM)
import qualified GHCJS.DOM.Types as JS
import qualified GHCJS.Foreign as JS
#if __GLASGOW_HASKELL__ < 900
import qualified GHCJS.Foreign.Callback as JS
import qualified GHCJS.Foreign.Callback.Internal (Callback (..))
#else
import qualified GHC.JS.Foreign.Callback as JS
#endif
import qualified JavaScript.Array as JS
import qualified JavaScript.Array.Internal (SomeJSArray (..))
import qualified JavaScript.Object as JS
Expand Down
48 changes: 25 additions & 23 deletions reflex-dom-core/src/Reflex/Dom/Builder/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{-# LANGUAGE TemplateHaskell #-}
#endif
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Reflex.Dom.Builder.Class
( module Reflex.Dom.Builder.Class
Expand All @@ -47,17 +48,18 @@ import Reflex.Requester.Base

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)
Expand All @@ -66,20 +68,20 @@ import GHCJS.DOM.Types (JSM)
import qualified GHCJS.DOM.Types as DOM

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'
Expand Down Expand Up @@ -159,7 +161,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 ()

Expand Down Expand Up @@ -307,6 +309,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
Expand Down Expand Up @@ -542,15 +553,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
Expand Down Expand Up @@ -641,7 +643,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
Expand Down Expand Up @@ -748,9 +750,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
5 changes: 3 additions & 2 deletions reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Data.Type.Equality ((:~:)(..))
import Data.GADT.Compare
(GOrdering(..), GEq(..), GCompare(..))
#endif
import Data.Kind (Type)
import Data.Text (Text)

data EventTag
Expand Down Expand Up @@ -65,7 +66,7 @@ data EventTag
| TouchendTag
| TouchcancelTag

data EventName :: EventTag -> * where
data EventName :: EventTag -> Type where
Abort :: EventName 'AbortTag
Blur :: EventName 'BlurTag
Change :: EventName 'ChangeTag
Expand Down Expand Up @@ -115,7 +116,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
Expand Down
2 changes: 1 addition & 1 deletion reflex-dom-core/src/Reflex/Dom/Builder/Hydratable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ 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
Expand Down
Loading

0 comments on commit a37df57

Please sign in to comment.