on develop help sign in
Fix and re-enable hlint test
commitd9a8872df0d248b3b3ef3bb778305ea6a8998740 authorRyan Trinkle <ryan.trinkle@gmail.com> dateFri 13 Jul 2018, 22:57 (8 years ago) parent1782d8a
10 files changed+26−28
reflex.cabal+1−1 src/Data/FastMutableIntMap.hs−4 src/Reflex/Adjustable/Class.hs+2−4 src/Reflex/Collection.hs+1−2 src/Reflex/DynamicWriter/Base.hs+1−1 src/Reflex/EventWriter/Base.hs+16−8 src/Reflex/Network.hs−2 src/Reflex/Patch/DMapWithMove.hs+2−2 src/Reflex/PostBuild/Base.hs+1−1 src/Reflex/Requester/Base.hs+2−3
reflex.cabal+1−1
@@ -184,7 +184,6 @@ test-suite hlint
184184 , hlint
185185 if impl(ghcjs)
186186 buildable: False
187− buildable: False
188187
189188test-suite EventWriterT
190189 type: exitcode-stdio-1.0
@@ -226,6 +225,7 @@ test-suite QueryT
226225 , semigroups
227226 , reflex
228227 , ref-tf
228+ other-modules: Test.Run
229229
230230test-suite GC-Semantics
231231 type: exitcode-stdio-1.0
src/Data/FastMutableIntMap.hs−4
@@ -1,7 +1,3 @@
1−{-# LANGUAGE DeriveFunctor #-}
2−{-# LANGUAGE DeriveFoldable #-}
3−{-# LANGUAGE DeriveTraversable #-}
4−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
51{-# LANGUAGE TypeFamilies #-}
62module Data.FastMutableIntMap
73 ( FastMutableIntMap
src/Reflex/Adjustable/Class.hs+2−4
@@ -1,7 +1,5 @@
11{-# LANGUAGE CPP #-}
22{-# LANGUAGE RankNTypes #-}
3−{-# LANGUAGE LambdaCase #-}
4−{-# LANGUAGE RecursiveDo #-}
53{-# LANGUAGE ScopedTypeVariables #-}
64{-# LANGUAGE MultiParamTypeClasses #-}
75{-# LANGUAGE FunctionalDependencies #-}
@@ -11,8 +9,8 @@
119#ifdef USE_REFLEX_OPTIMIZER
1210{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1311#endif
14−module Reflex.Adjustable.Class
15− (
12+module Reflex.Adjustable.Class
13+ (
1614 -- * The Adjustable typeclass
1715 Adjustable(..)
1816 , sequenceDMapWithAdjust
src/Reflex/Collection.hs+1−2
@@ -4,7 +4,6 @@
44{-# LANGUAGE RecursiveDo #-}
55{-# LANGUAGE ScopedTypeVariables #-}
66{-# LANGUAGE MultiParamTypeClasses #-}
7−{-# LANGUAGE FunctionalDependencies #-}
87{-# LANGUAGE FlexibleInstances #-}
98{-# LANGUAGE TypeFamilies #-}
109{-# LANGUAGE UndecidableInstances #-}
@@ -12,7 +11,7 @@
1211{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
1312#endif
1413module Reflex.Collection
15− (
14+ (
1615 -- * Widgets on Collections
1716 listHoldWithKey
1817 , listWithKey
src/Reflex/DynamicWriter/Base.hs+1−1
@@ -171,7 +171,7 @@ traverseDMapWithKeyWithAdjustImpl base mapPatch weakenPatchWith mergeMyDynIncrem
171171 return (liftedResult0, liftedResult')
172172
173173traverseIntMapWithKeyWithAdjustImpl :: forall t w v' p p' v m. (PatchTarget (p' (Dynamic t w)) ~ IntMap (Dynamic t w), PatchTarget (p' w) ~ IntMap w, Patch (p' w), Patch (p' (Dynamic t w)), MonadFix m, Monoid w, Reflex t, MonadHold t m, Functor p, p ~ p')
174− => ( (IntMap.Key -> v -> m ((v', Dynamic t w)))
174+ => ( (IntMap.Key -> v -> m (v', Dynamic t w))
175175 -> IntMap v
176176 -> Event t (p v)
177177 -> m (IntMap (v', Dynamic t w), Event t (p (v', Dynamic t w)))
src/Reflex/EventWriter/Base.hs+16−8
@@ -183,11 +183,7 @@ sequenceIntMapWithAdjustEventWriterTWith base patchNewElements mergePatchIncreme
183183 requests' :: Event t (p (Event t w))
184184 requests' = fmapCheap (fmap fst) children'
185185 childRequestMap :: Incremental t (p (Event t w)) <- holdIncremental requests0 requests'
186− -- We add these two separately to take advantage of the free merge being done later. The coincidence case must come first so that it has precedence if both fire simultaneously. (Really, we should probably block the 'switch' whenever 'updated' fires, but switchPromptlyDyn has the same issue.)
187− tellEvent $ coincidence $ fforCheap requests' $ \p -> mconcat $ patchNewElements p --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
188− tellEvent $ fforMaybeCheap (mergePatchIncremental childRequestMap) $ \m -> case toList m of
189− [] -> Nothing
190− h : t -> Just $ sconcat $ h :| t
186+ tellEventsPromptly requests' patchNewElements $ mergePatchIncremental childRequestMap
191187 return (result0, result')
192188
193189-- | Like 'runWithReplaceEventWriterTWith', but for 'sequenceDMapWithAdjust'.
@@ -216,12 +212,24 @@ sequenceDMapWithAdjustEventWriterTWith base mapPatch weakenPatchWith patchNewEle
216212 requests' :: Event t (p' (Some k) (Event t w))
217213 requests' = fforCheap children' $ weakenPatchWith $ fst . getCompose
218214 childRequestMap :: Incremental t (p' (Some k) (Event t w)) <- holdIncremental requests0 requests'
215+ tellEventsPromptly requests' patchNewElements $ mergePatchIncremental childRequestMap
216+ return (result0, result')
217+
218+tellEventsPromptly
219+ :: ( Foldable f
220+ , Reflex t
221+ , EventWriter t w m
222+ )
223+ => Event t a
224+ -> (a -> [Event t w])
225+ -> Event t (f w)
226+ -> m ()
227+tellEventsPromptly requests' patchNewElements mergedChildRequestMap = do
219228 -- We add these two separately to take advantage of the free merge being done later. The coincidence case must come first so that it has precedence if both fire simultaneously. (Really, we should probably block the 'switch' whenever 'updated' fires, but switchPromptlyDyn has the same issue.)
220− tellEvent $ coincidence $ fforCheap requests' $ \p -> mconcat $ patchNewElements p --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
221− tellEvent $ fforMaybeCheap (mergePatchIncremental childRequestMap) $ \m -> case toList m of
229+ tellEvent $ coincidence $ fmapCheap (mconcat . patchNewElements) requests' --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
230+ tellEvent $ fforMaybeCheap mergedChildRequestMap $ \m -> case toList m of
222231 [] -> Nothing
223232 h : t -> Just $ sconcat $ h :| t
224− return (result0, result')
225233
226234instance PerformEvent t m => PerformEvent t (EventWriterT t w m) where
227235 type Performable (EventWriterT t w m) = Performable m
src/Reflex/Network.hs−2
@@ -1,7 +1,5 @@
11{-# LANGUAGE CPP #-}
2−{-# LANGUAGE DefaultSignatures #-}
32{-# LANGUAGE MultiParamTypeClasses #-}
4−{-# LANGUAGE FunctionalDependencies #-}
53#ifdef USE_REFLEX_OPTIMIZER
64{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
75#endif
src/Reflex/Patch/DMapWithMove.hs+2−2
@@ -78,11 +78,11 @@ validationErrorsForPatchDMapWithMove :: forall k v. (GCompare k, GEq k, GShow k)
7878validationErrorsForPatchDMapWithMove m =
7979 noSelfMoves <> movesBalanced
8080 where
81− noSelfMoves = catMaybes . map selfMove . DMap.toAscList $ m
81+ noSelfMoves = mapMaybe selfMove . DMap.toAscList $ m
8282 selfMove (dst :=> NodeInfo (From_Move src) _) | Just _ <- dst `geq` src = Just $ "self move of key " <> gshow src <> " at destination side"
8383 selfMove (src :=> NodeInfo _ (ComposeMaybe (Just dst))) | Just _ <- src `geq` dst = Just $ "self move of key " <> gshow dst <> " at source side"
8484 selfMove _ = Nothing
85− movesBalanced = catMaybes . map unbalancedMove . DMap.toAscList $ m
85+ movesBalanced = mapMaybe unbalancedMove . DMap.toAscList $ m
8686 unbalancedMove (dst :=> NodeInfo (From_Move src) _) =
8787 case DMap.lookup src m of
8888 Nothing -> Just $ "unbalanced move at destination key " <> gshow dst <> " supposedly from " <> gshow src <> " but source key is not in the patch"
src/Reflex/PostBuild/Base.hs+1−1
@@ -151,7 +151,7 @@ mapIntMapWithAdjustImpl base f dm0 dm' = do
151151 rec (result0, result') <- base f' loweredDm0 loweredDm'
152152 cohortDone <- numberOccurrencesFrom_ 1 result'
153153 numberedDm' <- numberOccurrencesFrom 1 dm'
154− let postBuild' = fanInt $ fmapCheap (\n -> IntMap.singleton n ()) cohortDone
154+ let postBuild' = fanInt $ fmapCheap (`IntMap.singleton` ()) cohortDone
155155 loweredDm' = flip pushAlways numberedDm' $ \(n, p) -> do
156156 return $ fmap ((,) (selectInt postBuild' n)) p
157157 return (result0, result')
src/Reflex/Requester/Base.hs+2−3
@@ -1,7 +1,6 @@
11-- | This module provides 'RequesterT', the standard implementation of
22-- 'Requester'.
33{-# LANGUAGE AllowAmbiguousTypes #-}
4−{-# LANGUAGE BangPatterns #-}
54{-# LANGUAGE CPP #-}
65{-# LANGUAGE EmptyDataDecls #-}
76{-# LANGUAGE ExistentialQuantification #-}
@@ -110,9 +109,9 @@ singletonTagMap :: forall f a. MyTag a -> f a -> TagMap f
110109singletonTagMap (MyTag k) v = TagMap $ IntMap.singleton k $ (unsafeCoerce :: f a -> Any) v
111110
112111tagMapToList :: forall f. TagMap f -> [DSum MyTag f]
113−tagMapToList (TagMap m) = fmap f $ IntMap.toList m
112+tagMapToList (TagMap m) = f <$> IntMap.toList m
114113 where f :: (Int, Any) -> DSum MyTag f
115− f (k, v) = MyTag k :=> ((unsafeCoerce :: Any -> f a) v)
114+ f (k, v) = MyTag k :=> (unsafeCoerce :: Any -> f a) v
116115
117116traverseTagMapWithKey :: forall t f g. Applicative t => (forall a. MyTag a -> f a -> t (g a)) -> TagMap f -> t (TagMap g)
118117traverseTagMapWithKey f (TagMap m) = TagMap <$> IntMap.traverseWithKey g m