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 () 
Schoon
  • 394
  • 1
  • 9
  • Here is a gist with runnable code: https://gist.github.com/tgass/835beafba28af4a0f8ee8ac699cfdc47 – Schoon Jul 10 '18 at 12:20

1 Answers1

1

When I compile (a slightly different version, modified only to use the warp runner) and run I get "1" and Just "{\"status\":\"ok\"}" in the terminal.
With GHCJS (whatever version is in reflex-platform as of about 3 weeks ago), I also get "1"

AdamCS
  • 38
  • 5
  • Thank you! That really helped. I'm still investigating, but the problem seems to be that I was using GHC 8.0.2 and reflex platform is on 7.10. When I switched to GHC 7.10.3 it worked – Schoon Jul 11 '18 at 11:04
  • 1
    In the end it was not the version of GHC, but an older dependency to ghcjs-dom. After updating ghcjs-dom it solved it for good. – Schoon Jul 11 '18 at 13:16