on develop help sign in
Merge pull request #150 from ag-eitilt/release-0.4.0.1

Patch 0.4.0.1

commit3b7a4b084fb3c17b2962676aebf0cfb9a0baebf1 authorRyan Trinkle <ryan.trinkle@gmail.com> dateMon 1 Jan 2018, 22:55 (9 years ago) parentcc62c11f6c00f6
5 files changed+51−32
README.md+6−6 bench/Main.hs+9−7 reflex.cabal+16−16 src/Reflex/Dynamic/TH.hs+17−1 test/Reflex/Plan/Reflex.hs+3−2
README.md+6−6
@@ -3,17 +3,17 @@
33
44Reflex is an fully-deterministic, higher-order Functional Reactive Programming (FRP) interface and an engine that efficiently implements that interface.
55
6−[Reflex-DOM](https://github.com/ryantrinkle/reflex-dom) is a framework built on Reflex that facilitates the development of web pages, including highly-interactive single-page apps.
6+[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.
77
8−Comprehensive documentation is still a work in progress, but a tutorial for Reflex and Reflex-DOM is available at https://github.com/ryantrinkle/try-reflex and an introductory talk given at the New York Haskell Meetup is available here: [Part 1](https://www.youtube.com/watch?v=mYvkcskJbc4) / [Part 2](https://www.youtube.com/watch?v=3qfc9XFVo2c).
8+Comprehensive documentation is still a work in progress, but a tutorial for Reflex and Reflex-DOM is available at https://github.com/reflex-frp/reflex-platform and an introductory talk given at the New York Haskell Meetup is available here: [Part 1](https://www.youtube.com/watch?v=mYvkcskJbc4) / [Part 2](https://www.youtube.com/watch?v=3qfc9XFVo2c).
99
1010A summary of Reflex functions is available in the [quick reference](Quickref.md).
1111
1212### Additional resources
13−[try reflex](https://github.com/ryantrinkle/try-reflex)
13+[Get started with Reflex](https://github.com/reflex-frp/reflex-platform)
1414
15−[reddit/r/reflexfrp](http://www.reddit.com/r/reflexfrp)
15+[/r/reflexfrp](https://www.reddit.com/r/reflexfrp)
1616
17−[reflex at hackage](https://hackage.haskell.org/package/reflex)
17+[hackage](https://hackage.haskell.org/package/reflex)
1818
19−irc.freenode.net #reflex-frp
19+[irc.freenode.net #reflex-frp](http://webchat.freenode.net?channels=%23reflex-frp&uio=d4)
bench/Main.hs+9−7
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE BangPatterns #-}
23{-# LANGUAGE TupleSections #-}
34{-# LANGUAGE ScopedTypeVariables #-}
@@ -7,6 +8,7 @@ module Main where
78import Data.Functor.Misc
89import Control.Monad.Primitive
910import Control.Monad.IO.Class
11+import Control.Monad.Identity
1012import Data.Dependent.Sum
1113import Control.Concurrent.STM
1214import Control.Applicative
@@ -21,8 +23,6 @@ import System.Mem
2123import System.IO
2224import Criterion.Main
2325
24−import qualified Data.Traversable as T
25−
2626import qualified Data.Dependent.Map as DM
2727
2828
@@ -30,8 +30,10 @@ main :: IO ()
3030main = defaultMain
3131 [ bgroup "micro" micros ]
3232
33+#if !(MIN_VERSION_deepseq(1,4,2))
3334instance NFData (IORef a) where
3435 rnf x = seq x ()
36+#endif
3537
3638instance NFData (TVar a) where
3739 rnf x = seq x ()
@@ -73,7 +75,7 @@ micros =
7375 (newEventWithTriggerRef >>= subscribePair)
7476 (\(subd, trigger) -> do
7577 Just key <- liftIO $ readIORef trigger
76− fireEvents [key :=> (42 :: Int)])
78+ fireEvents [key :=> Identity (42 :: Int)])
7779 , withSetupWHNF "fireEventsAndRead(head/merge1)"
7880 (setupMerge 1 >>= subscribePair)
7981 (\(subd, t:riggers) -> fireAndRead t (42 :: Int) subd)
@@ -87,17 +89,17 @@ micros =
8789 (setupMerge 100 >>= subscribePair)
8890 (\(subd, t:riggers) -> do
8991 Just key <- liftIO $ readIORef t
90− fireEvents [key :=> (42 :: Int)])
92+ fireEvents [key :=> Identity (42 :: Int)])
9193 , withSetupWHNF "hold" newEventWithTriggerRef $ \(ev,trigger) -> hold (42 :: Int) ev
9294 , withSetupWHNF "sample" (newEventWithTriggerRef >>= hold (42 :: Int) . fst) sample
9395 ]
9496
9597setupMerge :: Int
96− -> SpiderHost (Event Spider (DM.DMap (Const2 Int a)),
98+ -> SpiderHost (Event Spider (DM.DMap (Const2 Int a) Identity),
9799 [IORef (Maybe (EventTrigger Spider a))])
98100setupMerge num = do
99101 (evs, triggers) <- unzip <$> replicateM 100 newEventWithTriggerRef
100− let !m = DM.fromList [WrapArg (Const2 i) :=> v | (i,v) <- zip [0..] evs]
102+ let !m = DM.fromList [(Const2 i) :=> v | (i,v) <- zip [0..] evs]
101103 pure (merge m, triggers)
102104
103105subscribePair :: (Event Spider a, b) -> SpiderHost (EventHandle Spider a, b)
@@ -107,4 +109,4 @@ fireAndRead :: IORef (Maybe (EventTrigger Spider a)) -> a -> EventHandle Spider
107109 -> SpiderHost (Maybe b)
108110fireAndRead trigger val subd = do
109111 Just key <- liftIO $ readIORef trigger
110− fireEventsAndRead [key :=> val] $ readEvent subd >>= T.sequence
112+ fireEventsAndRead [key :=> Identity val] $ readEvent subd >>= sequence
reflex.cabal+16−16
@@ -1,5 +1,5 @@
11Name: reflex
2−Version: 0.4.0
2+Version: 0.4.0.1
33Synopsis: Higher-order Functional Reactive Programming
44Description: Reflex is a high-performance, deterministic, higher-order Functional Reactive Programming system
55License: BSD3
@@ -10,28 +10,28 @@ Stability: Experimental
1010Category: FRP
1111Build-type: Simple
1212Cabal-version: >=1.9.2
13−homepage: https://github.com/ryantrinkle/reflex
14−bug-reports: https://github.com/ryantrinkle/reflex/issues
13+homepage: https://github.com/reflex-frp/reflex
14+bug-reports: https://github.com/reflex-frp/reflex/issues
1515
1616library
1717 hs-source-dirs: src
1818 build-depends:
19− base >= 4.7 && < 4.9,
20− dependent-sum == 0.3.*,
19+ base >= 4.7 && < 4.10,
20+ dependent-sum >= 0.3 && < 0.5,
2121 dependent-map == 0.2.*,
2222 semigroups >= 0.16 && < 0.19,
2323 mtl >= 2.1 && < 2.3,
2424 containers == 0.5.*,
25− these >= 0.4 && < 0.7,
25+ these >= 0.4 && < 0.8,
2626 primitive >= 0.5 && < 0.7,
27− template-haskell >= 2.9 && < 2.11,
27+ template-haskell >= 2.9 && < 2.13,
2828 ref-tf == 0.4.*,
2929 exception-transformers == 0.4.*,
3030 transformers >= 0.2,
3131 transformers-compat >= 0.3,
32− haskell-src-exts == 1.16.*,
33− haskell-src-meta == 0.6.*,
34− syb == 0.5.*
32+ haskell-src-exts >= 1.16 && < 1.20,
33+ haskell-src-meta >= 0.6 && < 0.9,
34+ syb >= 0.4.4 && < 0.8
3535
3636 exposed-modules:
3737 Reflex,
@@ -71,12 +71,12 @@ benchmark spider-bench
7171 base,
7272 dependent-sum,
7373 dependent-map,
74− transformers >= 0.3 && < 0.5,
74+ transformers >= 0.3 && < 0.6,
7575 stm == 2.4.*,
7676 deepseq >= 1.3 && < 1.5,
7777 mtl,
7878 primitive,
79− criterion == 1.1.*,
79+ criterion >= 1.1 && < 1.3,
8080 reflex
8181
8282benchmark saulzar-bench
@@ -87,18 +87,18 @@ benchmark saulzar-bench
8787 build-depends:
8888 base,
8989 containers == 0.5.*,
90− ref-tf == 0.4,
90+ ref-tf == 0.4.*,
9191 dependent-sum,
9292 dependent-map,
93− transformers >= 0.3 && < 0.5,
93+ transformers >= 0.3 && < 0.6,
9494 stm == 2.4.*,
9595 deepseq >= 1.3 && < 1.5,
9696 mtl,
9797 primitive,
98− criterion == 1.1.*,
98+ criterion >= 1.1 && < 1.3,
9999 split,
100100 reflex
101101
102102source-repository head
103103 type: git
104− location: https://github.com/ryantrinkle/reflex
104+ location: https://github.com/reflex-frp/reflex
src/Reflex/Dynamic/TH.hs+17−1
@@ -1,4 +1,10 @@
1−{-# LANGUAGE TemplateHaskell, ScopedTypeVariables, TypeOperators, GADTs, EmptyDataDecls, PatternGuards #-}
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE EmptyDataDecls #-}
3+{-# LANGUAGE GADTs #-}
4+{-# LANGUAGE PatternGuards #-}
5+{-# LANGUAGE ScopedTypeVariables #-}
6+{-# LANGUAGE TemplateHaskell #-}
7+{-# LANGUAGE TypeOperators #-}
28module Reflex.Dynamic.TH (qDyn, unqDyn, mkDyn) where
39
410import Reflex.Dynamic
@@ -56,12 +62,22 @@ mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ H
5662 Hs.ParseFailed (Hs.SrcLoc _ l c) err -> fail $ "mkDyn:" <> show l <> ":" <> show c <> ": " <> err
5763 Hs.ParseOk e -> qDyn $ return $ everywhere (id `extT` reinstateUnqDyn) $ Hs.toExp $ everywhere (id `extT` antiE) e
5864 where TH.Name (TH.OccName occName) (TH.NameG _ _ (TH.ModName modName)) = 'unqMarker
65+#if MIN_VERSION_haskell_src_exts(1,18,0)
66+ antiE :: Hs.Exp Hs.SrcSpanInfo -> Hs.Exp Hs.SrcSpanInfo
67+ antiE x = case x of
68+ Hs.SpliceExp l se ->
69+ Hs.App l (Hs.Var l $ Hs.Qual l (Hs.ModuleName l modName) (Hs.Ident l occName)) $ case se of
70+ Hs.IdSplice l2 v -> Hs.Var l2 $ Hs.UnQual l2 $ Hs.Ident l2 v
71+ Hs.ParenSplice _ ps -> ps
72+ _ -> x
73+#else
5974 antiE x = case x of
6075 Hs.SpliceExp se ->
6176 Hs.App (Hs.Var $ Hs.Qual (Hs.ModuleName modName) (Hs.Ident occName)) $ case se of
6277 Hs.IdSplice v -> Hs.Var $ Hs.UnQual $ Hs.Ident v
6378 Hs.ParenSplice ps -> ps
6479 _ -> x
80+#endif
6581 reinstateUnqDyn (TH.Name (TH.OccName occName') (TH.NameQ (TH.ModName modName')))
6682 | modName == modName' && occName == occName' = 'unqMarker
6783 reinstateUnqDyn x = x
test/Reflex/Plan/Reflex.hs+3−2
@@ -24,6 +24,7 @@ import Reflex.TestPlan
2424
2525import Control.Applicative
2626import Control.Monad
27+import Control.Monad.Identity
2728import Control.Monad.State.Strict
2829
2930import Data.Dependent.Sum (DSum (..))
@@ -71,8 +72,8 @@ instance (ReflexHost t, MonadRef (HostFrame t), Ref (HostFrame t) ~ Ref IO) => T
7172 makeFiring ref (t, a) = (fromIntegral t, [Firing ref a])
7273
7374
74−firingTrigger :: (MonadReflexHost t m, MonadIORef m) => Firing t -> m (Maybe (DSum (EventTrigger t)))
75−firingTrigger (Firing ref a) = fmap (:=> a) <$> readRef ref
75+firingTrigger :: (MonadReflexHost t m, MonadIORef m) => Firing t -> m (Maybe (DSum (EventTrigger t) Identity))
76+firingTrigger (Firing ref a) = fmap (:=> Identity a) <$> readRef ref
7677
7778runPlan :: (MonadReflexHost t m, MonadIORef m) => Plan t a -> m (a, Schedule t)
7879runPlan (Plan p) = runHostFrame $ runStateT p mempty