on develop help sign in
Move PerformEvent, PostBuild, and TriggerEvent into the constraints of VtyApp
e6b6e1eAli Abrar
src/Reflex/Vty.hs+16−10
@@ -52,16 +52,21 @@ type VtyApp t m =
52 , Ref m ~ IORef
52 , Ref m ~ IORef
53 , Ref (HostFrame t) ~ IORef
53 , Ref (HostFrame t) ~ IORef
54 , MonadRef (HostFrame t)
54 , MonadRef (HostFrame t)
55− , NotReady t (PerformEventT t m)
55+ , NotReady t m
56+ , TriggerEvent t m
57+ , PostBuild t m
58+ , PerformEvent t m
59+ , MonadIO m
60+ , MonadIO (Performable m)
56 )
61 )
57 => Event t (V.Event)
62 => Event t (V.Event)
58 -- ^ Vty input events.
63 -- ^ Vty input events.
59− -> TriggerEventT t (PostBuildT t (PerformEventT t m)) (VtyResult t)
64+ -> m (VtyResult t)
60− -- ^ The output of the 'VtyApp'. The application runs in a context that
65+ -- ^ The output of the 'VtyApp'. The application runs in a context that,
61− -- allows new events to be created and triggered ('TriggerEventT'), provides
66+ -- among other things, allows new events to be created and triggered
62− -- access to an event that fires immediately upon app instantiation
67+ -- ('TriggerEvent'), provides access to an event that fires immediately upon
63− -- ('PostBuildT'), and allows actions to be run upon occurrences
68+ -- app instantiation ('PostBuild'), and allows actions to be run upon
64− -- of events ('PerformEventT').
69+ -- occurrences of events ('PerformEvent').
65
70
66-- | Runs a 'VtyApp' in a given 'Vty'.
71-- | Runs a 'VtyApp' in a given 'Vty'.
67runVtyAppWith
72runVtyAppWith
@@ -72,9 +77,10 @@ runVtyAppWith
72 -> IO ()
77 -> IO ()
73runVtyAppWith vty vtyGuest =
78runVtyAppWith vty vtyGuest =
74 -- We are using the 'Spider' implementation of reflex. Running the host
79 -- We are using the 'Spider' implementation of reflex. Running the host
75− -- allows us to take actions on the FRP timeline. For more information, see
80+ -- allows us to take actions on the FRP timeline. The scoped type signature
81+ -- specifies that our host runs on the Global timeline.
76− -- 'Reflex.Spider.Internal.runSpiderHost'.
82+ -- For more information, see 'Reflex.Spider.Internal.runSpiderHost'.
77− runSpiderHost $ do
83+ (runSpiderHost :: SpiderHost Global a -> IO a) $ do
78
84
79 -- Create an 'Event' and a "trigger" reference for that event. The trigger
85 -- Create an 'Event' and a "trigger" reference for that event. The trigger
80 -- reference can be used to determine whether anyone is "subscribed" to
86 -- reference can be used to determine whether anyone is "subscribed" to