diff options
Diffstat (limited to 'aero/Ibb.hs')
-rw-r--r-- | aero/Ibb.hs | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/aero/Ibb.hs b/aero/Ibb.hs index e357317..8376060 100644 --- a/aero/Ibb.hs +++ b/aero/Ibb.hs @@ -1,45 +1,18 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} +-- | Front-end module Ibb where +import Biz.Ibb.Move import Miso -import Miso.String main :: IO () -main = startApp App {..} +main = miso $ \u -> App { model = Model u [], .. } where - initialAction = SayHelloWorld - model = 0 - update = updateModel - view = viewModel + initialAction = Nop + update = move + view = see events = defaultEvents subs = [] mountPoint = Nothing - -type Model = Int - --- | Sum type for application events -data Action - = AddOne - | SubtractOne - | NoOp - | SayHelloWorld - deriving (Show, Eq) - --- | Updates model, optionally introduces side effects -updateModel :: Action -> Model -> Effect Action Model -updateModel AddOne m = (m + 1) <# do - putStrLn "Hiya World" >> pure NoOp -updateModel SubtractOne m = noEff (m - 1) -updateModel NoOp m = noEff m -updateModel SayHelloWorld m = m <# do - putStrLn "Hiya World" >> pure NoOp - --- | Constructs a virtual DOM from a model -viewModel :: Model -> View Action -viewModel x = div_ [] - [ button_ [ onClick AddOne ] [ text "+" ] - , text (ms x) - , button_ [ onClick SubtractOne ] [ text "-" ] - ] |