Skip to content

Commit 07e860c

Browse files
committed
replace Constant by Returns
1 parent 233569c commit 07e860c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/optics.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,17 @@ function _set(obj, optic, val, ::SetBased)
125125
)
126126
end
127127

128-
struct Constant{V}
129-
value::V
128+
if VERSION < v"1.7"
129+
struct Returns{V}
130+
value::V
131+
end
132+
(o::Returns)(x) = o.value
133+
else
134+
using Base: Returns
130135
end
131-
(o::Constant)(x) = o.value
132136

133137
@inline function _set(obj, optic, val, ::ModifyBased)
134-
modify(Constant(val), obj, optic)
138+
modify(Returns(val), obj, optic)
135139
end
136140

137141
@inline function _set(obj, optic::ComposedOptic, val, ::SetBased)

0 commit comments

Comments
 (0)