Skip to content

Commit

Permalink
yampa: Move definitions to separate line (KSG Haskell 1.3.0 - 5.2). R…
Browse files Browse the repository at this point in the history
…efs #266.

Prefer where appearing alone on a single line, not at the end of a line
or on the same line as the definition it introduces.
  • Loading branch information
ivanperez-keera committed Apr 29, 2023
1 parent 070c2a1 commit 1625c4a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions yampa/src/FRP/Yampa/Simulation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ evalAtZero :: SF a b
-> a -- ^ Input sample
-> (b, FutureSF a b) -- ^ Output x Continuation
evalAtZero (SF { sfTF = tf }) a = (b, FutureSF tf' )
where (tf', b) = tf a
where
(tf', b) = tf a

-- | Evaluate an initialized SF, and return an output and a continuation.
--
Expand All @@ -252,7 +253,8 @@ evalAt :: FutureSF a b
-> DTime -> a -- ^ Input sample
-> (b, FutureSF a b) -- ^ Output x Continuation
evalAt (FutureSF { unsafeSF = tf }) dt a = (b, FutureSF tf')
where (tf', b) = (sfTF' tf) dt a
where
(tf', b) = (sfTF' tf) dt a

-- | Given a signal function and time delta, it moves the signal function into
-- the future, returning a new uninitialized SF and the initial output.
Expand All @@ -267,11 +269,13 @@ evalAt (FutureSF { unsafeSF = tf }) dt a = (b, FutureSF tf')
--
evalFuture :: SF a b -> a -> DTime -> (b, SF a b)
evalFuture sf a dt = (b, sf' dt)
where (b, sf') = evalStep sf a
where
(b, sf') = evalStep sf a

-- | Steps the signal function into the future one step. It returns the current
-- output, and a signal function that expects, apart from an input, a time
-- between samples.
evalStep :: SF a b -> a -> (b, DTime -> SF a b)
evalStep (SF sf) a = (b, \dt -> SF (sfTF' sf' dt))
where (sf', b) = sf a
where
(sf', b) = sf a

0 comments on commit 1625c4a

Please sign in to comment.