lighthouse-client-0.2.0.0: Project Lighthouse client SDK
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lighthouse.Connection

Synopsis

The LighthouseIO monad

newtype LighthouseIO s a Source #

The central IO-ish monad to be used by lighthouse applications. Holds a connection.

Constructors

LighthouseIO (StateT (ConnectionState s) IO a) 

Instances

Instances details
MonadIO (LighthouseIO s) Source # 
Instance details

Defined in Lighthouse.Connection

Methods

liftIO :: IO a -> LighthouseIO s a #

Applicative (LighthouseIO s) Source # 
Instance details

Defined in Lighthouse.Connection

Methods

pure :: a -> LighthouseIO s a #

(<*>) :: LighthouseIO s (a -> b) -> LighthouseIO s a -> LighthouseIO s b #

liftA2 :: (a -> b -> c) -> LighthouseIO s a -> LighthouseIO s b -> LighthouseIO s c #

(*>) :: LighthouseIO s a -> LighthouseIO s b -> LighthouseIO s b #

(<*) :: LighthouseIO s a -> LighthouseIO s b -> LighthouseIO s a #

Functor (LighthouseIO s) Source # 
Instance details

Defined in Lighthouse.Connection

Methods

fmap :: (a -> b) -> LighthouseIO s a -> LighthouseIO s b #

(<$) :: a -> LighthouseIO s b -> LighthouseIO s a #

Monad (LighthouseIO s) Source # 
Instance details

Defined in Lighthouse.Connection

Methods

(>>=) :: LighthouseIO s a -> (a -> LighthouseIO s b) -> LighthouseIO s b #

(>>) :: LighthouseIO s a -> LighthouseIO s b -> LighthouseIO s b #

return :: a -> LighthouseIO s a #

MonadLogger (LighthouseIO s) Source # 
Instance details

Defined in Lighthouse.Connection

data Listener s Source #

A listener for events from the server.

Constructors

Listener 

Instances

Instances details
Monoid (Listener s) Source # 
Instance details

Defined in Lighthouse.Connection

Methods

mempty :: Listener s #

mappend :: Listener s -> Listener s -> Listener s #

mconcat :: [Listener s] -> Listener s #

Semigroup (Listener s) Source # 
Instance details

Defined in Lighthouse.Connection

Methods

(<>) :: Listener s -> Listener s -> Listener s #

sconcat :: NonEmpty (Listener s) -> Listener s #

stimes :: Integral b => b -> Listener s -> Listener s #

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.