I'm trying to write a simple FRP sample with Yampa that instead of waiting for 2 seconds (like here: https://wiki.haskell.org/Yampa/reactimate) will wait for a random amount of time within some bounds. I have tried multiple different approaches to somehow get the randomRIO function into the signal function but can't realy grasp what I am supposed to do. My intention is to replace the twoSecondsPassed function somewhat like this:
randomTimePassed :: SF () Bool
randomTimePassed = time >>> arr (\x -> x < randomRIO (0, 10))
but this doesn't seem to do the trick because of a type missmatch. The compiler outputs:
* Couldn't match type `m0 a0' with `Double'
Expected: SF Time Bool
Actual: SF (m0 a0) Bool
* In the second argument of `(>>>)', namely
`arr (\ x -> x < randomRIO (0, 10))'
In the expression: time >>> arr (\ x -> x < randomRIO (0, 10))
In an equation for `randomTimePassed':
randomTimePassed = time >>> arr (\ x -> x < randomRIO (0, 10))
Any pointers in the right direction would be greatly appreciated as I'm very new to Yampa and can't seem to find a proper documentation to help me out.