summaryrefslogtreecommitdiff
path: root/aero
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-03-27 09:25:12 -0700
committerBen Sima <ben@bsima.me>2019-03-27 09:25:35 -0700
commit77ff3088b9c8ff217c6ed6fb9093a5aabb2ea3ca (patch)
tree2ce318b75ed5b1d01827fca8a7a373f7888f0417 /aero
parentcfd213917c766c91f4c5fc7fdc91c2ca0ea13c26 (diff)
working miso app
structure is in place, need to add styles and logic
Diffstat (limited to 'aero')
-rw-r--r--aero/Ibb.hs39
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 "-" ]
- ]