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

pub const MISO_LIB: &'static str = "{-# LANGUAGE OverloadedStrings #-}\n{-# LANGUAGE RecordWildCards   #-}\n\nmodule Lib\n    ( exec\n    ) where\n\n\nimport           Miso\nimport           Miso.String\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 Action Model\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 (toMisoString (show x))\n    , button_ [ onClick SubtractOne ] [ text \"-\" ]\n    ]\n"