reflex-stone icon indicating copy to clipboard operation
reflex-stone copied to clipboard

Document how the build output is chosen

Open asheshambasta opened this issue 5 years ago • 2 comments

As I play with this further, another thing is very confusing: when do we use JSaddle-warp and when not? Here's what I did:

  • Took the reflex-stone as my template, and created a multi-project cabal.project based project. The project had the following directories:
  • frontend
  • backend
  • data
  • api

(since I was planning to use Servant and Servant reflex).

The frontend.cabal file remained mostly unchanged from the initial state. The perplexing thing is (and I cannot see any reason why this is happening), is that in the original (stone) project, running main calls mainWidget ...; which seems to fire up a warp server when called from the REPL (GHCI). In my project, when I try to do the same, for some reason, I'm greeted with a GUI (with some sort of DOM based UI).

There are some extra dependencies in the derived project, but everything else seems identical. And I've so far been unable to find out why.

A good discussion on JSaddle warp etc. may help with this kind of confusion.


I'm now looking into JSaddle warp on how to call run explicitly that fires up a warp server instead of the GUI. I've also opened https://github.com/reflex-frp/reflex-platform/issues/696 since I feel this must be documented on reflex-platform too.

asheshambasta avatar Oct 25 '20 10:10 asheshambasta

It depends on the useWarp flag (see project.nix). If it is set, reflex-dom's use-warp cabal flag is set by reflex-platform, which in turn instructs its mainWidget[WithHead] to use jsaddle-warp instead of jsaddle-gtk (the latter is the default for GHC).

See https://github.com/reflex-frp/reflex-dom/blob/ddf89778ed56373423fb38c6704a179278fdd49c/reflex-dom/src/Reflex/Dom/Internal.hs#L29-L61

srid avatar Oct 25 '20 17:10 srid

Hi @srid. Yes I read through the code as I posted the issue and maybe I should've clarified further. The issue is that in my case, the flag seems to have no effect. I see that this has also been observed in the past (see issue I opened on Reflex-platform). And it's been showing some very weird behaviour in my case. I've pushed my changes on asheshambasta/flowerpower

asheshambasta avatar Oct 25 '20 18:10 asheshambasta