1{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE LambdaCase #-}
3{-# LANGUAGE RankNTypes #-}
4{-# LANGUAGE RecursiveDo #-}
8import Control.Monad.Fix
10import qualified Data.Map as Map
13import Reflex.EventWriter.Base
15import Reflex.Patch.MapWithMove
20 let actions = [ Increment, Update0th, Increment, Swap, Increment, Increment ]
21 os <- runAppB testPatchMapWithMove $ map Just actions
22 -- If the final counter value in the adjusted widgets corresponds to the number of times it has
23 -- been incremented, we know that the networks haven't broken.
24 let expectedCount = length $ ffilter (== Increment) actions
25 -- let !True = last (last os) == [expectedCount,expectedCount] -- TODO re-enable this test after issue #369 has been resolved
28data PatchMapTestAction
34-- See https://github.com/reflex-frp/reflex/issues/369 for the bug that this is testing.
42 => Event t PatchMapTestAction
43 -> m (Behavior t [Int])
44testPatchMapWithMove pulse = do
45 let pulseAction = ffor pulse $ \case
47 Swap -> patchMapWithMove $ Map.fromList
48 [ (0, NodeInfo (From_Move 1) (Just 1))
49 , (1, NodeInfo (From_Move 0) (Just 0))
51 Update0th -> patchMapWithMove $ Map.fromList
52 [ (0, NodeInfo (From_Insert 'z') Nothing) ]
53 (_, result) <- runBehaviorWriterT $ mdo
54 counter <- foldDyn (+) 1 $ fmapMaybe (\e -> if isNothing e then Just 1 else Nothing) pulseAction
55 _ <- mapMapWithAdjustWithMove
57 (tellBehavior $ constant [])
58 ((\t -> tellBehavior $ constant [t]) <$> updated counter))
59 (Map.fromList $ zip [0..] "ab")
60 (fmapMaybe id pulseAction)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list