Skip to content

Commit d5862f7

Browse files
committed
Use @doc instead
1 parent a7ce0f2 commit d5862f7

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

src/Functors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ usually using the macro [`@functor`](@ref).
2424
functor
2525

2626
@static if VERSION >= v"1.5" # var"@functor" doesn't work on 1.0, temporarily disable
27-
"""
27+
@doc """
2828
@functor T
2929
@functor T (x,)
3030

src/functor.jl

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,47 +30,6 @@ function functorm(T, fs = nothing)
3030
:(makefunctor(@__MODULE__, $(esc(T)), $(fs...)))
3131
end
3232

33-
"""
34-
@functor T
35-
@functor T (x,)
36-
37-
Adds methods to [`functor`](@ref) allowing recursion into objects of type `T`,
38-
and reconstruction. Assumes that `T` has a constructor accepting all of its fields,
39-
which is true unless you have provided an inner constructor which does not.
40-
41-
By default all fields of `T` are considered [`children`](@ref);
42-
this can be restricted be restructed by providing a tuple of field names.
43-
44-
# Examples
45-
```jldoctest
46-
julia> struct Foo; x; y; end
47-
48-
julia> @functor Foo
49-
50-
julia> Functors.children(Foo(1,2))
51-
(x = 1, y = 2)
52-
53-
julia> _, re = Functors.functor(Foo(1,2));
54-
55-
julia> re((10, 20))
56-
Foo(10, 20)
57-
58-
julia> struct TwoThirds a; b; c; end
59-
60-
julia> @functor TwoThirds (a, c)
61-
62-
julia> ch2, re3 = Functors.functor(TwoThirds(10,20,30));
63-
64-
julia> ch2
65-
(a = 10, c = 30)
66-
67-
julia> re3(("ten", "thirty"))
68-
TwoThirds("ten", 20, "thirty")
69-
70-
julia> fmap(x -> 10x, TwoThirds(Foo(1,2), Foo(3,4), 56))
71-
TwoThirds(Foo(10, 20), Foo(3, 4), 560)
72-
```
73-
"""
7433
macro functor(args...)
7534
functorm(args...)
7635
end

0 commit comments

Comments
 (0)