Yet another Elm-like library based on Hyperapp
https://github.com/jorgebucaran/hyperapp
Documentation is published on Pursuit
module Example.Counter where
import Prelude hiding (div)
import Effect (Effect)
import Pha (VDom, text)
import Pha (sandbox, attachTo)
import Pha.Elements (div, span, button)
import Pha.Events (onclick)
type Model = Int
data Msg = Increment | Decrement
init ∷ Model
init = 0
update ∷ Model → Msg → Model
update n Increment = n + 1
update n Decrement = n - 1
view ∷ Model → VDom Msg
view counter =
div []
[ button [onclick Decrement] [text "-"]
, span [] [text $ show counter]
, button [onclick Increment] [text "-"]
]
main ∷ Effect Unit
main = sandbox { init, update, view}
# attachTo "root"
Counter2 (delayed action, raw events) Code | HTML
Randomness (+ animation) Code | HTML
Decoder (decoding events) Code | HTML
Inputs (event effects, text and checkbox inputs) Code | HTML