reflex

XhrRequest with reflex/reflex-dom

岁酱吖の 提交于 2019-12-05 23:51:41
问题 I want to perform a basic Ajax request, that's all. I use reflex for the frontend and Scotty for the backend. The Firefox Web Console tells me the request was a success and I see the expected result there. But the website switches from Just "default" to Nothing instead of Just "success!" . Here is a complete minimal example: import Reflex (holdDyn) import Reflex.Dom (button, el, mainWidget, display) import Reflex.Dom.Xhr (performRequestAsync, xhrRequest, decodeXhrResponse) import Reflex.Class

Creating a Behavior for a continuously measurable phenomenon

荒凉一梦 提交于 2019-12-05 16:24:56
问题 I would like to create a Behavior t a from an IO a , with the intended semantics that the IO action would be run every time the behavior is sample d: {- language FlexibleContexts #-} import Reflex.Dom import Control.Monad.Trans onDemand :: (MonadWidget t m, MonadIO (PullM t)) => IO a -> m (Behavior t a) I hoped I could do this by just executing the measurement in a pull : onDemand measure = return $ pull (liftIO measure) However, the resulting Behavior never changes after an initial measure

XhrRequest with reflex/reflex-dom

放肆的年华 提交于 2019-12-04 04:21:55
I want to perform a basic Ajax request, that's all. I use reflex for the frontend and Scotty for the backend. The Firefox Web Console tells me the request was a success and I see the expected result there. But the website switches from Just "default" to Nothing instead of Just "success!" . Here is a complete minimal example: import Reflex (holdDyn) import Reflex.Dom (button, el, mainWidget, display) import Reflex.Dom.Xhr (performRequestAsync, xhrRequest, decodeXhrResponse) import Reflex.Class (tag, constant) import Data.Default (def) main :: IO () main = do mainWidget $ el "div" $ do

Creating a Behavior for a continuously measurable phenomenon

夙愿已清 提交于 2019-12-04 02:34:01
I would like to create a Behavior t a from an IO a , with the intended semantics that the IO action would be run every time the behavior is sample d: {- language FlexibleContexts #-} import Reflex.Dom import Control.Monad.Trans onDemand :: (MonadWidget t m, MonadIO (PullM t)) => IO a -> m (Behavior t a) I hoped I could do this by just executing the measurement in a pull : onDemand measure = return $ pull (liftIO measure) However, the resulting Behavior never changes after an initial measure ment. The workaround I could come up with was to create a dummy Behavior that changes "frequently enough