So when I understood you correctly, you want to have a symbolic representation
of the distribution, so that you can do symbolic transformations on them, but I
am not sure about it. Then you should specify, if your distributions are is
something known at compile time, or something that depends on data that is not
known at compile time. This is a very important difference, because my solution
I just posted can not handle distributions that are not known at compile time,
it can only process distributions defiend as functions at compile time. After
compilation it is not that easy to add a new function to the system itself, and
then it starts that you build your own virtual machine, and that is a lot more
complex.