-
Notifications
You must be signed in to change notification settings - Fork 2
/
FsLab.fsx
41 lines (35 loc) · 1.19 KB
/
FsLab.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#I "packages/XPlot.GoogleCharts/lib/net45"
#I "packages/Newtonsoft.Json/lib/net40"
#I "packages/FSharp.Data/lib/net40"
#I "packages/Google.DataTable.Net.Wrapper/lib"
#I "packages/Suave/lib/net40"
#I "packages/FsAlg/lib"
#I "packages/DiffSharp/lib/"
#I "packages/FSharp.Quotations.Evaluator/lib/net40"
#r "FSharp.Data.dll"
#r "XPlot.GoogleCharts.dll"
#r "Google.DataTable.Net.Wrapper.dll"
#r "Newtonsoft.Json.dll"
#r "FSharp.Quotations.Evaluator.dll"
#r "Suave.dll"
#r "DiffSharp.dll"
#r "FsAlg.dll"
open System.IO
open Suave
open Suave.Web
open Suave.Http.Files
module FsiAutoShow =
let mutable running = false
let charts = ResizeArray<string>()
let displayHtml html =
if not running then
let part = Suave.Http.Applicatives.pathScan "/chart/%d" (fun n -> Suave.Http.Successful.OK (charts.[n]))
async { startWebServer defaultConfig part } |> Async.Start
running <- true
charts.Add(html)
let url = sprintf "http://localhost:8083/chart/%d" (charts.Count-1)
System.Diagnostics.Process.Start(url) |> ignore
fsi.AddPrinter(fun (chart:XPlot.GoogleCharts.GoogleChart) ->
chart.Html |> displayHtml
"(Google Chart)")
let __<'T> : 'T = failwith "Not implemented!"