reflex 0.7.1.1 → 0.7.2.0
raw patch · 20 files changed
+185/−59 lines, 20 filesdep +mmorphdep ~basedep ~bytestringdep ~dependent-sum
Dependencies added: mmorph
Dependency ranges changed: base, bytestring, dependent-sum, ghcjs-base, profunctors, template-haskell
Files
- ChangeLog.md +2/−4
- Quickref.md +1/−0
- README.md +12/−20
- reflex.cabal +31/−10
- src/Reflex/BehaviorWriter/Base.hs +13/−4
- src/Reflex/Class.hs +13/−0
- src/Reflex/DynamicWriter/Base.hs +13/−4
- src/Reflex/EventWriter/Base.hs +14/−4
- src/Reflex/Host/Headless.hs +11/−9
- src/Reflex/PerformEvent/Base.hs +2/−0
- src/Reflex/PostBuild/Base.hs +2/−0
- src/Reflex/Profiled.hs +2/−1
- src/Reflex/Pure.hs +4/−0
- src/Reflex/Query/Base.hs +4/−0
- src/Reflex/Requester/Base.hs +4/−0
- src/Reflex/Spider/Internal.hs +36/−1
- src/Reflex/TriggerEvent/Base.hs +2/−0
- test/Headless.hs +10/−0
- test/Reflex/Plan/Pure.hs +1/−0
- test/Reflex/Test/Micro.hs +8/−2
ChangeLog.md view
@@ -1,9 +1,7 @@ # Revision history for reflex -## 0.7.1.1--* Add support for GHC 8.10-* Drop support for GHC < 8.4+## 0.7.2.0+* ([#416](https://github.com/reflex-frp/reflex/pull/416)) Add `now :: m (Event t ())` to `MonadHold`. * Extend some dependency version bounds * Fix HLint 3 test
Quickref.md view
@@ -54,6 +54,7 @@ [ ] difference :: Event a -> Event b -> Event a [ ] align :: Event a -> Event b -> Event (These a b) [ ] alignWith :: (These a b -> c) -> Event a -> Event b -> Event c+ -- Note align functions from Data.Align in semialign package [ ] mergeWith :: (a -> a -> a) -> [Event a] -> Event a [ ] leftmost :: [Event a] -> Event a [ ] mergeList :: [Event a] -> Event (NonEmpty a)
README.md view
@@ -1,31 +1,23 @@ ## [Reflex](https://reflex-frp.org/) -[](https://haskell.org) [](https://hackage.haskell.org/package/reflex) [](https://matrix.hackage.haskell.org/#/package/reflex) [](https://github.com/reflex-frp/reflex/blob/master/LICENSE)--### Practical Functional Reactive Programming--Reflex is a fully-deterministic, higher-order Functional Reactive Programming (FRP) interface and an engine that efficiently implements that interface.+[](https://haskell.org) [](https://hackage.haskell.org/package/reflex) [](https://matrix.hackage.haskell.org/#/package/reflex) [](https://travis-ci.org/reflex-frp/reflex) [](https://github.com/reflex-frp/reflex/blob/master/LICENSE) -[Reflex-DOM](https://github.com/reflex-frp/reflex-dom) is a framework built on Reflex that facilitates the development of web pages, including highly-interactive single-page apps.+Interactive programs without callbacks or side-effects. Functional Reactive Programming (FRP) uses composable events and time-varying values to describe interactive systems as pure functions. Just like other pure functional code, functional reactive code is easier to get right on the first try, maintain, and reuse. -A summary of Reflex functions is available in the [quick reference](Quickref.md).+Reflex is a fully-deterministic, higher-order Functional Reactive Programming interface and an engine that efficiently implements that interface. -**Visit https://reflex-frp.org/ for more information, tutorials, documentation and [examples](https://examples.reflex-frp.org/).**+**Visit https://reflex-frp.org for more information, tutorials, documentation and [examples](https://examples.reflex-frp.org/).** ### Resources-[Get started with Reflex](https://github.com/reflex-frp/reflex-platform) -[/r/reflexfrp](https://www.reddit.com/r/reflexfrp)--[irc.freenode.net #reflex-frp](http://webchat.freenode.net?channels=%23reflex-frp&uio=d4)+* [Official Website](https://reflex-frp.org)+* [Quick Reference](Quickref.md)+* [Reflex-DOM](https://github.com/reflex-frp/reflex-dom): A framework built on Reflex that facilitates the development of web pages, including highly-interactive single-page apps.+* [Obelisk](https://github.com/obsidiansystems/obelisk#obelisk): A framework built on Reflex and Reflex-DOM for functional reactive web and mobile applications, with batteries included.+* [Get started with Reflex](https://github.com/reflex-frp/reflex-platform)+* [/r/reflexfrp](https://www.reddit.com/r/reflexfrp)+* [irc.freenode.net #reflex-frp](http://webchat.freenode.net?channels=%23reflex-frp&uio=d4) ### Hacking -From the root of a [Reflex-Platform](https://github.com/reflex-frp/reflex-platform) checkout, run-`./scripts/hack-on haskell-overlays/reflex-packages/dep/reflex`. This-will check out the reflex source code into the-`haskell-overlays/reflex-packages/dep/reflex` directory. You can then-point that checkout at your fork, make changes, etc. Use the-`./try-reflex` or `./scripts/work-on` scripts to start a shell in-which you can test your changes.+From the root of a [Reflex Platform](https://github.com/reflex-frp/reflex-platform) checkout, run `./scripts/hack-on haskell-overlays/reflex-packages/dep/reflex`. This will check out the reflex source code into the `haskell-overlays/reflex-packages/dep/reflex` directory. You can then point that checkout at your fork, make changes, etc. Use the `./try-reflex` or `./scripts/work-on` scripts to start a shell in which you can test your changes.
reflex.cabal view
@@ -1,7 +1,17 @@ Name: reflex-Version: 0.7.1.1+Version: 0.7.2.0 Synopsis: Higher-order Functional Reactive Programming-Description: Reflex is a high-performance, deterministic, higher-order Functional Reactive Programming system+Description:+ Interactive programs without callbacks or side-effects.+ Functional Reactive Programming (FRP) uses composable events and time-varying+ values to describe interactive systems as pure functions.+ Just like other pure functional code, functional reactive code is easier+ to get right on the first try, maintain, and reuse.+ .+ Reflex is a fully-deterministic, higher-order Functional Reactive Programming+ interface and an engine that efficiently implements that interface.+ .+ <https://reflex-frp.org> License: BSD3 License-file: LICENSE Author: Ryan Trinkle@@ -18,8 +28,8 @@ ChangeLog.md tested-with:- GHC ==8.4.4 || ==8.6.5 || ==8.8.1 || ==8.10.2,- GHCJS ==8.6+ GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1,+ GHCJS ==8.4 flag use-reflex-optimizer description: Use the GHC plugin Reflex.Optimizer on some of the modules in the package. This is still experimental.@@ -61,7 +71,7 @@ hs-source-dirs: src build-depends: MemoTrie == 0.6.*,- base >= 4.11 && < 4.15,+ base >= 4.9 && < 4.14, bifunctors >= 5.2 && < 5.6, comonad >= 5.0.4 && < 5.1, constraints-extras >= 0.3 && < 0.4,@@ -70,12 +80,13 @@ dependent-map >= 0.3 && < 0.5, exception-transformers == 0.4.*, lens >= 4.7 && < 5,+ mmorph >= 1.0 && < 1.2, monad-control >= 1.0.1 && < 1.1, mtl >= 2.1 && < 2.3, patch >= 0.0.1 && < 0.1, prim-uniq >= 0.1.0.1 && < 0.3, primitive >= 0.5 && < 0.8,- profunctors >= 5.3 && < 5.7,+ profunctors >= 5.3 && < 5.6, random == 1.1.*, ref-tf == 0.4.*, reflection == 2.1.*,@@ -154,7 +165,8 @@ if flag(debug-trace-events) cpp-options: -DDEBUG_TRACE_EVENTS- build-depends: bytestring+ build-depends:+ bytestring >= 0.10.8 && < 0.11 if flag(use-reflex-optimizer) cpp-options: -DUSE_REFLEX_OPTIMIZER@@ -173,19 +185,20 @@ dependent-sum >= 0.6 && < 0.8, haskell-src-exts >= 1.16 && < 1.24, haskell-src-meta >= 0.6 && < 0.9,- template-haskell >= 2.9 && < 2.17+ template-haskell >= 2.9 && < 2.16 exposed-modules: Reflex.Dynamic.TH other-extensions: TemplateHaskell else build-depends:- dependent-sum >= 0.6 && < 0.7+ dependent-sum >= 0.6 && < 0.8 if flag(fast-weak) && impl(ghcjs) cpp-options: -DGHCJS_FAST_WEAK if impl(ghcjs)- build-depends: ghcjs-base+ build-depends:+ ghcjs-base == 0.2.* test-suite semantics default-language: Haskell2010@@ -331,6 +344,14 @@ Reflex.TestPlan Reflex.Plan.Pure Test.Run++test-suite Headless+ default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: Headless.hs+ hs-source-dirs: test+ build-depends: base+ , reflex test-suite Adjustable default-language: Haskell2010
src/Reflex/BehaviorWriter/Base.hs view
@@ -24,6 +24,7 @@ import Control.Monad.Exception import Control.Monad.Identity import Control.Monad.IO.Class+import Control.Monad.Morph import Control.Monad.Reader import Control.Monad.Ref import Control.Monad.State.Strict@@ -48,7 +49,18 @@ -- | A basic implementation of 'BehaviorWriter'. newtype BehaviorWriterT t w m a = BehaviorWriterT { unBehaviorWriterT :: StateT [Behavior t w] m a }- deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadAsyncException, MonadException) -- The list is kept in reverse order+ -- The list is kept in reverse order+ deriving+ ( Functor+ , Applicative+ , Monad+ , MonadTrans+ , MFunctor+ , MonadIO+ , MonadFix+ , MonadAsyncException+ , MonadException+ ) -- | Run a 'BehaviorWriterT' action. The behavior writer output will be provided -- along with the result of the action.@@ -72,9 +84,6 @@ deriving instance MonadHold t m => MonadHold t (BehaviorWriterT t w m) deriving instance MonadSample t m => MonadSample t (BehaviorWriterT t w m)--instance MonadTrans (BehaviorWriterT t w) where- lift = BehaviorWriterT . lift instance MonadRef m => MonadRef (BehaviorWriterT t w m) where type Ref (BehaviorWriterT t w m) = Ref m
src/Reflex/Class.hs view
@@ -421,6 +421,13 @@ -- | Create a new 'Event' that only occurs only once, on the first occurrence of -- the supplied 'Event'. headE :: Event t a -> m (Event t a)+ -- | An event which only occurs at the current moment in time, such that:+ --+ -- > coincidence (pushAlways (\a -> (a <$) <$> now) e) = e+ --+ now :: m (Event t ())+ default now :: (m ~ f m', MonadTrans f, MonadHold t m') => m (Event t ())+ now = lift now -- | Accumulate an 'Incremental' with the supplied initial value and the firings of the provided 'Event', -- using the combining function to produce a patch.@@ -566,6 +573,7 @@ holdIncremental a0 = lift . holdIncremental a0 buildDynamic a0 = lift . buildDynamic a0 headE = lift . headE+ now = lift now instance (MonadSample t m, Monoid r) => MonadSample t (WriterT r m) where sample = lift . sample@@ -576,6 +584,7 @@ holdIncremental a0 = lift . holdIncremental a0 buildDynamic a0 = lift . buildDynamic a0 headE = lift . headE+ now = lift now instance MonadSample t m => MonadSample t (StateT s m) where sample = lift . sample@@ -586,6 +595,7 @@ holdIncremental a0 = lift . holdIncremental a0 buildDynamic a0 = lift . buildDynamic a0 headE = lift . headE+ now = lift now instance MonadSample t m => MonadSample t (ExceptT e m) where sample = lift . sample@@ -596,6 +606,7 @@ holdIncremental a0 = lift . holdIncremental a0 buildDynamic a0 = lift . buildDynamic a0 headE = lift . headE+ now = lift now instance (MonadSample t m, Monoid w) => MonadSample t (RWST r w s m) where sample = lift . sample@@ -606,6 +617,7 @@ holdIncremental a0 = lift . holdIncremental a0 buildDynamic a0 = lift . buildDynamic a0 headE = lift . headE+ now = lift now instance MonadSample t m => MonadSample t (ContT r m) where sample = lift . sample@@ -616,6 +628,7 @@ holdIncremental a0 = lift . holdIncremental a0 buildDynamic a0 = lift . buildDynamic a0 headE = lift . headE+ now = lift now -------------------------------------------------------------------------------- -- Convenience functions
src/Reflex/DynamicWriter/Base.hs view
@@ -22,6 +22,7 @@ import Control.Monad.Exception import Control.Monad.Identity import Control.Monad.IO.Class+import Control.Monad.Morph import Control.Monad.Primitive import Control.Monad.Reader import Control.Monad.Ref@@ -51,9 +52,6 @@ import Reflex.Requester.Class import Reflex.TriggerEvent.Class -instance MonadTrans (DynamicWriterT t w) where- lift = DynamicWriterT . lift- mapIncrementalMapValues :: (Reflex t, Patch (p v), Patch (p v'), PatchTarget (p v) ~ f v, PatchTarget (p v') ~ f v', Functor p, Functor f) => (v -> v') -> Incremental t (p v) -> Incremental t (p v') mapIncrementalMapValues f = unsafeMapIncremental (fmap f) (fmap f) @@ -90,7 +88,18 @@ -- | A basic implementation of 'DynamicWriter'. newtype DynamicWriterT t w m a = DynamicWriterT { unDynamicWriterT :: StateT [Dynamic t w] m a }- deriving (Functor, Applicative, Monad, MonadIO, MonadFix, MonadAsyncException, MonadException) -- The list is kept in reverse order+ -- The list is kept in reverse order+ deriving+ ( Functor+ , Applicative+ , Monad+ , MonadTrans+ , MFunctor+ , MonadIO+ , MonadFix+ , MonadAsyncException+ , MonadException+ ) deriving instance MonadHold t m => MonadHold t (DynamicWriterT t w m) deriving instance MonadSample t m => MonadSample t (DynamicWriterT t w m)
src/Reflex/EventWriter/Base.hs view
@@ -35,6 +35,7 @@ import Control.Monad.Exception import Control.Monad.Identity+import Control.Monad.Morph import Control.Monad.Primitive import Control.Monad.Reader import Control.Monad.Ref@@ -97,7 +98,17 @@ -- | A basic implementation of 'EventWriter'. newtype EventWriterT t w m a = EventWriterT { unEventWriterT :: StateT (EventWriterState t w) m a }- deriving (Functor, Applicative, Monad, MonadFix, MonadIO, MonadException, MonadAsyncException)+ deriving+ ( Functor+ , Applicative+ , Monad+ , MonadTrans+ , MFunctor+ , MonadFix+ , MonadIO+ , MonadException+ , MonadAsyncException+ ) -- | Run a 'EventWriterT' action. runEventWriterT :: forall t m w a. (Reflex t, Monad m, Semigroup w) => EventWriterT t w m a -> m (a, Event t w)@@ -117,9 +128,6 @@ , _eventWriterState_told = (tellId myId :=> w) : _eventWriterState_told old } -instance MonadTrans (EventWriterT t w) where- lift = EventWriterT . lift- instance MonadSample t m => MonadSample t (EventWriterT t w m) where sample = lift . sample @@ -134,6 +142,8 @@ buildDynamic a0 = lift . buildDynamic a0 {-# INLINABLE headE #-} headE = lift . headE+ {-# INLINABLE now #-}+ now = lift now instance (Reflex t, Adjustable t m, MonadHold t m, Semigroup w) => Adjustable t (EventWriterT t w m) where runWithReplace = runWithReplaceEventWriterTWith $ \dm0 dm' -> lift $ runWithReplace dm0 dm'
src/Reflex/Host/Headless.hs view
@@ -7,6 +7,7 @@ module Reflex.Host.Headless where import Control.Concurrent.Chan (newChan, readChan)+import Control.Monad (unless) import Control.Monad.Fix (MonadFix, fix) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Primitive (PrimMonad)@@ -15,7 +16,7 @@ import Data.Foldable (for_) import Data.Functor.Identity (Identity(..)) import Data.IORef (IORef, readIORef)-import Data.Maybe (catMaybes)+import Data.Maybe (catMaybes, fromMaybe) import Data.Traversable (for) import Reflex@@ -82,32 +83,33 @@ -- 'Nothing' if the guest application hasn't subscribed to this event. mPostBuildTrigger <- readRef postBuildTriggerRef - -- When there is a subscriber to the post-build event, fire the event.- for_ mPostBuildTrigger $ \postBuildTrigger ->- fire [postBuildTrigger :=> Identity ()] $ pure ()- -- Subscribe to an 'Event' of that the guest application can use to -- request application shutdown. We'll check whether this 'Event' is firing -- to determine whether to terminate. shutdown <- subscribeEvent result + -- When there is a subscriber to the post-build event, fire the event.+ soa <- for mPostBuildTrigger $ \postBuildTrigger ->+ fire [postBuildTrigger :=> Identity ()] $ isFiring shutdown+ -- The main application loop. We wait for new events and fire those that -- have subscribers. If we detect a shutdown request, the application -- terminates.- fix $ \loop -> do+ unless (or (fromMaybe [] soa)) $ fix $ \loop -> do -- Read the next event (blocking). ers <- liftIO $ readChan events stop <- do -- Fire events that have subscribers. fireEventTriggerRefs fc ers $ -- Check if the shutdown 'Event' is firing.- readEvent shutdown >>= \case- Nothing -> pure False- Just _ -> pure True+ isFiring shutdown if or stop then pure () else loop where+ isFiring ev = readEvent ev >>= \case+ Nothing -> pure False+ Just _ -> pure True -- Use the given 'FireCommand' to fire events that have subscribers -- and call the callback for the 'TriggerInvocation' of each. fireEventTriggerRefs
src/Reflex/PerformEvent/Base.hs view
@@ -164,6 +164,8 @@ buildDynamic getV0 v' = PerformEventT $ lift $ buildDynamic getV0 v' {-# INLINABLE headE #-} headE = PerformEventT . lift . headE+ {-# INLINABLE now #-}+ now = PerformEventT . lift $ now instance (MonadRef (HostFrame t), ReflexHost t) => MonadRef (PerformEventT t m) where type Ref (PerformEventT t m) = Ref (HostFrame t)
src/Reflex/PostBuild/Base.hs view
@@ -83,6 +83,8 @@ buildDynamic a0 = lift . buildDynamic a0 {-# INLINABLE headE #-} headE = lift . headE+ {-# INLINABLE now #-}+ now = lift now instance PerformEvent t m => PerformEvent t (PostBuildT t m) where type Performable (PostBuildT t m) = Performable m
src/Reflex/Profiled.hs view
@@ -147,7 +147,7 @@ pushCheap f (Event_Profiled e) = coerce $ pushCheap (coerce f) $ profileEvent e pull = Behavior_Profiled . pull . coerce fanG (Event_Profiled e) = EventSelectorG $ coerce $ selectG (fanG $ profileEvent e)- mergeG :: forall z (k :: z -> *) q v. GCompare k+ mergeG :: forall (k :: z -> *) q v. GCompare k => (forall a. q a -> Event (ProfiledTimeline t) (v a)) -> DMap k q -> Event (ProfiledTimeline t) (DMap k v) mergeG nt = Event_Profiled #. mergeG (coerce nt)@@ -184,6 +184,7 @@ holdIncremental v0 (Event_Profiled v') = ProfiledM $ Incremental_Profiled <$> holdIncremental v0 v' buildDynamic (ProfiledM v0) (Event_Profiled v') = ProfiledM $ Dynamic_Profiled <$> buildDynamic v0 v' headE (Event_Profiled e) = ProfiledM $ Event_Profiled <$> headE e+ now = ProfiledM $ Event_Profiled <$> now instance MonadSample t m => MonadSample (ProfiledTimeline t) (ProfiledM m) where sample (Behavior_Profiled b) = ProfiledM $ sample b
src/Reflex/Pure.hs view
@@ -211,3 +211,7 @@ Just x -> fromMaybe lastValue $ apply x lastValue headE = slowHeadE+ now t = Event $ guard . (t ==)++ +
src/Reflex/Query/Base.hs view
@@ -22,6 +22,7 @@ import Control.Applicative (liftA2) import Control.Monad.Exception import Control.Monad.Fix+import Control.Monad.Morph import Control.Monad.Primitive import Control.Monad.Reader import Control.Monad.Ref@@ -238,6 +239,9 @@ instance MonadTrans (QueryT t q) where lift = QueryT . lift . lift . lift++instance MFunctor (QueryT t q) where+ hoist = mapQueryT instance PrimMonad m => PrimMonad (QueryT t q m) where type PrimState (QueryT t q m) = PrimState m
src/Reflex/Requester/Base.hs view
@@ -49,6 +49,7 @@ import Control.Applicative (liftA2) import Control.Monad.Exception import Control.Monad.Identity+import Control.Monad.Morph import Control.Monad.Primitive import Control.Monad.Reader import Control.Monad.Ref@@ -316,6 +317,9 @@ instance MonadTrans (RequesterT t request response) where lift = RequesterT . lift . lift++instance MFunctor (RequesterT t request response) where+ hoist f = RequesterT . hoist (hoist f) . unRequesterT instance PerformEvent t m => PerformEvent t (RequesterT t request response m) where type Performable (RequesterT t request response m) = Performable m
src/Reflex/Spider/Internal.hs view
@@ -307,7 +307,20 @@ #endif } +nowSpiderEventM :: (HasSpiderTimeline x) => EventM x (R.Event (SpiderTimeline x) ())+nowSpiderEventM =+ SpiderEvent <$> now +now :: (MonadIO m, Defer (Some Clear) m, HasSpiderTimeline x+ ) => m (Event x ())+now = do+ nowOrNot <- liftIO $ newIORef $ Just ()+ scheduleClear nowOrNot+ return . Event $ \_ -> do+ occ <- liftIO . readIORef $ nowOrNot+ return ( EventSubscription (return ()) eventSubscribedNow+ , occ+ ) -- | Construct an 'Event' whose value is guaranteed not to be recomputed -- repeatedly@@ -594,6 +607,16 @@ , eventSubscribedWhoCreated = return ["never"] #endif }+eventSubscribedNow :: EventSubscribed x+eventSubscribedNow = EventSubscribed+ { eventSubscribedHeightRef = zeroRef+ , eventSubscribedRetained = toAny ()+#ifdef DEBUG_CYCLES+ , eventSubscribedGetParents = return []+ , eventSubscribedHasOwnHeightRef = False+ , eventSubscribedWhoCreated = return ["now"]+#endif+ } eventSubscribedFan :: FanSubscribed x k v -> EventSubscribed x eventSubscribedFan !subscribed = EventSubscribed@@ -2497,6 +2520,8 @@ {-# INLINABLE headE #-} headE = R.slowHeadE -- headE (SpiderEvent e) = SpiderEvent <$> Reflex.Spider.Internal.headE e+ {-# INLINABLE now #-}+ now = nowSpiderEventM instance Reflex.Class.MonadSample (SpiderTimeline x) (SpiderPullM x) where {-# INLINABLE sample #-}@@ -2518,7 +2543,10 @@ {-# INLINABLE headE #-} headE = R.slowHeadE -- headE (SpiderEvent e) = SpiderPushM $ SpiderEvent <$> Reflex.Spider.Internal.headE e+ {-# INLINABLE now #-}+ now = SpiderPushM nowSpiderEventM + instance HasSpiderTimeline x => Monad (Reflex.Class.Dynamic (SpiderTimeline x)) where {-# INLINE return #-} return = pure@@ -2581,6 +2609,9 @@ buildDynamic getV0 e = runFrame . runSpiderHostFrame $ Reflex.Class.buildDynamic getV0 e {-# INLINABLE headE #-} headE e = runFrame . runSpiderHostFrame $ Reflex.Class.headE e+ {-# INLINABLE now #-}+ now = runFrame . runSpiderHostFrame $ Reflex.Class.now+ instance HasSpiderTimeline x => Reflex.Class.MonadSample (SpiderTimeline x) (SpiderHostFrame x) where sample = SpiderHostFrame . readBehaviorUntracked . unSpiderBehavior --TODO: This can cause problems with laziness, so we should get rid of it if we can@@ -2597,6 +2628,8 @@ {-# INLINABLE headE #-} headE = R.slowHeadE -- headE (SpiderEvent e) = SpiderHostFrame $ SpiderEvent <$> Reflex.Spider.Internal.headE e+ {-# INLINABLE now #-}+ now = SpiderHostFrame Reflex.Class.now instance HasSpiderTimeline x => Reflex.Class.MonadSample (SpiderTimeline x) (SpiderHost x) where {-# INLINABLE sample #-}@@ -2617,6 +2650,8 @@ buildDynamic getV0 e = Reflex.Spider.Internal.ReadPhase $ Reflex.Class.buildDynamic getV0 e {-# INLINABLE headE #-} headE e = Reflex.Spider.Internal.ReadPhase $ Reflex.Class.headE e+ {-# INLINABLE now #-}+ now = Reflex.Spider.Internal.ReadPhase Reflex.Class.now -------------------------------------------------------------------------------- -- Deprecated items@@ -2740,7 +2775,7 @@ fanG e = R.EventSelectorG $ SpiderEvent . selectG (fanG (unSpiderEvent e)) {-# INLINABLE mergeG #-} mergeG- :: forall k2 (k :: k2 -> *) q (v :: k2 -> *). GCompare k+ :: forall (k :: k2 -> *) q (v :: k2 -> *). GCompare k => (forall a. q a -> R.Event (SpiderTimeline x) (v a)) -> DMap k q -> R.Event (SpiderTimeline x) (DMap k v)
src/Reflex/TriggerEvent/Base.hs view
@@ -122,6 +122,8 @@ buildDynamic a0 = lift . buildDynamic a0 {-# INLINABLE headE #-} headE = lift . headE+ {-# INLINABLE now #-}+ now = lift now instance Adjustable t m => Adjustable t (TriggerEventT t m) where {-# INLINABLE runWithReplace #-}
+ test/Headless.hs view
@@ -0,0 +1,10 @@+module Main where++import Reflex+import Reflex.Host.Headless (runHeadlessApp)++main :: IO ()+main = do+ runHeadlessApp $ do+ pb <- getPostBuild+ performEvent (pure <$> pb)
test/Reflex/Plan/Pure.hs view
@@ -41,6 +41,7 @@ holdIncremental initial = liftPlan . holdIncremental initial buildDynamic getInitial = liftPlan . buildDynamic getInitial headE = liftPlan . headE+ now = liftPlan now instance MonadSample (Pure Int) PurePlan where sample = liftPlan . sample
test/Reflex/Test/Micro.hs view
@@ -322,8 +322,14 @@ let e = never <$ switch b return $ void e lazyHold--+ , testE "now-1" $ do+ e1 <- events1+ switchHoldPromptly never . pushAlways (\a -> fmap (a <$) now) $ e1+ , testE "now-2" $ do+ e1 <- events1+ let e = pushAlways (\a -> if a == "a" then now else return never) e1+ x <- accumDyn (<>) never e + return . coincidence $ updated x ] where events1, events2, events3 :: TestPlan t m => m (Event t String)