on develop help sign in
wip
commit8c7653eb3e581953157e37412569b39c39b856f1 authorRyan Trinkle <ryan.trinkle@gmail.com> dateWed 12 Oct 2016, 15:27 (10 years ago) parent2bb2332
13 files changed+21−3
reflex.cabal+5−1 src/Data/Functor/Misc.hs+1 src/Data/WeakBag.hs+1 src/Reflex/Class.hs+5−2 src/Reflex/Dynamic.hs+1 src/Reflex/Dynamic/TH.hs+1 src/Reflex/Dynamic/Uniq.hs+1 src/Reflex/DynamicWriter.hs+1 src/Reflex/Host/Class.hs+1 src/Reflex/PerformEvent/Base.hs+1 src/Reflex/PerformEvent/Class.hs+1 src/Reflex/PostBuild/Class.hs+1 src/Reflex/Pure.hs+1
reflex.cabal+5−1
@@ -28,8 +28,8 @@ library
2828 lens >= 4.7 && < 5,
2929 monad-control >= 1.0.1 && < 1.1,
3030 mtl >= 2.1 && < 2.3,
31− primitive >= 0.5 && < 0.7,
3231 prim-uniq >= 0.1.0.1 && < 0.2,
32+ primitive >= 0.5 && < 0.7,
3333 ref-tf == 0.4.*,
3434 semigroupoids >= 4.0 && < 6,
3535 semigroups >= 0.16 && < 0.19,
@@ -57,6 +57,10 @@ library
5757 Reflex.Spider,
5858 Reflex.Spider.Internal
5959
60+ if !impl(ghcjs)
61+ build-depends: ghc
62+ exposed-modules: Reflex.Optimizer
63+
6064 other-extensions: TemplateHaskell
6165 ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
6266 ghc-prof-options: -auto-all
src/Data/Functor/Misc.hs+1
@@ -8,6 +8,7 @@
88{-# LANGUAGE RankNTypes #-}
99{-# LANGUAGE ScopedTypeVariables #-}
1010{-# LANGUAGE StandaloneDeriving #-}
11+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1112-- | This module provides types and functions with no particular theme, but
1213-- which are relevant to the use of 'Functor'-based datastructures like
1314-- 'Data.Dependent.Map.DMap'.
src/Data/WeakBag.hs+1
@@ -1,5 +1,6 @@
11{-# LANGUAGE BangPatterns #-}
22{-# LANGUAGE ExistentialQuantification #-}
3+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
34-- | This module defines the 'WeakBag' type, which represents a mutable
45-- collection of items that does not cause the items to be retained in memory.
56-- This is useful for situations where a value needs to be inspected or modified
src/Reflex/Class.hs+5−2
@@ -14,6 +14,7 @@
1414{-# LANGUAGE TypeFamilies #-}
1515{-# LANGUAGE TypeOperators #-}
1616{-# LANGUAGE UndecidableInstances #-}
17+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1718
1819-- | This module contains the Reflex interface, as well as a variety of
1920-- convenience functions for working with 'Event's, 'Behavior's, and other
@@ -141,8 +142,6 @@ import Debug.Trace (trace)
141142class ( MonadHold t (PushM t)
142143 , MonadSample t (PullM t)
143144 , MonadFix (PushM t)
144− , Functor (Event t)
145− , Functor (Behavior t)
146145 , Functor (Dynamic t)
147146 , Applicative (Dynamic t) -- Necessary for GHC <= 7.8
148147 , Monad (Dynamic t)
@@ -507,9 +506,11 @@ instance Reflex t => Bind (Event t) where
507506 join = coincidence
508507
509508instance Reflex t => Functor (Event t) where
509+ {-# INLINE fmap #-}
510510 fmap f = fmapMaybe $ Just . f
511511
512512instance Reflex t => FunctorMaybe (Event t) where
513+ {-# INLINE fmapMaybe #-}
513514 fmapMaybe f = push $ return . f
514515
515516-- | Never: @'zero' = 'never'@.
@@ -645,6 +646,7 @@ instance (Semigroup a, Reflex t) => Monoid (Event t a) where
645646-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
646647-- list occurs. If multiple occur at the same time they are folded from the left
647648-- with the given function.
649+{-# INLINE mergeWith #-}
648650mergeWith :: Reflex t => (a -> a -> a) -> [Event t a] -> Event t a
649651mergeWith f es = fmap (Prelude.foldl1 f . map (\(Const2 _ :=> Identity v) -> v) . DMap.toList)
650652 . merge
@@ -655,6 +657,7 @@ mergeWith f es = fmap (Prelude.foldl1 f . map (\(Const2 _ :=> Identity v) -> v)
655657-- | Create a new 'Event' that occurs if at least one of the 'Event's in the
656658-- list occurs. If multiple occur at the same time the value is the value of the
657659-- leftmost event.
660+{-# INLINE leftmost #-}
658661leftmost :: Reflex t => [Event t a] -> Event t a
659662leftmost = mergeWith const
660663
src/Reflex/Dynamic.hs+1
@@ -12,6 +12,7 @@
1212{-# LANGUAGE TypeFamilies #-}
1313{-# LANGUAGE TypeOperators #-}
1414{-# LANGUAGE UndecidableInstances #-}
15+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1516-- | This module contains various functions for working with 'Dynamic' values.
1617-- 'Dynamic' and its primitives have been moved to the 'Reflex' class.
1718module Reflex.Dynamic
src/Reflex/Dynamic/TH.hs+1
@@ -4,6 +4,7 @@
44{-# LANGUAGE ScopedTypeVariables #-}
55{-# LANGUAGE TemplateHaskell #-}
66{-# LANGUAGE TypeOperators #-}
7+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
78-- | Template Haskell helper functions for building complex 'Dynamic' values.
89module Reflex.Dynamic.TH (qDyn, unqDyn, mkDyn) where
910
src/Reflex/Dynamic/Uniq.hs+1
@@ -1,6 +1,7 @@
11{-# LANGUAGE FlexibleInstances #-}
22{-# LANGUAGE MagicHash #-}
33{-# LANGUAGE MultiParamTypeClasses #-}
4+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
45-- | This module provides a variation of 'Dynamic' values that uses cheap
56-- pointer equality checks to reduce the amount of signal propagation needed.
67module Reflex.Dynamic.Uniq
src/Reflex/DynamicWriter.hs+1
@@ -9,6 +9,7 @@
99{-# LANGUAGE ScopedTypeVariables #-}
1010{-# LANGUAGE TypeFamilies #-}
1111{-# LANGUAGE UndecidableInstances #-}
12+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1213module Reflex.DynamicWriter where
1314
1415import Control.Monad.Exception
src/Reflex/Host/Class.hs+1
@@ -9,6 +9,7 @@
99{-# LANGUAGE ScopedTypeVariables #-}
1010{-# LANGUAGE TypeFamilies #-}
1111{-# LANGUAGE UndecidableInstances #-}
12+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1213-- | This module provides the interface for hosting 'Reflex' engines. This
1314-- should only be necessary if you're writing a binding or some other library
1415-- that provides a core event loop.
src/Reflex/PerformEvent/Base.hs+1
@@ -12,6 +12,7 @@
1212{-# LANGUAGE TypeFamilies #-}
1313{-# LANGUAGE TypeOperators #-}
1414{-# LANGUAGE UndecidableInstances #-}
15+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1516module Reflex.PerformEvent.Base where
1617
1718import Reflex.Class
src/Reflex/PerformEvent/Class.hs+1
@@ -7,6 +7,7 @@
77{-# LANGUAGE TypeFamilies #-}
88{-# LANGUAGE TypeOperators #-}
99{-# LANGUAGE UndecidableInstances #-}
10+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1011module Reflex.PerformEvent.Class where
1112
1213import Reflex.Class
src/Reflex/PostBuild/Class.hs+1
@@ -8,6 +8,7 @@
88{-# LANGUAGE TypeFamilies #-}
99{-# LANGUAGE TypeOperators #-}
1010{-# LANGUAGE UndecidableInstances #-}
11+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1112module Reflex.PostBuild.Class where
1213
1314import Control.Monad.Exception
src/Reflex/Pure.hs+1
@@ -5,6 +5,7 @@
55{-# LANGUAGE MultiParamTypeClasses #-}
66{-# LANGUAGE ScopedTypeVariables #-}
77{-# LANGUAGE TypeFamilies #-}
8+{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
89
910-- There are two expected orphan instances in this module:
1011-- * MonadSample (Pure t) ((->) t)