| CARVIEW |
Shpadoinkle-debug: Debugging tools for Shpadoinkle applications.
Shpadoinkle tooling is a work in progress. But some useful functions have already emerged. This repo centeralizes these functions, and will house future work on more robust tooling, such as time travel debugging.
[Skip to Readme]
Downloads
- Shpadoinkle-debug-0.0.0.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 0.0.0.1 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | aeson, base (>=4.12.0 && <4.16), jsaddle (>=0.9.7 && <0.20), lens, text, unliftio [details] |
| License | BSD-3-Clause |
| Author | Isaac Shapira |
| Maintainer | fresheyeball@protonmail.com |
| Uploaded | by fresheyeball at 2020-06-21T22:06:27Z |
| Category | Web |
| Source repo | head: git clone https://gitlab.com/fresheyeball/Shpadoinkle.git |
| Distributions | |
| Downloads | 378 total (5 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs uploaded by user [build log] All reported builds failed as of 2020-06-21 [all 1 reports] |
Readme for Shpadoinkle-debug-0.0.0.1
[back to package description]Shpadoinkle Debug
This package exposes some useful debugging functions for tracing the state of Shpadoinkle applications as they change over time. It exposes 2 type classes currently.
class LogJS (c :: Type -> Constraint) where
logJS :: c a => a -> JSM ()
class LogJS c => Trapper c where
trapper :: c a => JSContextRef -> a -> a
These are intended to by used with TypeApplications, so you can choose the means of conversion before passing to console.log. For example:
main :: IO ()
main = runJSorWarp 8080 $ do
ctx <- askJSM
simple runParDiff initial (view . trapper @ToJSON ctx) getBody
Will log all state by first encoding to JSON with Aeson, then then logging with JSON.parse so the browser console has the nice native display. If we change it to trapper @Show ctx it will use the Show instance instead.