# Shpadoinkle Debug
[](https://gitlab.com/fresheyeball/Shpadoinkle)
[](https://opensource.org/licenses/BSD-3-Clause)
[](https://builtwithnix.org)
[](https://hackage.haskell.org/package/Shpadoinkle-debug)
[](http://packdeps.haskellers.com/reverse/Shpadoinkle-debug)
[](https://matrix.hackage.haskell.org/#/package/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.
```haskell
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:
```haskell
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.