I try to merge two signals. One is Mouse.clicks and another is Keyboard.space.
- On clicks, I should get a Signal(Int,Int) from Mouse.position as return value
- On space, I should get something different so I can identify different signal is triggered.
My idea is:
type Event = Click | Space
mergedSignal : Signal Event
mergedSignal =
let
clickSignal = map (\event -> Click) Mouse.clicks
timeoutSignal = map (\event -> Space) Keyboard.space
in
merge clickSignal timeoutSignal
and get position somehow:
positionOnClickSignal:Signal (Int,Int)
positionOnClickSignal = sampleOn Mouse.clicks Mouse.position
Obviously, it is wrong.