Skip to content

Commit c557720

Browse files
committed
use record update syntax
1 parent 02983df commit c557720

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/Web/DOM/Element.purs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,26 +150,17 @@ type ScrollToOptions_ =
150150
foreign import _scroll :: Element -> ScrollToOptions_ -> Effect Unit
151151

152152
scroll :: Element -> ScrollToOptions -> Effect Unit
153-
scroll elem _opts = _scroll elem opts
154-
where
155-
opts = let { top,left, behavior } = _opts
156-
in { top, left, behavior: stringScrollBehavior behavior }
153+
scroll elem opts = _scroll elem (opts { behavior = stringScrollBehavior opts.behavior })
157154

158155
foreign import _scrollTo :: Element -> ScrollToOptions_ -> Effect Unit
159156

160157
scrollTo :: Element -> ScrollToOptions -> Effect Unit
161-
scrollTo elem _opts = _scrollTo elem opts
162-
where
163-
opts = let { top,left, behavior } = _opts
164-
in { top, left, behavior: stringScrollBehavior behavior }
158+
scrollTo elem opts = _scrollTo elem (opts { behavior = stringScrollBehavior opts.behavior })
165159

166160
foreign import _scrollBy :: Element -> ScrollToOptions_ -> Effect Unit
167161

168162
scrollBy :: Element -> ScrollToOptions -> Effect Unit
169-
scrollBy elem _opts = _scrollBy elem opts
170-
where
171-
opts = let { top,left, behavior } = _opts
172-
in { top, left, behavior: stringScrollBehavior behavior }
163+
scrollBy elem opts = _scrollBy elem (opts { behavior = stringScrollBehavior opts.behavior })
173164

174165
data ScrollAlignment = Start | Center | End | Nearest
175166

@@ -196,11 +187,10 @@ foreign import _scrollIntoView :: Element -> ScrollIntoViewOptions_ -> Effect Un
196187
scrollIntoView :: Element -> ScrollIntoViewOptions -> Effect Unit
197188
scrollIntoView elem _opts = _scrollIntoView elem opts
198189
where
199-
opts = let { behavior, block, inline } = _opts
200-
in { behavior: stringScrollBehavior behavior
201-
, block: stringScrollAlignment block
202-
, inline: stringScrollAlignment inline
203-
}
190+
opts = { behavior: stringScrollBehavior _opts.behavior
191+
, block: stringScrollAlignment _opts.block
192+
, inline: stringScrollAlignment _opts.inline
193+
}
204194

205195
foreign import scrollWidth :: Element -> Effect Number
206196
foreign import scrollHeight :: Element -> Effect Number

0 commit comments

Comments
 (0)