To try out Netwire, I'm implementing Pong using the library. In the code I have a ball wire and a computer paddle wire, and since they depend on each other for some values I've been running into issues with infinite loops. Some pseudo-code to explain:
ball :: Wire () IO GameInput Ball
ball = (... define ball ...) . pcPaddle
pcPaddle :: Wire () IO GameInput Paddle
pcPaddle = (... define pcPaddle ...) . ball
The thing to notice is they take each other for inputs. I've tried to alleviate this by doing the following:
ball :: Wire () IO GameInput Ball
ball = ( ... ) . delay ( ... base paddle init ...) . pcPaddle
and other variations of using the delay
function in these two wires, but I'm getting the <<loop>>
runtime error regardless.
How do I initialize one of the wires so that this system can work?