homepage: ''
changelog-type: markdown
hash: 9ca591341f69b29f2fab8b0c488c5bd64a55464d0fec57dad165052901206b3d
test-bench-deps: {}
maintainer: fresheyeball@protonmail.com
synopsis: Debugging tools for Shpadoinkle applications.
changelog: ''
basic-deps:
  unliftio: -any
  base: '>=4.12.0 && <4.16'
  text: -any
  lens: -any
  aeson: -any
  jsaddle: '>=0.9.7 && <0.20'
all-versions:
- 0.0.0.1
author: Isaac Shapira
latest: 0.0.0.1
description-type: markdown
description: |+
  # Shpadoinkle Debug

  [![Goldwater](https://gitlab.com/fresheyeball/Shpadoinkle/badges/master/pipeline.svg)](https://gitlab.com/fresheyeball/Shpadoinkle)
  [![BSD-3](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
  [![built with nix](https://img.shields.io/badge/built%20with-nix-41439a)](https://builtwithnix.org)
  [![Hackage](https://img.shields.io/hackage/v/Shpadoinkle-debug.svg)](https://hackage.haskell.org/package/Shpadoinkle-debug)
  [![Hackage Deps](https://img.shields.io/hackage-deps/v/Shpadoinkle-debug.svg)](http://packdeps.haskellers.com/reverse/Shpadoinkle-debug)
  [![Hackage CI](https://matrix.hackage.haskell.org/api/v2/packages/Shpadoinkle-debug/badge)](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.

license-name: BSD-3-Clause

Update from Hackage at 2020-06-21T22:11:46Z
Update from Hackage at 2020-06-21T22:11:46Z
