2020-06-08 23:19:00 +03:00
|
|
|
# Haskell Code Spot
|
|
|
|
|
2020-06-20 00:53:53 +03:00
|
|
|
Visual tool to spot odd runtime behaviour of Haskell programs.
|
2020-06-08 23:19:00 +03:00
|
|
|
**Keywords:** *data scientist, GHC eventlog, UI experiments, creative/live coding*
|
|
|
|
|
2020-06-12 19:13:58 +03:00
|
|
|
### Learn these for coding
|
|
|
|
|
2020-07-15 15:13:56 +03:00
|
|
|
- HTML + CSS + JS *(https://www.youtube.com/kepowob/featured)*
|
2020-06-08 23:19:00 +03:00
|
|
|
- Svelte *(https://svelte.dev/tutorial/basics)*
|
|
|
|
- D3.js *(https://www.youtube.com/watch?v=_8V5o2UHG0E)*
|
2020-07-09 22:27:00 +03:00
|
|
|
- D3 flame graph *(https://github.com/spiermar/d3-flame-graph)*
|
2020-06-08 23:19:00 +03:00
|
|
|
- CodeMirror *(https://codemirror.net/doc/manual.html#api)*
|
|
|
|
- Scotty *(https://hackage.haskell.org/package/scotty)*
|
|
|
|
- GHC RTS design *(https://takenobu-hs.github.io/downloads/haskell_ghc_illustrated.pdf)*
|
2020-06-12 19:53:49 +03:00
|
|
|
- GHC Eventlog *(https://www.well-typed.com/blog/2019/09/eventful-ghc/)*
|
|
|
|
- ghc-events library *(https://hackage.haskell.org/package/ghc-events)*
|
2020-06-08 23:19:00 +03:00
|
|
|
- GHC HIE files *(https://www.haskell.org/ghc/blog/20190626-HIEFiles.html)*
|
2020-06-12 19:13:58 +03:00
|
|
|
|
|
|
|
### Quick Start Guide
|
|
|
|
|
|
|
|
In one terminal:
|
|
|
|
|
|
|
|
$ cd server && stack build && stack exec code-spot-server
|
|
|
|
|
|
|
|
In another terminal:
|
|
|
|
|
2020-06-16 16:46:03 +03:00
|
|
|
$ cd client/src && npm install && npm run dev
|
2020-06-12 19:13:58 +03:00
|
|
|
|
2020-06-12 19:20:47 +03:00
|
|
|
Now open [http://localhost:5000/](http://localhost:5000/) in your browser!
|
|
|
|
|
|
|
|
You will see a visualisation of [data/grin.eventlog](data/grin.eventlog)
|
2020-06-12 20:49:08 +03:00
|
|
|
(change in [client/src/App.svelte](client/src/App.svelte)).
|
|
|
|
|
|
|
|
### How to build your eventlog
|
|
|
|
|
|
|
|
If stack project is used, profiling must be enabled.
|
|
|
|
After compiled with profiling, one need to run it with RTS options plh.
|
|
|
|
|
|
|
|
```
|
|
|
|
stack build --profile --executable-profiling --library-profiling
|
|
|
|
stack exec --profile EXECUTABLE -- ARGUMENTS +RTS -p -l -h
|
|
|
|
```
|
2020-06-14 21:29:32 +03:00
|
|
|
|
|
|
|
### Previews:
|
|
|
|
|
2020-06-14 21:35:05 +03:00
|
|
|
This project is still in the proof-of-concept phase, but we had a great fun implementing the
|
|
|
|
initial version of heap inspections and the step-by-step debugger. All of these features
|
|
|
|
are based on visualizing the EventLog from GHC.
|
|
|
|
|
2020-06-14 21:29:32 +03:00
|
|
|
Heap Live
|
|
|
|
![](https://github.com/grin-compiler/haskell-code-spot/blob/master/doc/images/heaplive.png)
|
|
|
|
|
|
|
|
Heap Size
|
|
|
|
![](https://github.com/grin-compiler/haskell-code-spot/blob/master/doc/images/heapsize.png)
|
|
|
|
|
|
|
|
Cost Center based stack trace in step-by-step style.
|
|
|
|
![](https://github.com/grin-compiler/haskell-code-spot/blob/master/doc/images/stacktrace1.jpg)
|
|
|
|
![](https://github.com/grin-compiler/haskell-code-spot/blob/master/doc/images/stacktrace2.jpg)
|