1{-# LANGUAGE FlexibleContexts, GADTs, RankNTypes, ScopedTypeVariables #-}
6import qualified Data.Dependent.Map as DMap
7import Data.Dependent.Sum
11import Reflex.Requester.Base
12import Reflex.Requester.Class
15data RequestInt a where
16 RequestInt :: Int -> RequestInt Int
20 os1@[[Just [10,9,8,7,6,5,4,3,2,1]]] <- runApp' (unwrapApp testOrdering) $
24 os2@[[Just [1,3,5,7,9]],[Nothing,Nothing],[Just [2,4,6,8,10]],[Just [2,4,6,8,10],Nothing]]
25 <- runApp' (unwrapApp testSimultaneous) $ map Just $
34unwrapRequest :: DSum tag RequestInt -> Int
35unwrapRequest (_ :=> RequestInt i) = i
37unwrapApp :: ( Reflex t, Monad m )
38 => (a -> RequesterT t RequestInt Identity m ())
42 ((), e) <- runRequesterT (x appIn) never
43 return $ fmap (map unwrapRequest . DMap.toList) e
45testOrdering :: ( Response m ~ Identity
46 , Request m ~ RequestInt
51testOrdering pulse = do
52 forM_ [10,9..1] $ \i -> requestingIdentity (RequestInt i <$ pulse)
55testSimultaneous :: ( Response m ~ Identity
56 , Request m ~ RequestInt
59 => Event t (These () ())
61testSimultaneous pulse = do
62 let tellE = fmapMaybe (^? here) pulse
63 switchE = fmapMaybe (^? there) pulse
64 forM_ [1,3..9] $ \i -> runWithReplace (requestingIdentity (RequestInt i <$ tellE)) $ ffor switchE $ \_ ->
65 requestingIdentity (RequestInt (i+1) <$ tellE)
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