Update to PureScript 0.14 and Halogen 6 (#29)

master
Raptazure 3 years ago committed by GitHub
parent 9858165d57
commit 4975e73125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,13 +1,13 @@
{
"private": true,
"devDependencies": {
"parcel": "^1.12.4",
"purescript": "^0.13.8",
"spago": "^0.15.3"
"parcel": "1.12.3",
"purescript": "^0.14.0",
"spago": "^0.19.1"
},
"scripts": {
"build": "spago build",
"serve": "parcel dev/index.html --open",
"build-prod": "mkdir -p prod && cp dev/index.html prod/ && rm -rf dist && spago bundle-app --to prod/index.js && parcel build prod/index.html"
}
}
}

@ -118,7 +118,7 @@ let additions =
-}
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200615/packages.dhall sha256:5d0cfad9408c84db0a3fdcea2d708f9ed8f64297e164dc57a7cf6328706df93a
https://raw.githubusercontent.com/purescript/package-sets/a0938edbed99b8739dcfc9303bda8e264f7fe853/src/packages.dhall sha256:595d52db8e1a061c5b5b7bddeea05c3d7167cd8ead86f19554611c568464f21f
let overrides = {=}

@ -1,35 +1,34 @@
module App.Button where
import Prelude
import Data.Maybe (Maybe(..))
import Halogen as H
import Halogen.HTML as HH
import Halogen.HTML.Events as HE
type State = { count :: Int }
type State
= { count :: Int }
data Action = Increment
data Action
= Increment
component :: forall q i o m. H.Component HH.HTML q i o m
component :: forall q i o m. H.Component q i o m
component =
H.mkComponent
{ initialState: \_ -> { count: 0 }
, render
, eval: H.mkEval $ H.defaultEval { handleAction = handleAction }
, eval: H.mkEval H.defaultEval { handleAction = handleAction }
}
render :: forall cs m. State -> H.ComponentHTML Action cs m
render state =
HH.div_
[ HH.p_
[ HH.p_
[ HH.text $ "You clicked " <> show state.count <> " times" ]
, HH.button
[ HE.onClick \_ -> Just Increment ]
[ HE.onClick \_ -> Increment ]
[ HH.text "Click me" ]
]
handleAction :: forall cs o m. Action → H.HalogenM State Action cs o m Unit
handleAction = case _ of
Increment ->
H.modify_ \st -> st { count = st.count + 1 }
Increment -> H.modify_ \st -> st { count = st.count + 1 }

Loading…
Cancel
Save