成分の入力がその状態と異なるハロゲン成分を作りたいと思います。ハロゲンガイド(https://github.com/slamdata/purescript-halogen/blob/master/docs/5%20-%20Parent%20and%20child%20components.md#input-values)によれば、これは可能であるべきである。Purescriptハロゲン成分、入力対状態
import Prelude
import Data.Int (decimal, toStringAs)
import Halogen as H
import Halogen.HTML as HH
import Halogen.HTML.Events as HHE
type Input = Int
type State = String
data Query a = HandleInput Input a
component :: forall m. H.Component HH.HTML Query Input Void m
component =
H.component
{ initialState: id
, render
, eval
, receiver: HHE.input HandleInput
}
where
render :: State -> H.ComponentHTML Query
render state =
HH.div_
[ HH.text "My input value is:"
, HH.strong_ [ HH.text (show state) ]
]
eval :: Query ~> H.ComponentDSL State Query Void m
eval = case _ of
HandleInput n next -> do
oldN <- H.get
when (oldN /= (toStringAs decimal n)) $ H.put $ toStringAs decimal n
pure next
を次のように私はガイドからの例を変更しかし、その後、私は, receiver: HHE.input HandleInput
Could not match type
String
with type
Int
とラインでコンパイルエラーを取得する私はここで間違って何をしているのですか?