Created
March 25, 2015 08:30
-
-
Save lattenwald/59d36b9cc3383cef8882 to your computer and use it in GitHub Desktop.
netwire integralWith' (integralWith, correction function has time (a -> a))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
integralWith' | |
:: (W.HasTime t s, Fractional a) | |
=> (a -> a) -- ^ Correction function. | |
-> a -- ^ Integration constant (aka start value). | |
-> W.Wire s e m a a | |
integralWith' correct = loop | |
where | |
loop x' = | |
W.mkPure $ \ds dx -> | |
let dt = realToFrac (W.dtime ds) | |
x = correct (x' + dt*dx) | |
in x' `seq` (Right x', loop x) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment