Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
fisx committed Feb 19, 2016
1 parent c065dc9 commit 7fd079c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Main.purs-spoiler-04-halogen-advanced
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Main where

import Control.Monad.Aff (runAff)
import Control.Monad.Aff (runAff, Aff())
import Control.Monad.Aff.Class (MonadAff)
import Control.Monad.Aff.Console (log)
import Control.Monad.Eff.Console (CONSOLE())
Expand Down Expand Up @@ -31,7 +31,7 @@ initialState = State [] [] 0

-- event handlers

data Button = Eval | Value Int | Plus
data Button = Inc | Value Int | Plus

data Query a = Click Button a

Expand All @@ -48,7 +48,7 @@ render (State log stack value) = H.div_
, H.input
[ P.inputType P.InputSubmit
, P.value "="
, E.onClick (E.input_ (Click Eval))
, E.onClick (E.input_ (Click Inc))
]

, valueButton 1
Expand Down Expand Up @@ -80,11 +80,11 @@ valueButton i = H.input
type CalcAff eff = Aff (HalogenEffects (console :: CONSOLE | eff))
type CalcDSL eff = ComponentDSL State Query (CalcAff eff)

eval :: forall eff. Natural State Query (CalcDSL eff)
eval :: forall eff. Natural Query (CalcDSL eff)
eval (Click button next) = do
liftAff' (log "click!")
modify (\(State log arr i) -> case button of
Eval -> State log arr (i + 1)
Inc -> State log arr (i + 1)
Value i' -> State log (i' : arr) i
Plus -> let newEntry = show arr ++ " -> " ++ show value
value = sum arr
Expand Down

0 comments on commit 7fd079c

Please sign in to comment.