[Haskell-cafe] Multiple State Monads

Luke Palmer lrpalmer at gmail.com
Mon Jan 12 21:55:13 EST 2009


On Mon, Jan 12, 2009 at 6:34 PM, Phil <pbeadling at mail2web.com> wrote:

> -- Monad Implementation
>
> evolveUnderlying :: (Double, Word64) -> ( (), (Double, Word64) )
> evolveUnderlying (stock, state) = ( (), ( newStock, newState ) )
>   where
>    newState = ranq1Increment state
>    newStock = stock * exp ( ( ir - (0.5*(vol*vol)) )*timeStep + (
> vol*sqrt(timeStep)*normalFromRngState(state) ) )
>

How about:

evolveUnderlying :: (Double, Word64) -> (Double, Word64)
evolveUnderlying (stock, state) = (newStock, newState)
  where ...

getEvolution = modify evolveUnderlying

Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090112/022569dd/attachment.htm


More information about the Haskell-Cafe mailing list