on develop help sign in
Fix up some documentation
commite387279b7b8dbbd83c78759911d6b6542b266c50 authorAli Abrar <aliabrar@gmail.com> dateTue 27 Feb 2018, 12:56 (9 years ago) parent6d13144
1 file changed+18−17
src/Reflex/Vty.hs+18−17
src/Reflex/Vty.hs+18−17
@@ -29,7 +29,7 @@ import Reflex
2929import Reflex.Host.Class
3030import qualified Graphics.Vty as V
3131
32−-- | The output of a 'VtyApp'
32+-- | The output of a 'VtyApp'.
3333data VtyResult t = VtyResult
3434 { _vtyResult_picture :: Behavior t V.Picture
3535 -- ^ The current vty output. 'runVtyAppWith' samples this value every time an
@@ -38,7 +38,7 @@ data VtyResult t = VtyResult
3838 -- ^ An event that requests application termination.
3939 }
4040
41−-- | A functional reactive vty application
41+-- | A functional reactive vty application.
4242type VtyApp t m =
4343 ( Reflex t
4444 , MonadHold t m
@@ -51,7 +51,7 @@ type VtyApp t m =
5151 , MonadRef (HostFrame t)
5252 )
5353 => Event t (V.Event)
54− -- ^ Vty input events
54+ -- ^ Vty input events.
5555 -> TriggerEventT t (PostBuildT t (PerformEventT t m)) (VtyResult t)
5656 -- ^ The output of the 'VtyApp'. The application runs in a context that
5757 -- allows new events to be created and triggered ('TriggerEventT'), provides
@@ -59,12 +59,12 @@ type VtyApp t m =
5959 -- ('PostBuildT'), and allows actions to be run upon occurrences
6060 -- of events ('PerformEventT').
6161
62−-- | Runs a 'VtyApp' in a given 'Vty'
62+-- | Runs a 'VtyApp' in a given 'Vty'.
6363runVtyAppWith
6464 :: V.Vty
65− -- ^ A 'Vty' handle
65+ -- ^ A 'Vty' handle.
6666 -> (forall t m. VtyApp t m)
67− -- ^ A functional reactive vty application
67+ -- ^ A functional reactive vty application.
6868 -> IO ()
6969runVtyAppWith vty vtyGuest =
7070 -- We are using the 'Spider' implementation of reflex. Running the host
@@ -91,21 +91,22 @@ runVtyAppWith vty vtyGuest =
9191 -- result is a 'VtyResult', and a 'FireCommand' that will be used to
9292 -- trigger events.
9393 (vtyResult, fc@(FireCommand fire)) <- do
94− hostPerformEventT $ -- TODO document
94+ hostPerformEventT $ -- Allows the guest app to run
95+ -- 'performEvent', so that actions
96+ -- (e.g., IO actions) can be run when
97+ -- 'Event's fire.
9598
96− flip runPostBuildT postBuild $ -- Runs the guest app in a context
97− -- that provides access to a
98− -- "post-build" 'Event'
99+ flip runPostBuildT postBuild $ -- Allows the guest app to access to
100+ -- a "post-build" 'Event'
99101
100− flip runTriggerEventT events $ -- Runs the guest app in a context
101− -- that allows new events and
102− -- triggers to be created and writes
102+ flip runTriggerEventT events $ -- Allows the guest app to create new
103+ -- events and triggers and writes
103104 -- those triggers to a channel from
104105 -- which they will be read and
105− -- triggered.
106+ -- processed.
106107
107108 vtyGuest vtyEvent -- The guest app is provided an
108− -- 'Event' of vty inputs
109+ -- 'Event' of vty inputs.
109110
110111 -- Reads the current value of the 'Picture' behavior and updates the
111112 -- display with it. This will be called whenever we determine that a
@@ -152,7 +153,7 @@ runVtyAppWith vty vtyGuest =
152153 -- have subscribers, and update the display. If we detect a shutdown
153154 -- request, the application terminates.
154155 fix $ \loop -> do
155− -- Read the next event (blocking)
156+ -- Read the next event (blocking).
156157 ers <- liftIO $ readChan events
157158 stop <- do
158159 -- Fire events that have subscribers.
@@ -166,7 +167,7 @@ runVtyAppWith vty vtyGuest =
166167 killThread nextEventThread -- then stop reading input events and
167168 V.shutdown vty -- call the 'Vty's shutdown command.
168169
169− else do -- Otherwise, update the display and loop
170+ else do -- Otherwise, update the display and loop.
170171 updateVty
171172 loop
172173 where