type view = Config of Config.config | Timer of Config.config let () = let html = Document.querySelectorUnsafe "html" in let main = Document.querySelectorUnsafe "main" in let rec showView v = Animation.replaceChild html main (fun _ -> match v with | Config config -> ConfigView.render config (fun config -> showView (Timer config)) | Timer config -> TimerView.render config (fun config -> showView (Config config))) in showView (Config Config.init)