@@ -25,10 +25,10 @@ data Query a
25
25
= UpdateText a
26
26
27
27
type State =
28
- { text :: String
28
+ { text ∷ String
29
29
}
30
30
31
- initialState :: State
31
+ initialState ∷ State
32
32
initialState =
33
33
{ text : " Name: Ace Editor"
34
34
}
@@ -38,38 +38,38 @@ type AceSlot = Unit
38
38
type StateP g = H.ParentState State AceState Query AceQuery g AceSlot
39
39
type QueryP = Coproduct Query (H.ChildF AceSlot AceQuery )
40
40
type MainHtml g = H.ParentHTML AceState Query AceQuery g AceSlot
41
- type MainEffects = H.HalogenEffects (random :: RANDOM , now :: NOW , ref :: REF , ace :: ACE )
41
+ type MainEffects = H.HalogenEffects (random ∷ RANDOM , now ∷ NOW , ref ∷ REF , ace ∷ ACE )
42
42
type MainAff = Aff MainEffects
43
43
type MainDSL = H.ParentDSL State AceState Query AceQuery MainAff AceSlot
44
44
45
- ui :: H.Component (StateP MainAff ) QueryP MainAff
45
+ ui ∷ H.Component (StateP MainAff ) QueryP MainAff
46
46
ui = H .parentComponent { render, eval, peek: Just (peek <<< H .runChildF) }
47
47
where
48
48
49
- render :: State -> MainHtml MainAff
49
+ render ∷ State → MainHtml MainAff
50
50
render state =
51
51
HH .div_
52
52
[ HH.Slot $ aceConstructor unit (initEditor state) Nothing
53
53
, HH .div_ [ HH .text state.text ]
54
54
]
55
55
56
- initEditor :: State -> Editor -> MainAff Unit
56
+ initEditor ∷ State → Editor → MainAff Unit
57
57
initEditor state editor = liftEff $ do
58
- session <- Editor .getSession editor
58
+ session ← Editor .getSession editor
59
59
Session .setMode " ace/mode/yaml" session
60
60
Editor .setValue state.text Nothing editor
61
61
pure unit
62
62
63
- eval :: Query ~> MainDSL
63
+ eval ∷ Query ~> MainDSL
64
64
eval (UpdateText next) =
65
65
pure next
66
66
67
- peek :: forall x . AceQuery x -> MainDSL Unit
67
+ peek ∷ forall x . AceQuery x → MainDSL Unit
68
68
peek (TextChanged _) = do
69
- text <- H .query unit $ H .request GetText
69
+ text ← H .query unit $ H .request GetText
70
70
H .modify (_ { text = fromMaybe " " text })
71
71
peek _ =
72
72
pure unit
73
73
74
- main :: Eff MainEffects Unit
74
+ main ∷ Eff MainEffects Unit
75
75
main = runHalogenAff $ H .runUI ui (H .parentState initialState) =<< awaitBody
0 commit comments