Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- broadcastText :: Text -> IO ()
- broadcastHtml :: Text -> IO ()
- broadcastPlot :: [(Double, Double)] -> IO ()
- data Message
- module Ghci.Websockets
Documentation
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.
Usage
- Start a GHCi session and run
initialiseDef
- Open
html/index.html
in a browser (it's self-contained, no http server required) - Use
broadcastText
,broadcastHtml
andbroadcastPlot
to show things in the browser window.
broadcastText :: Text -> IO () Source #
Show a string.
>>>
broadcastText "hello"
broadcastHtml :: Text -> IO () Source #
Insert some HTML into the DOM.
>>>
broadcastHtml "<h1>Hello</h1>"
broadcastPlot :: [(Double, Double)] -> IO () Source #
Show a Plotly 2D line plot of the given points.
>>>
broadcastPlot [(1, 2), (2, 5), (3, 4), (4, 3)]
>>>
broadcastPlot $ fmap (\i -> let i' = (fromIntegral i / 10) in (i', sin i')) [1..100]
Re-exports etc.
MsgText Text | A string |
MsgHtml Text | An HTML fragment |
MsgPlotly [Value] Value | The 'data' and |
module Ghci.Websockets