From 20bd95ef566403c06c97a6be6fee65b331c6c48c Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Fri, 6 Oct 2023 18:45:29 -0500 Subject: [PATCH] zufgzufg --- readme.md | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/readme.md b/readme.md index 2fd43ba..227ced3 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,11 @@ programming language that compiles to javascript (like typescript). ### Motivating example: React vs Halogen -this frontend app: +You don't have to understand exactly how these examples work, +I'm providing them simply for you to glance over and get a feeling +for reading typescript/javascript vs purescript. + +This app: 1. renders `"Loading..."` until either data or error 1. fetches data from a server 1. if ok, render items in a list. if error, render error span at the bottom of the page. @@ -62,10 +66,7 @@ export const App: () => React.Node = () => { Purescript Halogen (click to expand) ```haskell -type Item = { id :: String - , title :: String - , description :: String - } +type Item = { id :: String, title :: String, description :: String } data State = StateEmpty @@ -74,12 +75,11 @@ data State data Action = ActionInit -renderItem item = - div [] [ p [] [text item.title] - , span - [className "small"] - [text item.description] - ] +renderItem item = div [] [ p [] [text item.title] + , span + [className "small"] + [text item.description] + ] renderApp StateEmpty = p [] [text "Loading..."] renderApp (StateErrored e) = p [className "error"] [text (message e)] @@ -96,11 +96,7 @@ action ActionInit = do app = mkComponent { initialState: StateEmpty , render: renderApp - , eval: - mkEval ( defaultEval { handleAction = action - , initialize: Just ActionInit - } - ) + , eval: mkEval ( defaultEval { handleAction = action, initialize: Just ActionInit } ) } ```