@@ -4,33 +4,44 @@ import Prelude
44import Data.Maybe (Maybe (..))
55import Effect (Effect )
66import Halogen as H
7- import Halogen.HTML as HH
87import Halogen.Aff as HA
9- import Halogen.VDom.Driver ( runUI )
8+ import Halogen.HTML ( HTML , div_ , h1_ , li_ , text , ul_ )
109import Halogen.Hooks as Hooks
10+ import Halogen.VDom.Driver (runUI )
1111
1212main :: Effect Unit
1313main =
1414 HA .runHalogenAff do
1515 body <- HA .awaitBody
1616 void $ runUI hookComponent Nothing body
1717
18- hookComponent
19- :: forall unusedQuery unusedInput unusedOutput anyMonad
20- . H.Component HH.HTML unusedQuery unusedInput unusedOutput anyMonad
21- hookComponent = Hooks .component \_ _ -> Hooks .do
22- Hooks .pure $
23- HH .div_
24- [ HH .h1_ [ HH .text " My Grocery List" ]
25- , HH .ul_
26- [ HH .li_ [ HH .text " Black Beans" ]
27- , HH .li_ [ HH .text " Limes" ]
28- , HH .li_ [ HH .text " Greek Yogurt" ]
29- , HH .li_ [ HH .text " Cilantro" ]
30- , HH .li_ [ HH .text " Honey" ]
31- , HH .li_ [ HH .text " Sweet Potatoes" ]
32- , HH .li_ [ HH .text " Cumin" ]
33- , HH .li_ [ HH .text " Chili Powder" ]
34- , HH .li_ [ HH .text " Quinoa" ]
35- ]
36- ]
18+ hookComponent ::
19+ forall unusedQuery unusedInput unusedOutput anyMonad .
20+ H.Component HTML unusedQuery unusedInput unusedOutput anyMonad
21+ hookComponent =
22+ Hooks .component \_ _ -> Hooks .do
23+ Hooks .pure
24+ $ div_
25+ [ h1_ [ text " My Grocery List" ]
26+ , ul_
27+ [ li_ [ text " Black Beans" ]
28+ , li_ [ text " Limes" ]
29+ , li_ [ text " Greek Yogurt" ]
30+ , li_ [ text " Cilantro" ]
31+ , li_ [ text " Honey" ]
32+ , li_ [ text " Sweet Potatoes" ]
33+ , li_ [ text " Cumin" ]
34+ , li_ [ text " Chili Powder" ]
35+ , li_ [ text " Quinoa" ]
36+ ]
37+ ]
38+
39+ {-
40+ NOTE: Most Halogen codebases will reference HTML tags via an `HH` prefix
41+ (i.e. `HH.div` rather than `div`). The `HH` is from `import Halogen.HTML as HH`.
42+ Most developers _choose_ to use the `HH` prefix, but it is not a requirement
43+ of the language, nor the library.
44+
45+ To decrease verbosity and better compare this code to Elm's code,
46+ the above syntax does not use the `HH` prefix.
47+ -}
0 commit comments