[Haskell-cafe] Random State Monad and Stochastics

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Mon May 2 03:13:06 EDT 2005


I don't think they are in the standard libraries but there was some discussion 
about them a few months ago but I couldn't find a reference.

Peter, Can you supply one? I think you were a participant in the discussion. 
Did you put a library of this sort of thing together?

Here's my tuppenceworth which I used to send a sequence of ip packets (as 
actions) and to stop when I got a destination unreachable:

sequenceWhile_ :: Monad m => (a -> Bool) -> [m a] -> m ()
sequenceWhile_ p [] =
   return ()
sequenceWhile_ p (x:xs) =
   x >>= \c -> if (p c) then sequenceWhile_ p xs else return ()

Dominic.



More information about the Haskell-Cafe mailing list