Hello world

This commit is contained in:
towards-a-new-leftypol 2023-12-14 07:18:25 -05:00
parent 055bc806bc
commit 088c3f7d90
2 changed files with 59 additions and 9 deletions

View File

@ -52,19 +52,14 @@ extra-doc-files: CHANGELOG.md
-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
-- extra-source-files:
common warnings
ghc-options: -Wall
executable chandlr
-- if !impl(ghcjs)
-- buildable: False
-- Import common warning flags.
import: warnings
if !impl(ghcjs)
buildable: False
-- .hs or .lhs file containing the Main module.
main-is: Main.hs
ghc-options: -Wall -O2
ghcjs-options: -dedupe
-- Modules included in this executable, other than Main.

View File

@ -1,4 +1,59 @@
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Miso
( View
, startApp
, App (..)
, h1_
, text
, Effect
--, (#>)
, noEff
, defaultEvents
)
data Unit = Unit
deriving Eq
type Model = Unit
type Action = Unit
main :: IO ()
main = putStrLn "Hello, Haskell!"
main = startApp App
{ model = Unit
, update = mainUpdate
, view = mainView
, subs = []
, events = defaultEvents
, initialAction = Unit
, mountPoint = Nothing
}
mainView :: Model -> View Action
mainView = const $ h1_ [] [ text "Hello World" ]
mainUpdate :: Action -> Model -> Effect Action Model
-- mainUpdate = const $ (#>) (pure Unit) -- this is an infinite loop!
mainUpdate = const noEff
{-
- TODO:
- - Create Hello World page render
- - Create CatalogGrid component (static at first)
-}
{-
-
- TODO:
- - Initial page just needs to display the search bar, fetch catalog and
- display it
- Make Model
- - single value representing that we need to go fetch the initial page
-
- maybe immediately create the CatalogGrid component with its own model? That
- would allow us to swap it out with a thread / overboard component later, and
- tell it what to render
-}