Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype LighthouseIO s a = LighthouseIO (StateT (ConnectionState s) IO a)
- data Listener s = Listener {
- onConnect :: LighthouseIO s ()
- onInput :: InputEvent -> LighthouseIO s ()
- runLighthouseApp :: Listener s -> Options s -> IO ()
- runLighthouseIO :: LighthouseIO s a -> Options s -> IO a
- getUserState :: LighthouseIO s s
- putUserState :: s -> LighthouseIO s ()
- modifyUserState :: (s -> s) -> LighthouseIO s ()
- sendRequest :: ClientRequest -> LighthouseIO s ()
- sendDisplay :: Display -> LighthouseIO s ()
- requestStream :: LighthouseIO s ()
- sendClose :: LighthouseIO s ()
- receiveEvent :: LighthouseIO s (Either Text ServerEvent)
The LighthouseIO monad
newtype LighthouseIO s a Source #
The central IO-ish monad to be used by lighthouse applications. Holds a connection.
LighthouseIO (StateT (ConnectionState s) IO a) |
Instances
A listener for events from the server.
Listener | |
|
runLighthouseApp :: Listener s -> Options s -> IO () Source #
Runs a lighthouse application using the given credentials.
runLighthouseIO :: LighthouseIO s a -> Options s -> IO a Source #
Runs a single LighthouseIO using the given credentials.
getUserState :: LighthouseIO s s Source #
Fetches the user state from the LighthouseIO monad.
putUserState :: s -> LighthouseIO s () Source #
Updates the user state from the LighthouseIO monad.
modifyUserState :: (s -> s) -> LighthouseIO s () Source #
Modifies the user state from the LighthouseIO monad.
Communication with the lighthouse
sendRequest :: ClientRequest -> LighthouseIO s () Source #
Sends a request to the lighthouse.
sendDisplay :: Display -> LighthouseIO s () Source #
Sends a display request with the given display.
requestStream :: LighthouseIO s () Source #
Requests a stream of the model, including input events and the display (though the latter is undocumented).
sendClose :: LighthouseIO s () Source #
Sends a close message.
receiveEvent :: LighthouseIO s (Either Text ServerEvent) Source #
Receives an event from the lighthouse.