0

This little pice of code has me confused:

respCount counts to 3 in case the url exists, to 2 in case of 404, but shouldn't it only count to 1? Also, the actual request gets issued just once.

I'm on the latest develop branch of reflex, reflex-dom

main :: IO ()
main = mainWidget widget

widget :: MonadWidget t m => m ()
widget = do
  postBuildEvt <- getPostBuild
  (respEvt :: Event t (Maybe Data.Aeson.Value)) <- getAndDecode $ "/api/config/ebb7e16b-8954-4320-829c-12d5e4fd3ea9" <$ postBuildEvt
  respCount <- count respEvt
  display respCount
  return () 
4

1 回答 1

1

当我编译(一个稍微不同的版本,仅修改为使用 warp runner)并运行时,我在终端中得到 "1" 和 Just "{\"status\":\"ok\"}"。
使用 GHCJS(大约 3 周前 reflex-platform 中的任何版本),我也得到“1”

于 2018-07-10T15:32:54.480 回答