The two buttons affect the same counter.
Here is the source code:
import Fudgets main = fudlogue (shellF "Up/Down Counter" counterF) counterF = intDispF >==< mapstateF count 0 >==< (buttonF "Up" >+< buttonF "Down") count n (Left Click) = (n+1,[n+1]) count n (Right Click) = (n-1,[n-1])
buttonF "Up"
with
(buttonF "Up" >+< buttonF "Down")
using the operator
>+<
for parallel composition
Left
and output from the right component is tagged
Right
.
count
function will now receive
Left Click
or Right Click
, depending
on which button was pressed. It has been adjusted accordingly.