Update to PureScript 0.14 and Halogen 6 (#29)
parent
9858165d57
commit
4975e73125
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"parcel": "^1.12.4",
|
"parcel": "1.12.3",
|
||||||
"purescript": "^0.13.8",
|
"purescript": "^0.14.0",
|
||||||
"spago": "^0.15.3"
|
"spago": "^0.19.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "spago build",
|
"build": "spago build",
|
||||||
|
|
|
@ -118,7 +118,7 @@ let additions =
|
||||||
-}
|
-}
|
||||||
|
|
||||||
let upstream =
|
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 = {=}
|
let overrides = {=}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
module App.Button where
|
module App.Button where
|
||||||
|
|
||||||
import Prelude
|
import Prelude
|
||||||
|
|
||||||
import Data.Maybe (Maybe(..))
|
|
||||||
import Halogen as H
|
import Halogen as H
|
||||||
import Halogen.HTML as HH
|
import Halogen.HTML as HH
|
||||||
import Halogen.HTML.Events as HE
|
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 =
|
component =
|
||||||
H.mkComponent
|
H.mkComponent
|
||||||
{ initialState: \_ -> { count: 0 }
|
{ initialState: \_ -> { count: 0 }
|
||||||
, render
|
, 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 :: forall cs m. State -> H.ComponentHTML Action cs m
|
||||||
|
@ -25,11 +25,10 @@ render state =
|
||||||
[ HH.p_
|
[ HH.p_
|
||||||
[ HH.text $ "You clicked " <> show state.count <> " times" ]
|
[ HH.text $ "You clicked " <> show state.count <> " times" ]
|
||||||
, HH.button
|
, HH.button
|
||||||
[ HE.onClick \_ -> Just Increment ]
|
[ HE.onClick \_ -> Increment ]
|
||||||
[ HH.text "Click me" ]
|
[ HH.text "Click me" ]
|
||||||
]
|
]
|
||||||
|
|
||||||
handleAction :: forall cs o m. Action → H.HalogenM State Action cs o m Unit
|
handleAction :: forall cs o m. Action → H.HalogenM State Action cs o m Unit
|
||||||
handleAction = case _ of
|
handleAction = case _ of
|
||||||
Increment ->
|
Increment -> H.modify_ \st -> st { count = st.count + 1 }
|
||||||
H.modify_ \st -> st { count = st.count + 1 }
|
|
||||||
|
|
Loading…
Reference in New Issue