[Haskell-cafe] ANN: random-fu

Alexander Solla ajs at 2piix.com
Thu Jun 3 19:59:50 EDT 2010

On Jun 3, 2010, at 4:19 PM, mokus at deepbondi.net wrote:

> I don't think I understand.  My familiarity with probability theory is
> fairly light.  Are you referring to the fact that the PDF of the sum  
> of
> random variables is the convolution of their PDFs?  If so, the sum of
> random variables can already be computed as "liftA2 (+) :: Num a =>  
> RVar a
> -> RVar a -> RVar a" since RVar is an applicative functor (or using  
> liftM2
> since it's also a monad).
> Or perhaps you mean an operator that would take, say, 2 values of the
> 'Uniform' data type and return an instance of the 'Triangular' type
> corresponding to the convolution of the distributions?

I think I had something like the former in mind.  I didn't realize  
liftA2/M2 would do it.    When I did this last, I just wrote a monadic  
action to sample values from different RVars.  I should learn the  
higher order monad functions.

On the other hand, it might be kind of nice if RVar's knew which PDF  
they are over.  It's hard for me to see how that would be done with  

More information about the Haskell-Cafe mailing list