# How to merge docstrings of constructors with and without type parameters?

**URL:** <https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830>\
**Category:** General Usage\
**Tags:** question, documenter\
**Created:** [July 10, 2020, 8:01am UTC](https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830 "2020-07-10T08:01:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [July 10, 2020, 8:01am UTC](https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830/1 "2020-07-10T08:01:58Z")

</div>

I have a struct

```julia
struct HalfIntArray{T,N,A<:AbstractArray} <: AbstractHalfIntegerArray{T,N}
    parent :: A
    offsets :: NTuple{N,HalfInt}
end

```

for which I have two different sets of constructors:

```julia
"""
docstring 1
"""
HalfIntArray(A::AbstractArray, indices::AbstractUnitRange...)

```

and

```julia
"""
docstring 2
"""
HalfIntArray{T}(init, indices::AbstractUnitRange...)

```

I am trying to document both the constructors. The two docstrings work correctly in the REPL’s help mode, but I’m struggling to combine the docstrings using `Documenter` into one box. I have tried

```julia
@docs
HalfIntArray

```

but this only adds the first docstring. If I explicitly try to add the second using

```julia
@docs
HalfIntArray
HalfIntArray{T}

```

I obtain a warning about duplicate entries. Any help?

Btw this is my first time using `Documenter` so it’s quite possible that I am missing something obvious.

---

<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:** [July 10, 2020, 8:39am UTC](https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830/2 "2020-07-10T08:39:30Z")

</div>

> [@jishnub](#):
>
> struggling to combine the docstrings using `Documenter` into one box

I am not sure I understand the issue, but I don’t think that is merging docstrings is possible. Since they are semantically different constructors anyway, I am not even sure that it would be advisable to merge them. These should be documented like any two functions.

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [July 10, 2020, 8:47am UTC](https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830/3 "2020-07-10T08:47:10Z")

</div>

Ah ok.

The issue is that I’m not sure how to display the docstring for the second constructor at all while using `@docs`, although it does show up if I use `@autodocs`.

---

<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:** [July 10, 2020, 10:28am UTC](https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830/4 "2020-07-10T10:28:04Z")

</div>

I am sorry I did not understand the original question. This should work (I just tested it):

```julia
module X

export Foo

struct Foo{T,S} end

"the default"
Foo() = Foo{Int,Int}()

"one param"
Foo{T}() where T = Foo{T,Int}()

end # module

```

then in the docs, use the call syntax:

````markdown
```@docs
Foo()
Foo{T}()
```

````
