From 818d5accb804acc434df44e7f9814b98746034fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20B=C3=A4renz?= Date: Mon, 13 Nov 2023 15:53:49 +0100 Subject: [PATCH] Test on ball example --- rhine-examples/src/Ball.hs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/rhine-examples/src/Ball.hs b/rhine-examples/src/Ball.hs index 8691ccc3..be429c5c 100644 --- a/rhine-examples/src/Ball.hs +++ b/rhine-examples/src/Ball.hs @@ -10,6 +10,7 @@ import Data.Vector.Sized as VS -- rhine import FRP.Rhine +import qualified FRP.Rhine.SN.Free as Free type Ball = (Double, Double, Double) type BallVel = (Double, Double, Double) @@ -88,9 +89,24 @@ statusRh = statusMsg @@ waitClock ballStatusRh :: Rhine IO (SeqClock SimClock StatusClock) (Maybe BallVel) () ballStatusRh = ballRh >-- downsampleSimToStatus --> statusRh -main :: IO () -main = +mainOld :: IO () +mainOld = flow $ startVelRh >-- fifoUnbounded --> ballStatusRh + +mainNew :: IO () +mainNew = Free.flow $ Free.Rhine + { Free.clocks = Free.ConsClocks StdinClock $ Free.ConsClocks (waitClock :: SimClock) $ Free.UnitClock (waitClock :: StatusClock) + , Free.freeSN = + arr Free.Present + >>> Free.synchronous startVel + >>> Free.resampling fifoUnbounded + >>> Free.synchronous ball + >>> Free.resampling downsampleSimToStatus + >>> Free.synchronous statusMsg + >>> arr (const ()) + } + +main = mainNew