Hello, I’m trying to get my head around types with a value parameter. Here I’m trying to implement a wrapper to the Normal
distribution type where two distributions must have the same Coefficient of Variability (CV) to be considered the same type. So I would like one of the parameters to have a type equal to the CV. Here’s what I’m trying:
using Distributions
struct A{CV,T}
a::Normal{T}
A{CV}(μ::Number) where CV = A(Normal(μ,μ*CV))
end
but
julia> A{0.4}(10)
ERROR: MethodError: no method matching A(::Normal{Float64})
Stacktrace:
[1] A{0.4,T} where T(::Int64) at ./REPL[6]:3
[2] top-level scope at REPL[7]:1d
Any idea how I could do this ?