From 00d5bb502a2106c98f6c8089166c09abb867b4e0 Mon Sep 17 00:00:00 2001 From: Arpan Chakraborty Date: Sun, 26 Apr 2026 17:52:08 +0530 Subject: [PATCH 1/2] Improve NamedDist docstring with fields documentation --- src/distribution_wrappers.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/distribution_wrappers.jl b/src/distribution_wrappers.jl index 33dd451ff..eaac5b145 100644 --- a/src/distribution_wrappers.jl +++ b/src/distribution_wrappers.jl @@ -10,7 +10,14 @@ using Distributions: using FillArrays: Fill """ + NamedDist{variate, support, Td, Tv} + A named distribution that carries the name of the random variable with it. + +# Fields + +- `dist::Td`: The underlying distribution. +- `name::Tv`: The name of the random variable as a `VarName`. """ struct NamedDist{variate,support,Td<:Distribution{variate,support},Tv<:VarName} <: Distribution{variate,support} @@ -122,4 +129,4 @@ function arraydist(dists::AbstractArray{<:Distribution}) end function arraydist(dists::AbstractVector{<:UnivariateDistribution}) return Product(dists) -end +end \ No newline at end of file From 09895d4d331ef4c17b8434ae426eb2110e074187 Mon Sep 17 00:00:00 2001 From: Arpan Chakraborty Date: Sun, 26 Apr 2026 23:06:40 +0530 Subject: [PATCH 2/2] Address review feedback: use constructor signature and TYPEDFIELDS --- src/distribution_wrappers.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/distribution_wrappers.jl b/src/distribution_wrappers.jl index eaac5b145..2c9657392 100644 --- a/src/distribution_wrappers.jl +++ b/src/distribution_wrappers.jl @@ -10,18 +10,19 @@ using Distributions: using FillArrays: Fill """ - NamedDist{variate, support, Td, Tv} + NamedDist(dist::Distribution, name::Symbol) A named distribution that carries the name of the random variable with it. # Fields -- `dist::Td`: The underlying distribution. -- `name::Tv`: The name of the random variable as a `VarName`. +$(TYPEDFIELDS) """ struct NamedDist{variate,support,Td<:Distribution{variate,support},Tv<:VarName} <: Distribution{variate,support} + "the underlying distribution" dist::Td + "the name of the random variable" name::Tv end