on develop help sign in
Strictly evaluate the input to htmlInputElementSetChecked
7032becRyan Trinkle
src/Reflex/Dom/Widget/Input.hs+2−2
@@ -188,7 +188,7 @@ checkbox :: MonadWidget t m => Bool -> CheckboxConfig t -> m (Checkbox t)
188checkbox checked config = do
188checkbox checked config = do
189 e <- liftM castToHTMLInputElement $ buildEmptyElement "input" $ Map.insert "type" "checkbox" $ (if checked then Map.insert "checked" "checked" else Map.delete "checked") (_checkboxConfig_attributes config)
189 e <- liftM castToHTMLInputElement $ buildEmptyElement "input" $ Map.insert "type" "checkbox" $ (if checked then Map.insert "checked" "checked" else Map.delete "checked") (_checkboxConfig_attributes config)
190 eClick <- wrapDomEvent e elementOnclick $ liftIO $ htmlInputElementGetChecked e
190 eClick <- wrapDomEvent e elementOnclick $ liftIO $ htmlInputElementGetChecked e
191− performEvent_ $ fmap (liftIO . htmlInputElementSetChecked e) $ _checkboxConfig_setValue config
191+ performEvent_ $ fmap (\v -> liftIO $ htmlInputElementSetChecked e $! v) $ _checkboxConfig_setValue config
192 dValue <- holdDyn checked $ leftmost [_checkboxConfig_setValue config, eClick]
192 dValue <- holdDyn checked $ leftmost [_checkboxConfig_setValue config, eClick]
193 return $ Checkbox dValue
193 return $ Checkbox dValue
194
194
@@ -201,7 +201,7 @@ checkboxView dAttrs dValue = do
201 schedulePostBuild $ do
201 schedulePostBuild $ do
202 v <- sample $ current dValue
202 v <- sample $ current dValue
203 when v $ liftIO $ htmlInputElementSetChecked e True
203 when v $ liftIO $ htmlInputElementSetChecked e True
204− performEvent_ $ fmap (\v -> liftIO $ htmlInputElementSetChecked e v) $ updated dValue
204+ performEvent_ $ fmap (\v -> liftIO $ htmlInputElementSetChecked e $! v) $ updated dValue
205 return eClicked
205 return eClicked
206
206
207checkboxWithLabel :: forall t m. MonadWidget t m => String -> m (Checkbox t)
207checkboxWithLabel :: forall t m. MonadWidget t m => String -> m (Checkbox t)