You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On first run, the window needs to be created, then on reload only the render function is updated. The setup presently looks like this with lookupStore (full demo here):
-- Store the render function behind a IORef for hot reloadrenderFuncStore::FS.Store (IORef (Window->IO()))
renderFuncStore =FS.Store0-- The ghcid entry pointmainGHCID::IO()
mainGHCID =FS.lookupStore renderFuncStoreID >>=\case-- This is a fresh reload, initialize the store and fork the main threadNothing-> initWindow
-- This is a hot reload, just update the stored render func IORefJust store -> updateStore
where-- FS.lookupStore needs the newtyped Store valueFS.Store renderFuncStoreID = renderFuncStore
The return value from lookupStore is not really useful since the store is global. I think this could be more ergonomic if foreign-store provided a isEmptyStore helper so that the entry point could be rewritten as follow:
Hello, I'm using foreign-store with ghcid to implement a hot reload feedback loop as suggested in https://discourse.haskell.org/t/live-reloading-gui-from-scratch/9569/2.
On first run, the window needs to be created, then on reload only the render function is updated. The setup presently looks like this with
lookupStore
(full demo here):The return value from
lookupStore
is not really useful since the store is global. I think this could be more ergonomic if foreign-store provided aisEmptyStore
helper so that the entry point could be rewritten as follow:What do you think, may I propose a PR with this
isEmptyStore
helper?Thanks!
The text was updated successfully, but these errors were encountered: