Take action based on Distribution type in a type stable way?

I want to make a function that transforms some information given what kind of Distributions type a variable has. Something like:

tdist = typeof(prob.dist)
if tdist == Distributions.Gamma{Float64}
    par_transform[i] = exp(par)
elseif tdist == Distributions.Beta{Float64}
    par_transform[i] = logistic(par)

where prob.par is a float, and prob.dist is a Distributions type. The above works, but clearly is not type stable as tdist changes as I loop over an array of different distributions types. Is there a proper idiom for doing this kind of transformation? Or is this way the natural way?

define an auxilliary function:

transform(prob::Gamma, par) = exp(par)
transform(prob::Beta, par) = logistic(par)

then in your code

par_transform[i] = transform(prob, par)

Thank you so much … man my brain always forgets to actually use the key feature of Julia :wink: