essence-of-live-coding-warp-0.2.7: General purpose live coding framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

LiveCoding.Warp

Description

Live coding backend to the warp server.

If you write a cell that consumes Requests and produces Responses, you can use the functions here that run this cell as a warp application.

Synopsis

Documentation

runWarpC :: Port -> Cell IO (a, Request) (b, Response) -> Cell (HandlingStateT IO) a (Maybe b) Source #

Run a Cell as a WARP application.

  1. Starts a WARP application on the given port in a background thread
  2. Waits until the next request arrives, outputting Nothing in the meantime
  3. Supplies the cell with the input and the current request
  4. Serve the response and return the output

runWarpC_ :: Port -> LiveWebApp -> Cell (HandlingStateT IO) () () Source #

Like runWarpC, but don't consume additional input or produce additional output.

Suitable for a main program, for example like this:

mainCell :: Cell IO Request Response
mainCell = undefined

liveProgram :: LiveProgram (HandlingStateT IO)
liveProgram = liveCell mainCell

main :: IO ()
main = liveMain liveProgram