Constant project_init::includes::MISO_LIB [] [src]

pub const MISO_LIB: &'static str = "{-# LANGUAGE RecordWildCards #-}\n\nmodule Lib\n    ( exec\n    ) where\n\n\nimport           Miso\n\ntype Model = Int\n\ndata Action\n  = AddOne\n  | SubtractOne\n  | NoOp\n  deriving (Show, Eq)\n\nexec :: IO ()\nexec = startApp App {..}\n  where\n    initialAction = NoOp\n    model  = 0\n    update = updateModel\n    view   = viewModel\n    events = defaultEvents\n    subs   = []\n\nupdateModel :: Action -> Model -> Effect Model Action\nupdateModel AddOne m = noEff (m + 1)\nupdateModel SubtractOne m = noEff (m - 1)\nupdateModel NoOp m = noEff m\n\nviewModel :: Model -> View Action\nviewModel x = div_ []\n    [\n      button_ [ onClick AddOne ] [ text \"+\" ]\n    , text (show x)\n    , button_ [ onClick SubtractOne ] [ text \"-\" ]\n    ]\n"