MisoActionLogger helps you quickly develop and debug your Miso
apps by wrapping your update
function to log every evaluated action and show you the app state
before and after.
We marshal your state tree to JS Objects to benefit from the rich object introspection features
of modern browser consoles. This imposes a ToJSON
constraint on your models.
Option 1: use nix-prefetch-git
to generate arguments for fetchFromGitHub
.
You'll end up with somthing like this:
miso-action-logger = ghcjs.callCabal2nix "miso-action-logger" (pkgs.fetchFromGitHub {
owner = "Lermex";
repo = "miso-action-logger";
sha256 = "1q6bpckz355paxcs10223fnl1d3lnxz2vcgj8l7nqvclicp04hsb";
rev = "917af7edc33e86b1510ebf2bc8e1b1bb9f03c164";
}) { miso = miso-ghcjs; }
Option 2: if your nixpkgs is recent enough, you can use pkgs.callHackageDirect
to fetch
directly from Hackage.
In both cases you will then need to add the package to your build arguments like this:
ghcjs.callCabal2nix "client" ./. {
miso = miso-ghcjs;
miso-action-logger = miso-action-logger;
}
module Main where
import MisoActionLogger
-- ...
main :: IO ()
main = do
let model = Model -- ...
startApp App {model = model, ..}
where
initialAction = NoOp
update = defaultActionLogger updateModel -- <-- wrap your update function
view = Routing.view
events = defaultEvents
subs = [ uriSub HandleURI ]
mountPoint = Nothing