on develop help sign in
Fix and re-enable hlint test
d9a8872Ryan Trinkle
reflex.cabal+1−1
@@ -184,7 +184,6 @@ test-suite hlint
184 , hlint
184 , hlint
185 if impl(ghcjs)
185 if impl(ghcjs)
186 buildable: False
186 buildable: False
187− buildable: False
188
187
189test-suite EventWriterT
188test-suite EventWriterT
190 type: exitcode-stdio-1.0
189 type: exitcode-stdio-1.0
@@ -226,6 +225,7 @@ test-suite QueryT
226 , semigroups
225 , semigroups
227 , reflex
226 , reflex
228 , ref-tf
227 , ref-tf
228+ other-modules: Test.Run
229
229
230test-suite GC-Semantics
230test-suite GC-Semantics
231 type: exitcode-stdio-1.0
231 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 #-}
5{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
6module Data.FastMutableIntMap
2module Data.FastMutableIntMap
7 ( FastMutableIntMap
3 ( FastMutableIntMap
src/Reflex/Adjustable/Class.hs+2−4
@@ -1,7 +1,5 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2{-# LANGUAGE RankNTypes #-}
2{-# LANGUAGE RankNTypes #-}
3−{-# LANGUAGE LambdaCase #-}
4−{-# LANGUAGE RecursiveDo #-}
5{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
6{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE MultiParamTypeClasses #-}
7{-# LANGUAGE FunctionalDependencies #-}
5{-# LANGUAGE FunctionalDependencies #-}
@@ -11,8 +9,8 @@
11#ifdef USE_REFLEX_OPTIMIZER
9#ifdef USE_REFLEX_OPTIMIZER
12{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
10{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
13#endif
11#endif
14−module Reflex.Adjustable.Class
12+module Reflex.Adjustable.Class
15− (
13+ (
16 -- * The Adjustable typeclass
14 -- * The Adjustable typeclass
17 Adjustable(..)
15 Adjustable(..)
18 , sequenceDMapWithAdjust
16 , sequenceDMapWithAdjust
src/Reflex/Collection.hs+1−2
@@ -4,7 +4,6 @@
4{-# LANGUAGE RecursiveDo #-}
4{-# LANGUAGE RecursiveDo #-}
5{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE ScopedTypeVariables #-}
6{-# LANGUAGE MultiParamTypeClasses #-}
6{-# LANGUAGE MultiParamTypeClasses #-}
7−{-# LANGUAGE FunctionalDependencies #-}
8{-# LANGUAGE FlexibleInstances #-}
7{-# LANGUAGE FlexibleInstances #-}
9{-# LANGUAGE TypeFamilies #-}
8{-# LANGUAGE TypeFamilies #-}
10{-# LANGUAGE UndecidableInstances #-}
9{-# LANGUAGE UndecidableInstances #-}
@@ -12,7 +11,7 @@
12{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
11{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
13#endif
12#endif
14module Reflex.Collection
13module Reflex.Collection
15− (
14+ (
16 -- * Widgets on Collections
15 -- * Widgets on Collections
17 listHoldWithKey
16 listHoldWithKey
18 , listWithKey
17 , listWithKey
src/Reflex/DynamicWriter/Base.hs+1−1
@@ -171,7 +171,7 @@ traverseDMapWithKeyWithAdjustImpl base mapPatch weakenPatchWith mergeMyDynIncrem
171 return (liftedResult0, liftedResult')
171 return (liftedResult0, liftedResult')
172
172
173traverseIntMapWithKeyWithAdjustImpl :: 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')
173traverseIntMapWithKeyWithAdjustImpl :: 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))
175 -> IntMap v
175 -> IntMap v
176 -> Event t (p v)
176 -> Event t (p v)
177 -> m (IntMap (v', Dynamic t w), Event t (p (v', Dynamic t w)))
177 -> 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
183 requests' :: Event t (p (Event t w))
183 requests' :: Event t (p (Event t w))
184 requests' = fmapCheap (fmap fst) children'
184 requests' = fmapCheap (fmap fst) children'
185 childRequestMap :: Incremental t (p (Event t w)) <- holdIncremental requests0 requests'
185 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
186+ tellEventsPromptly requests' patchNewElements $ mergePatchIncremental childRequestMap
189− [] -> Nothing
190− h : t -> Just $ sconcat $ h :| t
191 return (result0, result')
187 return (result0, result')
192
188
193-- | Like 'runWithReplaceEventWriterTWith', but for 'sequenceDMapWithAdjust'.
189-- | Like 'runWithReplaceEventWriterTWith', but for 'sequenceDMapWithAdjust'.
@@ -216,12 +212,24 @@ sequenceDMapWithAdjustEventWriterTWith base mapPatch weakenPatchWith patchNewEle
216 requests' :: Event t (p' (Some k) (Event t w))
212 requests' :: Event t (p' (Some k) (Event t w))
217 requests' = fforCheap children' $ weakenPatchWith $ fst . getCompose
213 requests' = fforCheap children' $ weakenPatchWith $ fst . getCompose
218 childRequestMap :: Incremental t (p' (Some k) (Event t w)) <- holdIncremental requests0 requests'
214 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
219 -- 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.)
228 -- 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'
229+ tellEvent $ coincidence $ fmapCheap (mconcat . patchNewElements) requests' --TODO: Create a mergeIncrementalPromptly, and use that to eliminate this 'coincidence'
221− tellEvent $ fforMaybeCheap (mergePatchIncremental childRequestMap) $ \m -> case toList m of
230+ tellEvent $ fforMaybeCheap mergedChildRequestMap $ \m -> case toList m of
222 [] -> Nothing
231 [] -> Nothing
223 h : t -> Just $ sconcat $ h :| t
232 h : t -> Just $ sconcat $ h :| t
224− return (result0, result')
225
233
226instance PerformEvent t m => PerformEvent t (EventWriterT t w m) where
234instance PerformEvent t m => PerformEvent t (EventWriterT t w m) where
227 type Performable (EventWriterT t w m) = Performable m
235 type Performable (EventWriterT t w m) = Performable m
src/Reflex/Network.hs−2
@@ -1,7 +1,5 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2−{-# LANGUAGE DefaultSignatures #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
2{-# LANGUAGE MultiParamTypeClasses #-}
4−{-# LANGUAGE FunctionalDependencies #-}
5#ifdef USE_REFLEX_OPTIMIZER
3#ifdef USE_REFLEX_OPTIMIZER
6{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
4{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
7#endif
5#endif
src/Reflex/Patch/DMapWithMove.hs+2−2
@@ -78,11 +78,11 @@ validationErrorsForPatchDMapWithMove :: forall k v. (GCompare k, GEq k, GShow k)
78validationErrorsForPatchDMapWithMove m =
78validationErrorsForPatchDMapWithMove m =
79 noSelfMoves <> movesBalanced
79 noSelfMoves <> movesBalanced
80 where
80 where
81− noSelfMoves = catMaybes . map selfMove . DMap.toAscList $ m
81+ noSelfMoves = mapMaybe selfMove . DMap.toAscList $ m
82 selfMove (dst :=> NodeInfo (From_Move src) _) | Just _ <- dst `geq` src = Just $ "self move of key " <> gshow src <> " at destination side"
82 selfMove (dst :=> NodeInfo (From_Move src) _) | Just _ <- dst `geq` src = Just $ "self move of key " <> gshow src <> " at destination side"
83 selfMove (src :=> NodeInfo _ (ComposeMaybe (Just dst))) | Just _ <- src `geq` dst = Just $ "self move of key " <> gshow dst <> " at source side"
83 selfMove (src :=> NodeInfo _ (ComposeMaybe (Just dst))) | Just _ <- src `geq` dst = Just $ "self move of key " <> gshow dst <> " at source side"
84 selfMove _ = Nothing
84 selfMove _ = Nothing
85− movesBalanced = catMaybes . map unbalancedMove . DMap.toAscList $ m
85+ movesBalanced = mapMaybe unbalancedMove . DMap.toAscList $ m
86 unbalancedMove (dst :=> NodeInfo (From_Move src) _) =
86 unbalancedMove (dst :=> NodeInfo (From_Move src) _) =
87 case DMap.lookup src m of
87 case DMap.lookup src m of
88 Nothing -> Just $ "unbalanced move at destination key " <> gshow dst <> " supposedly from " <> gshow src <> " but source key is not in the patch"
88 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
151 rec (result0, result') <- base f' loweredDm0 loweredDm'
151 rec (result0, result') <- base f' loweredDm0 loweredDm'
152 cohortDone <- numberOccurrencesFrom_ 1 result'
152 cohortDone <- numberOccurrencesFrom_ 1 result'
153 numberedDm' <- numberOccurrencesFrom 1 dm'
153 numberedDm' <- numberOccurrencesFrom 1 dm'
154− let postBuild' = fanInt $ fmapCheap (\n -> IntMap.singleton n ()) cohortDone
154+ let postBuild' = fanInt $ fmapCheap (`IntMap.singleton` ()) cohortDone
155 loweredDm' = flip pushAlways numberedDm' $ \(n, p) -> do
155 loweredDm' = flip pushAlways numberedDm' $ \(n, p) -> do
156 return $ fmap ((,) (selectInt postBuild' n)) p
156 return $ fmap ((,) (selectInt postBuild' n)) p
157 return (result0, result')
157 return (result0, result')
src/Reflex/Requester/Base.hs+2−3
@@ -1,7 +1,6 @@
1-- | This module provides 'RequesterT', the standard implementation of
1-- | This module provides 'RequesterT', the standard implementation of
2-- 'Requester'.
2-- 'Requester'.
3{-# LANGUAGE AllowAmbiguousTypes #-}
3{-# LANGUAGE AllowAmbiguousTypes #-}
4−{-# LANGUAGE BangPatterns #-}
5{-# LANGUAGE CPP #-}
4{-# LANGUAGE CPP #-}
6{-# LANGUAGE EmptyDataDecls #-}
5{-# LANGUAGE EmptyDataDecls #-}
7{-# LANGUAGE ExistentialQuantification #-}
6{-# LANGUAGE ExistentialQuantification #-}
@@ -110,9 +109,9 @@ singletonTagMap :: forall f a. MyTag a -> f a -> TagMap f
110singletonTagMap (MyTag k) v = TagMap $ IntMap.singleton k $ (unsafeCoerce :: f a -> Any) v
109singletonTagMap (MyTag k) v = TagMap $ IntMap.singleton k $ (unsafeCoerce :: f a -> Any) v
111
110
112tagMapToList :: forall f. TagMap f -> [DSum MyTag f]
111tagMapToList :: forall f. TagMap f -> [DSum MyTag f]
113−tagMapToList (TagMap m) = fmap f $ IntMap.toList m
112+tagMapToList (TagMap m) = f <$> IntMap.toList m
114 where f :: (Int, Any) -> DSum MyTag f
113 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
116
115
117traverseTagMapWithKey :: forall t f g. Applicative t => (forall a. MyTag a -> f a -> t (g a)) -> TagMap f -> t (TagMap g)
116traverseTagMapWithKey :: forall t f g. Applicative t => (forall a. MyTag a -> f a -> t (g a)) -> TagMap f -> t (TagMap g)
118traverseTagMapWithKey f (TagMap m) = TagMap <$> IntMap.traverseWithKey g m
117traverseTagMapWithKey f (TagMap m) = TagMap <$> IntMap.traverseWithKey g m