on develop help sign in
wip
8c7653eRyan Trinkle
reflex.cabal+5−1
@@ -28,8 +28,8 @@ library
28 lens >= 4.7 && < 5,
28 lens >= 4.7 && < 5,
29 monad-control >= 1.0.1 && < 1.1,
29 monad-control >= 1.0.1 && < 1.1,
30 mtl >= 2.1 && < 2.3,
30 mtl >= 2.1 && < 2.3,
31− primitive >= 0.5 && < 0.7,
32 prim-uniq >= 0.1.0.1 && < 0.2,
31 prim-uniq >= 0.1.0.1 && < 0.2,
32+ primitive >= 0.5 && < 0.7,
33 ref-tf == 0.4.*,
33 ref-tf == 0.4.*,
34 semigroupoids >= 4.0 && < 6,
34 semigroupoids >= 4.0 && < 6,
35 semigroups >= 0.16 && < 0.19,
35 semigroups >= 0.16 && < 0.19,
@@ -57,6 +57,10 @@ library
57 Reflex.Spider,
57 Reflex.Spider,
58 Reflex.Spider.Internal
58 Reflex.Spider.Internal
59
59
60+ if !impl(ghcjs)
61+ build-depends: ghc
62+ exposed-modules: Reflex.Optimizer
63+
60 other-extensions: TemplateHaskell
64 other-extensions: TemplateHaskell
61 ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
65 ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
62 ghc-prof-options: -auto-all
66 ghc-prof-options: -auto-all
src/Data/Functor/Misc.hs+1
@@ -8,6 +8,7 @@
8{-# LANGUAGE RankNTypes #-}
8{-# LANGUAGE RankNTypes #-}
9{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE ScopedTypeVariables #-}
10{-# LANGUAGE StandaloneDeriving #-}
10{-# LANGUAGE StandaloneDeriving #-}
11+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
11-- | This module provides types and functions with no particular theme, but
12-- | This module provides types and functions with no particular theme, but
12-- which are relevant to the use of 'Functor'-based datastructures like
13-- which are relevant to the use of 'Functor'-based datastructures like
13-- 'Data.Dependent.Map.DMap'.
14-- 'Data.Dependent.Map.DMap'.
src/Data/WeakBag.hs+1
@@ -1,5 +1,6 @@
1{-# LANGUAGE BangPatterns #-}
1{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE ExistentialQuantification #-}
2{-# LANGUAGE ExistentialQuantification #-}
3+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
3-- | This module defines the 'WeakBag' type, which represents a mutable
4-- | This module defines the 'WeakBag' type, which represents a mutable
4-- collection of items that does not cause the items to be retained in memory.
5-- collection of items that does not cause the items to be retained in memory.
5-- This is useful for situations where a value needs to be inspected or modified
6-- This is useful for situations where a value needs to be inspected or modified
src/Reflex/Class.hs+5−2
@@ -14,6 +14,7 @@
14{-# LANGUAGE TypeFamilies #-}
14{-# LANGUAGE TypeFamilies #-}
15{-# LANGUAGE TypeOperators #-}
15{-# LANGUAGE TypeOperators #-}
16{-# LANGUAGE UndecidableInstances #-}
16{-# LANGUAGE UndecidableInstances #-}
17+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
17
18
18-- | This module contains the Reflex interface, as well as a variety of
19-- | This module contains the Reflex interface, as well as a variety of
19-- convenience functions for working with 'Event's, 'Behavior's, and other
20-- convenience functions for working with 'Event's, 'Behavior's, and other
@@ -141,8 +142,6 @@ import Debug.Trace (trace)
141class ( MonadHold t (PushM t)
142class ( MonadHold t (PushM t)
142 , MonadSample t (PullM t)
143 , MonadSample t (PullM t)
143 , MonadFix (PushM t)
144 , MonadFix (PushM t)
144− , Functor (Event t)
145− , Functor (Behavior t)
146 , Functor (Dynamic t)
145 , Functor (Dynamic t)
147 , Applicative (Dynamic t) -- Necessary for GHC <= 7.8
146 , Applicative (Dynamic t) -- Necessary for GHC <= 7.8
148 , Monad (Dynamic t)
147 , Monad (Dynamic t)
@@ -507,9 +506,11 @@ instance Reflex t => Bind (Event t) where
507 join = coincidence
506 join = coincidence
508
507
509instance Reflex t => Functor (Event t) where
508instance Reflex t => Functor (Event t) where
509+ {-# INLINE fmap #-}
510 fmap f = fmapMaybe $ Just . f
510 fmap f = fmapMaybe $ Just . f
511
511
512instance Reflex t => FunctorMaybe (Event t) where
512instance Reflex t => FunctorMaybe (Event t) where
513+ {-# INLINE fmapMaybe #-}
513 fmapMaybe f = push $ return . f
514 fmapMaybe f = push $ return . f
514
515
515-- | Never: @'zero' = 'never'@.
516-- | Never: @'zero' = 'never'@.
@@ -645,6 +646,7 @@ instance (Semigroup a, Reflex t) => Monoid (Event t a) where
645-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
646-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
646-- list occurs. If multiple occur at the same time they are folded from the left
647-- list occurs. If multiple occur at the same time they are folded from the left
647-- with the given function.
648-- with the given function.
649+{-# INLINE mergeWith #-}
648mergeWith :: Reflex t => (a -> a -> a) -> [Event t a] -> Event t a
650mergeWith :: Reflex t => (a -> a -> a) -> [Event t a] -> Event t a
649mergeWith f es = fmap (Prelude.foldl1 f . map (\(Const2 _ :=> Identity v) -> v) . DMap.toList)
651mergeWith f es = fmap (Prelude.foldl1 f . map (\(Const2 _ :=> Identity v) -> v) . DMap.toList)
650 . merge
652 . merge
@@ -655,6 +657,7 @@ mergeWith f es = fmap (Prelude.foldl1 f . map (\(Const2 _ :=> Identity v) -> v)
655-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
657-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
656-- list occurs. If multiple occur at the same time the value is the value of the
658-- list occurs. If multiple occur at the same time the value is the value of the
657-- leftmost event.
659-- leftmost event.
660+{-# INLINE leftmost #-}
658leftmost :: Reflex t => [Event t a] -> Event t a
661leftmost :: Reflex t => [Event t a] -> Event t a
659leftmost = mergeWith const
662leftmost = mergeWith const
660
663
src/Reflex/Dynamic.hs+1
@@ -12,6 +12,7 @@
12{-# LANGUAGE TypeFamilies #-}
12{-# LANGUAGE TypeFamilies #-}
13{-# LANGUAGE TypeOperators #-}
13{-# LANGUAGE TypeOperators #-}
14{-# LANGUAGE UndecidableInstances #-}
14{-# LANGUAGE UndecidableInstances #-}
15+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
15-- | This module contains various functions for working with 'Dynamic' values.
16-- | This module contains various functions for working with 'Dynamic' values.
16-- 'Dynamic' and its primitives have been moved to the 'Reflex' class.
17-- 'Dynamic' and its primitives have been moved to the 'Reflex' class.
17module Reflex.Dynamic
18module Reflex.Dynamic
src/Reflex/Dynamic/TH.hs+1
@@ -4,6 +4,7 @@
4{-# LANGUAGE ScopedTypeVariables #-}
4{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE TemplateHaskell #-}
5{-# LANGUAGE TemplateHaskell #-}
6{-# LANGUAGE TypeOperators #-}
6{-# LANGUAGE TypeOperators #-}
7+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
7-- | Template Haskell helper functions for building complex 'Dynamic' values.
8-- | Template Haskell helper functions for building complex 'Dynamic' values.
8module Reflex.Dynamic.TH (qDyn, unqDyn, mkDyn) where
9module Reflex.Dynamic.TH (qDyn, unqDyn, mkDyn) where
9
10
src/Reflex/Dynamic/Uniq.hs+1
@@ -1,6 +1,7 @@
1{-# LANGUAGE FlexibleInstances #-}
1{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE MagicHash #-}
2{-# LANGUAGE MagicHash #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
4+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
4-- | This module provides a variation of 'Dynamic' values that uses cheap
5-- | This module provides a variation of 'Dynamic' values that uses cheap
5-- pointer equality checks to reduce the amount of signal propagation needed.
6-- pointer equality checks to reduce the amount of signal propagation needed.
6module Reflex.Dynamic.Uniq
7module Reflex.Dynamic.Uniq
src/Reflex/DynamicWriter.hs+1
@@ -9,6 +9,7 @@
9{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE ScopedTypeVariables #-}
10{-# LANGUAGE TypeFamilies #-}
10{-# LANGUAGE TypeFamilies #-}
11{-# LANGUAGE UndecidableInstances #-}
11{-# LANGUAGE UndecidableInstances #-}
12+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
12module Reflex.DynamicWriter where
13module Reflex.DynamicWriter where
13
14
14import Control.Monad.Exception
15import Control.Monad.Exception
src/Reflex/Host/Class.hs+1
@@ -9,6 +9,7 @@
9{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE ScopedTypeVariables #-}
10{-# LANGUAGE TypeFamilies #-}
10{-# LANGUAGE TypeFamilies #-}
11{-# LANGUAGE UndecidableInstances #-}
11{-# LANGUAGE UndecidableInstances #-}
12+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
12-- | This module provides the interface for hosting 'Reflex' engines. This
13-- | This module provides the interface for hosting 'Reflex' engines. This
13-- should only be necessary if you're writing a binding or some other library
14-- should only be necessary if you're writing a binding or some other library
14-- that provides a core event loop.
15-- that provides a core event loop.
src/Reflex/PerformEvent/Base.hs+1
@@ -12,6 +12,7 @@
12{-# LANGUAGE TypeFamilies #-}
12{-# LANGUAGE TypeFamilies #-}
13{-# LANGUAGE TypeOperators #-}
13{-# LANGUAGE TypeOperators #-}
14{-# LANGUAGE UndecidableInstances #-}
14{-# LANGUAGE UndecidableInstances #-}
15+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
15module Reflex.PerformEvent.Base where
16module Reflex.PerformEvent.Base where
16
17
17import Reflex.Class
18import Reflex.Class
src/Reflex/PerformEvent/Class.hs+1
@@ -7,6 +7,7 @@
7{-# LANGUAGE TypeFamilies #-}
7{-# LANGUAGE TypeFamilies #-}
8{-# LANGUAGE TypeOperators #-}
8{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE UndecidableInstances #-}
9{-# LANGUAGE UndecidableInstances #-}
10+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
10module Reflex.PerformEvent.Class where
11module Reflex.PerformEvent.Class where
11
12
12import Reflex.Class
13import Reflex.Class
src/Reflex/PostBuild/Class.hs+1
@@ -8,6 +8,7 @@
8{-# LANGUAGE TypeFamilies #-}
8{-# LANGUAGE TypeFamilies #-}
9{-# LANGUAGE TypeOperators #-}
9{-# LANGUAGE TypeOperators #-}
10{-# LANGUAGE UndecidableInstances #-}
10{-# LANGUAGE UndecidableInstances #-}
11+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
11module Reflex.PostBuild.Class where
12module Reflex.PostBuild.Class where
12
13
13import Control.Monad.Exception
14import Control.Monad.Exception
src/Reflex/Pure.hs+1
@@ -5,6 +5,7 @@
5{-# LANGUAGE MultiParamTypeClasses #-}
5{-# LANGUAGE MultiParamTypeClasses #-}
6{-# LANGUAGE ScopedTypeVariables #-}
6{-# LANGUAGE ScopedTypeVariables #-}
7{-# LANGUAGE TypeFamilies #-}
7{-# LANGUAGE TypeFamilies #-}
8+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
8
9
9-- There are two expected orphan instances in this module:
10-- There are two expected orphan instances in this module:
10-- * MonadSample (Pure t) ((->) t)
11-- * MonadSample (Pure t) ((->) t)