1{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE RecursiveDo #-}
3{-# LANGUAGE ScopedTypeVariables #-}
8import Control.Monad.Fix
12import Reflex.EventWriter.Base
17 os1@[[Just [10,9,8,7,6,5,4,3,2,1]]] <- runApp' (unwrapApp testOrdering) $
21 os2@[[Just [1,3,5,7,9]],[Nothing,Nothing],[Just [2,4,6,8,10]],[Just [2,4,6,8,10],Nothing]]
22 <- runApp' (unwrapApp testSimultaneous) $ map Just $
29 os3@[[Nothing, Just [2]]] <- runApp' (unwrapApp testMoribundTellEvent) [Just ()]
33unwrapApp :: (Reflex t, Monad m) => (a -> EventWriterT t [Int] m ()) -> a -> m (Event t [Int])
35 ((), e) <- runEventWriterT $ x appIn
38testOrdering :: (Reflex t, Monad m) => Event t () -> EventWriterT t [Int] m ()
39testOrdering pulse = do
40 forM_ [10,9..1] $ \i -> tellEvent ([i] <$ pulse)
43testSimultaneous :: (Reflex t, Adjustable t m, MonadHold t m) => Event t (These () ()) -> EventWriterT t [Int] m ()
44testSimultaneous pulse = do
45 let e0 = fmapMaybe (^? here) pulse
46 e1 = fmapMaybe (^? there) pulse
47 forM_ [1,3..9] $ \i -> runWithReplace (tellEvent ([i] <$ e0)) $ ffor e1 $ \_ -> tellEvent ([i+1] <$ e0)
50-- | Test that a widget telling and event which fires at the same time it has been replaced
51-- doesn't count along with the new widget.
60 -> EventWriterT t [Int] m ()
61testMoribundTellEvent pulse = do
62 rec let tellIntOnReplce :: Int -> EventWriterT t [Int] m ()
63 tellIntOnReplce x = tellEvent $ [x] <$ rwrFinished
64 (_, rwrFinished) <- runWithReplace (tellIntOnReplce 1) $ tellIntOnReplce 2 <$ pulse
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