# getting the types right for transformed distributions

**URL:** <https://discourse.julialang.org/t/getting-the-types-right-for-transformed-distributions/10042>\
**Category:** General Usage\
**Created:** [March 28, 2018, 10:24pm UTC](https://discourse.julialang.org/t/getting-the-types-right-for-transformed-distributions/10042 "2018-03-28T22:24:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 29, 2018, 6:02am UTC](https://discourse.julialang.org/t/getting-the-types-right-for-transformed-distributions/10042/2 "2018-03-29T06:02:13Z")

</div>

(Please [quote your code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530)).

In general, yes, this is the way to wrap some other object. In the specific example, I am not sure why you have a type parameter `S`, you could just have `T <: UnivariateDistribution` (perhaps you are using `S` somewhere? but that is not in the example).

Also, there is no reason to restrict to `Float64`, use some `R <: Real`, so that your code would work with eg [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) at zero performance cost.

---

_[View the full topic](https://discourse.julialang.org/t/getting-the-types-right-for-transformed-distributions/10042)._
