ghci-websockets-0.0.2: A websocket server that survives GHCi reloads

Safe HaskellNone




This module provides the Message data type, and various constructors for it. It is intended to be used together with the 'html/index.html' file.


  1. Start a GHCi session and run initialiseDef
  2. Open html/index.html in a browser (it's self-contained, no http server required)
  3. Use sendText, sendHtml and sendPlot to show things in the browser window.

sendText :: Text -> IO () Source #

Show a string.

>>> sendText "hello"

sendHtml :: Text -> IO () Source #

Insert some HTML into the DOM.

>>> sendHtml "<h1>Hello</h1>"

sendPlot :: [(Double, Double)] -> IO () Source #

Show a Plotly 2D line plot of the given points.

>>> sendPlot [(1, 2), (2, 5), (3, 4), (4, 3)]
>>> sendPlot $ fmap (\i -> let i' = (fromIntegral i / 10) in (i', sin i')) [1..100]

data Message Source #


MsgText Text

A string

MsgHtml Text

An HTML fragment

MsgPlotly [Value] Value

The 'data' and layout parameters used for newPlot (see The first parameter is a list of Plotly traces (See, "Trace types"), the second parameter is a Plotly layout value (see, Layout)