on develop help sign in
Allow these-1, HLint fixes
commit61b5222aac66701e794f265d53b9ab4bd2bae09d authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 4 Aug 2019, 21:18 (7 years ago) parent98dc890
10 files changed+79−14
.travis.yml+10 cabal.project+5 reflex.cabal+33−4 src/Reflex/Class.hs+12 src/Reflex/Collection.hs+4 src/Reflex/Dynamic/TH.hs+1−1 src/Reflex/EventWriter/Base.hs+1−1 src/Reflex/Profiled.hs+3−3 src/Reflex/Pure.hs−5 src/Reflex/Spider/Internal.hs+10
.travis.yml+10
@@ -108,6 +108,11 @@ install:
108108 echo " type: git" >> cabal.project
109109 echo " location: https://github.com/obsidiansystems/dependent-map.git" >> cabal.project
110110 echo " tag: a9a438b1fd974891e4ed57cbd43e305cf7c759a9" >> cabal.project
111+ echo "" >> cabal.project
112+ echo "source-repository-package" >> cabal.project
113+ echo " type: git" >> cabal.project
114+ echo " location: https://github.com/phadej/monoidal-containers.git" >> cabal.project
115+ echo " tag: f8860ba08385f77128efb45fb9193e6d287e893f" >> cabal.project
111116 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(reflex)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
112117 - cat cabal.project || true
113118 - cat cabal.project.local || true
@@ -141,6 +146,11 @@ script:
141146 echo " type: git" >> cabal.project
142147 echo " location: https://github.com/obsidiansystems/dependent-map.git" >> cabal.project
143148 echo " tag: a9a438b1fd974891e4ed57cbd43e305cf7c759a9" >> cabal.project
149+ echo "" >> cabal.project
150+ echo "source-repository-package" >> cabal.project
151+ echo " type: git" >> cabal.project
152+ echo " location: https://github.com/phadej/monoidal-containers.git" >> cabal.project
153+ echo " tag: f8860ba08385f77128efb45fb9193e6d287e893f" >> cabal.project
144154 - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(reflex)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
145155 - cat cabal.project || true
146156 - cat cabal.project.local || true
cabal.project+5
@@ -12,3 +12,8 @@ source-repository-package
1212 type: git
1313 location: https://github.com/obsidiansystems/dependent-map.git
1414 tag: a9a438b1fd974891e4ed57cbd43e305cf7c759a9
15+
16+source-repository-package
17+ type: git
18+ location: https://github.com/phadej/monoidal-containers.git
19+ tag: f8860ba08385f77128efb45fb9193e6d287e893f
reflex.cabal+33−4
@@ -40,6 +40,11 @@ flag fast-weak
4040 default: False
4141 manual: True
4242
43+flag split-these
44+ description: Use split these/semialign packages
45+ manual: False
46+ default: True
47+
4348library
4449 hs-source-dirs: src
4550 build-depends:
@@ -58,21 +63,26 @@ library
5863 monoidal-containers >= 0.4 && < 0.6,
5964 mtl >= 2.1 && < 2.3,
6065 prim-uniq >= 0.1.0.1 && < 0.2,
61− primitive >= 0.5 && < 0.7,
66+ primitive >= 0.5 && < 0.8,
6267 random == 1.1.*,
6368 ref-tf == 0.4.*,
6469 reflection == 2.1.*,
6570 semigroupoids >= 4.0 && < 6,
66− semigroups >= 0.16 && < 0.19,
71+ semigroups >= 0.16 && < 0.20,
6772 stm >= 2.4 && < 2.6,
6873 syb >= 0.5 && < 0.8,
69− these >= 0.4 && < 0.9,
7074 time >= 1.4 && < 1.9,
7175 transformers >= 0.2,
7276 transformers-compat >= 0.3,
7377 unbounded-delays >= 0.1.0.0 && < 0.2,
7478 witherable >= 0.2 && < 0.4
7579
80+ if flag(split-these)
81+ build-depends: these >= 1 && <1.1,
82+ semialign >=1 && <1.1
83+ else
84+ build-depends: these >= 0.4 && <0.9
85+
7686 exposed-modules:
7787 Data.AppendMap,
7888 Data.FastMutableIntMap,
@@ -209,7 +219,8 @@ test-suite hlint
209219 , directory
210220 , filepath
211221 , filemanip
212− , hlint
222+ -- newer versions need ghc-lib-parser, and have failing hints
223+ , hlint <2.1
213224 if impl(ghcjs)
214225 buildable: False
215226
@@ -228,6 +239,10 @@ test-suite EventWriterT
228239 , transformers
229240 , reflex
230241 , ref-tf
242+
243+ if flag(split-these)
244+ build-depends: these-lens
245+
231246 other-modules:
232247 Reflex.Test
233248 Reflex.TestPlan
@@ -235,6 +250,7 @@ test-suite EventWriterT
235250 Reflex.Plan.Pure
236251 Test.Run
237252
253+
238254test-suite RequesterT
239255 type: exitcode-stdio-1.0
240256 main-is: RequesterT.hs
@@ -250,9 +266,14 @@ test-suite RequesterT
250266 , transformers
251267 , reflex
252268 , ref-tf
269+
270+ if flag(split-these)
271+ build-depends: these-lens
272+
253273 other-modules:
254274 Reflex.TestPlan
255275 Reflex.Plan.Pure
276+ Test.Run
256277
257278test-suite QueryT
258279 type: exitcode-stdio-1.0
@@ -271,6 +292,10 @@ test-suite QueryT
271292 , semigroups
272293 , these
273294 , transformers
295+
296+ if flag(split-these)
297+ build-depends: semialign, these-lens
298+
274299 other-modules:
275300 Test.Run
276301 Reflex.TestPlan
@@ -291,6 +316,10 @@ test-suite GC-Semantics
291316 , transformers
292317 , reflex
293318 , ref-tf
319+
320+ if flag(split-these)
321+ build-depends: semialign
322+
294323 if impl(ghc < 8)
295324 build-depends: semigroups
296325 other-modules:
src/Reflex/Class.hs+12
@@ -173,6 +173,14 @@ module Reflex.Class
173173 , slowHeadE
174174 ) where
175175
176+#if defined(MIN_VERSION_semialign)
177+import Prelude hiding (zip, zipWith)
178+
179+#if MIN_VERSION_these(0,8,0)
180+import Data.These.Combinators (justThese)
181+#endif
182+#endif
183+
176184import Control.Applicative
177185import Control.Monad.Identity
178186import Control.Monad.Reader
@@ -1063,6 +1071,10 @@ instance Reflex t => Align (Event t) where
10631071instance Reflex t => Semialign (Event t) where
10641072#endif
10651073 align = alignEventWithMaybe Just
1074+
1075+#if defined(MIN_VERSION_semialign)
1076+ zip x y = mapMaybe justThese $ align x y
1077+#endif
10661078
10671079
10681080-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
src/Reflex/Collection.hs+4
@@ -27,6 +27,10 @@ module Reflex.Collection
2727 , simpleList
2828 ) where
2929
30+#if defined(MIN_VERSION_semialign)
31+import Prelude hiding (zip, zipWith)
32+#endif
33+
3034import Control.Monad.Identity
3135import Data.Align
3236import Data.Functor.Misc
src/Reflex/Dynamic/TH.hs+1−1
@@ -81,7 +81,7 @@ mkDynPure = QuasiQuoter
8181 }
8282
8383mkDynExp :: String -> Q Exp
84−mkDynExp s = case Hs.parseExpWithMode (Hs.defaultParseMode { Hs.extensions = [ Hs.EnableExtension Hs.TemplateHaskell ] }) s of
84+mkDynExp s = case Hs.parseExpWithMode Hs.defaultParseMode { Hs.extensions = [ Hs.EnableExtension Hs.TemplateHaskell ] } s of
8585 Hs.ParseFailed (Hs.SrcLoc _ l c) err -> fail $ "mkDyn:" <> show l <> ":" <> show c <> ": " <> err
8686 Hs.ParseOk e -> qDynPure $ return $ everywhere (id `extT` reinstateUnqDyn) $ Hs.toExp $ everywhere (id `extT` antiE) e
8787 where TH.Name (TH.OccName occName) (TH.NameG _ _ (TH.ModName modName)) = 'unqMarker
src/Reflex/EventWriter/Base.hs+1−1
@@ -52,7 +52,7 @@ import qualified Data.Map as Map
5252import Data.Semigroup
5353import Data.Some (Some)
5454import Data.Tuple
55−import Data.Type.Equality hiding (apply)
55+import Data.Type.Equality
5656
5757import Unsafe.Coerce
5858
src/Reflex/Profiled.hs+3−3
@@ -79,9 +79,9 @@ getCostCentreStack = go []
7979 go (cc : l) parent
8080
8181toCostCentreTree :: Ptr CostCentreStack -> Int -> IO CostCentreTree
82−toCostCentreTree ccs n = do
83− ccList <- getCostCentreStack ccs
84− return $ foldr (\cc child -> CostCentreTree 0 n $ Map.singleton cc child) (CostCentreTree n n mempty) ccList
82+toCostCentreTree ccs n =
83+ foldr (\cc child -> CostCentreTree 0 n $ Map.singleton cc child) (CostCentreTree n n mempty)
84+ <$> getCostCentreStack ccs
8585
8686getCostCentreTree :: IO CostCentreTree
8787getCostCentreTree = do
src/Reflex/Pure.hs−5
@@ -31,14 +31,9 @@ module Reflex.Pure
3131 , Incremental (..)
3232 ) where
3333
34−#if !MIN_VERSION_base(4,8,0)
35−import Control.Applicative
36−#endif
37−
3834import Control.Monad
3935import Data.Dependent.Map (DMap, GCompare)
4036import qualified Data.Dependent.Map as DMap
41−import Data.Functor.Identity
4237import Data.IntMap (IntMap)
4338import qualified Data.IntMap as IntMap
4439import Data.Maybe
src/Reflex/Spider/Internal.hs+10
@@ -68,6 +68,12 @@ import System.IO.Unsafe
6868import System.Mem.Weak
6969import Unsafe.Coerce
7070
71+#if defined(MIN_VERSION_semialign)
72+#if MIN_VERSION_these(0,8,0)
73+import Data.These.Combinators (justThese)
74+#endif
75+#endif
76+
7177#ifdef DEBUG_CYCLES
7278import Control.Monad.State hiding (forM, forM_, mapM, mapM_, sequence)
7379import Data.List.NonEmpty (NonEmpty (..), nonEmpty)
@@ -1139,6 +1145,10 @@ instance HasSpiderTimeline x => Semialign (Event x) where
11391145 align ea eb = mapMaybe dmapToThese $ mergeG coerce $ dynamicConst $
11401146 DMap.fromDistinctAscList [LeftTag :=> ea, RightTag :=> eb]
11411147
1148+#if defined(MIN_VERSION_semialign)
1149+ zip x y = mapMaybe justThese $ align x y
1150+#endif
1151+
11421152data DynType x p = UnsafeDyn !(BehaviorM x (PatchTarget p), Event x p)
11431153 | BuildDyn !(EventM x (PatchTarget p), Event x p)
11441154 | HoldDyn !(Hold x p)