on develop help sign in
Fix hlint
commit59100d61282fe02aa39be602f0a73daf31e28f63 authorRyan Trinkle <ryan.trinkle@gmail.com> dateThu 9 Feb 2017, 22:44 (10 years ago) parentbf1ce6a
3 files changed+21−20
examples/sortableList.hs+6−6 src/Reflex/Dom/Builder/Immediate.hs+7−14 test/hlint.hs+8
examples/sortableList.hs+6−6
@@ -27,12 +27,12 @@ main = mainWidget $ do
2727 values = zip3 (randoms (mkStdGen 0)) (randoms (mkStdGen 1)) (randoms (mkStdGen 2))
2828 testMap = Map.fromList $ zip keys values
2929 resort <- leftmost <$> sequence
30− [ fmap (comparing (view _1) <$) $ button "1 ASC"
31− , fmap (flip (comparing (view _1)) <$) $ button "1 DESC"
32− , fmap (comparing (view _2) <$) $ button "2 ASC"
33− , fmap (flip (comparing (view _2)) <$) $ button "2 DESC"
34− , fmap (comparing (view _3) <$) $ button "3 ASC"
35− , fmap (flip (comparing (view _3)) <$) $ button "3 DESC"
30+ [ (comparing (view _1) <$) <$> button "1 ASC"
31+ , (flip (comparing (view _1)) <$) <$> button "1 DESC"
32+ , (comparing (view _2) <$) <$> button "2 ASC"
33+ , (flip (comparing (view _2)) <$) <$> button "2 DESC"
34+ , (comparing (view _3) <$) <$> button "3 ASC"
35+ , (flip (comparing (view _3)) <$) <$> button "3 DESC"
3636 ]
3737 simpleSortableList f testMap resort
3838 return ()
src/Reflex/Dom/Builder/Immediate.hs+7−14
@@ -436,13 +436,7 @@ instance (Reflex t, MonadAdjust t m, MonadIO m, MonadHold t m, PerformEvent t m,
436436 return (result0, result')
437437 traverseDMapWithKeyWithAdjust (f :: forall a. k a -> v a -> ImmediateDomBuilderT t m (v' a)) (dm0 :: DMap k v) dm' = do
438438 initialEnv <- ImmediateDomBuilderT ask
439− let drawChildUpdate :: forall a. ImmediateDomBuilderT t m (v' a) -> m (Compose ((,,) DOM.DocumentFragment DOM.Text) v' a)
440− drawChildUpdate child = do
441− Just df <- createDocumentFragment $ _immediateDomBuilderEnv_document initialEnv
442− runImmediateDomBuilderT (Compose <$> ((,,) <$> pure df <*> textNodeInternal ("" :: Text) <*> child)) $ initialEnv
443− { _immediateDomBuilderEnv_parent = toNode df
444− }
445− (children0, children') <- lift $ traverseDMapWithKeyWithAdjust (\k v -> drawChildUpdate $ f k v) dm0 dm'
439+ (children0, children') <- lift $ traverseDMapWithKeyWithAdjust (\k v -> drawChildUpdate initialEnv $ f k v) dm0 dm'
446440 let result0 = DMap.map (\(Compose (_, _, v)) -> v) children0
447441 placeholders0 = weakenDMapWith (\(Compose (_, ph, _)) -> ph) children0
448442 result' = ffor children' $ mapPatchDMap $ \(Compose (_, _, r)) -> r
@@ -462,13 +456,7 @@ instance (Reflex t, MonadAdjust t m, MonadIO m, MonadHold t m, PerformEvent t m,
462456 return (result0, result')
463457 traverseDMapWithKeyWithAdjustWithMove (f :: forall a. k a -> v a -> ImmediateDomBuilderT t m (v' a)) (dm0 :: DMap k v) dm' = do
464458 initialEnv <- ImmediateDomBuilderT ask
465− let drawChildUpdate :: forall a. ImmediateDomBuilderT t m (v' a) -> m (Compose ((,,) DOM.DocumentFragment DOM.Text) v' a)
466− drawChildUpdate child = do
467− Just df <- createDocumentFragment $ _immediateDomBuilderEnv_document initialEnv
468− runImmediateDomBuilderT (Compose <$> ((,,) <$> pure df <*> textNodeInternal ("" :: Text) <*> child)) $ initialEnv
469− { _immediateDomBuilderEnv_parent = toNode df
470− }
471− (children0, children') <- lift $ traverseDMapWithKeyWithAdjustWithMove (\k v -> drawChildUpdate $ f k v) dm0 dm'
459+ (children0, children') <- lift $ traverseDMapWithKeyWithAdjustWithMove (\k v -> drawChildUpdate initialEnv $ f k v) dm0 dm'
472460 let result0 = DMap.map (\(Compose (_, _, v)) -> v) children0
473461 placeholders0 = weakenDMapWith (\(Compose (_, ph, _)) -> ph) children0
474462 result' = ffor children' $ mapPatchDMapWithMove $ \(Compose (_, _, r)) -> r
@@ -508,6 +496,11 @@ instance (Reflex t, MonadAdjust t m, MonadIO m, MonadHold t m, PerformEvent t m,
508496 return ()
509497 return (result0, result')
510498
499+drawChildUpdate :: MonadIO m => ImmediateDomBuilderEnv t -> ImmediateDomBuilderT t m (v' a) -> m (Compose ((,,) DOM.DocumentFragment DOM.Text) v' a)
500+drawChildUpdate initialEnv child = do
501+ Just df <- createDocumentFragment $ _immediateDomBuilderEnv_document initialEnv
502+ runImmediateDomBuilderT (Compose <$> ((,,) <$> pure df <*> textNodeInternal ("" :: Text) <*> child)) $ initialEnv { _immediateDomBuilderEnv_parent = toNode df }
503+
511504mkHasFocus :: (MonadHold t m, Reflex t) => Element er d t -> m (Dynamic t Bool)
512505mkHasFocus e = do
513506 let initialFocus = False --TODO: Actually get the initial focus of the element
test/hlint.hs+8
@@ -8,5 +8,13 @@ main = do
88 , "--ignore=Redundant do"
99 , "--ignore=Use camelCase"
1010 , "--ignore=Redundant $"
11+ , "--ignore=Use &&"
12+ , "--ignore=Use &&&"
13+ , "--ignore=Use const"
14+ , "--ignore=Use >=>"
15+ , "--ignore=Use ."
16+ , "--ignore=Use if"
17+ , "--ignore=Reduce duplication" --TODO: Re-enable this test
18+ , "--cpp-define=USE_TEMPLATE_HASKELL"
1119 ]
1220 if null ideas then exitSuccess else exitFailure