aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/src/Main.purs17
1 files changed, 8 insertions, 9 deletions
diff --git a/js/src/Main.purs b/js/src/Main.purs
index 3e470ae..a16b2cd 100644
--- a/js/src/Main.purs
+++ b/js/src/Main.purs
@@ -34,15 +34,14 @@ onInput numberElems { elem, number } = do
Dom.onInput elem (\value -> do
case Parser.number value of
Just newNumber ->
- let mul = newNumber / number
- in numberElems
- # map (\ne -> do
- inputNode <- Dom.selectElementFrom ne.elem (QuerySelector "input")
- case inputNode of
- Just node -> Dom.setValue (Number.format (ne.number * mul)) node
- _ -> pure unit
- )
- # Traversable.sequence_
+ numberElems
+ # map (\ne -> do
+ inputNode <- Dom.selectElementFrom ne.elem (QuerySelector "input")
+ case inputNode of
+ Just node -> Dom.setValue (Number.format (ne.number / number * newNumber)) node
+ _ -> pure unit
+ )
+ # Traversable.sequence_
_ ->
pure unit
)