Skip to content

Commit

Permalink
Test on ball example
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Nov 13, 2023
1 parent dd0d5db commit 818d5ac
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions rhine-examples/src/Ball.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit 818d5ac

Please sign in to comment.