srid / reflex-stone

Template repository for writing GHCJS/Reflex apps targeting static sites without a backend.
https://srid.github.io/reflex-stone/
BSD 3-Clause "New" or "Revised" License
24 stars 3 forks source link

Document how the build output is chosen #8

Open asheshambasta opened 4 years ago

asheshambasta commented 4 years ago

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:

(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.

srid commented 4 years ago

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

asheshambasta commented 4 years ago

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