Combining foldp
and click information can be unintuitive.
The usual solution employed is an ADT to encode the different possible events:
data Input = Init (Int, Int)
| Update { name : String
, rowsCols : ( Int, Int )
}
input = merge (Init <~ (sampleOn clicks rowsColsInitSignal))
(OtherInput <~ nameSignal ~ rowsColsSignal)
merge
merges two signals and always
creates a constant function.
Now you can just match by case in your update function:
stepBoard input g =
let newBoard =
case input of
Init (initRows, initCols) -> -- do your initialisation here
Update {name, rowsCols} -> -- do your update here
in { g | board <- newBoard }