-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Reflex.Host.Headless #413
Conversation
3a6b598
to
c96bffa
Compare
c96bffa
to
b3f2b0f
Compare
b3f2b0f
to
7e75086
Compare
@meditans can you look at the reflex-vty host and maybe grab some of the source documentation from there? this module will be easier to find than that one. |
Sure, let me do that @ali-abrar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really exciting, and with a little bit of work could totally deprecate reflex-basic-host
. I would love to have the ability to run multiple headless hosts be a part of mainline reflex.
Feel free to mine https://github.com/qfpl/reflex-basic-host/blob/f60ca05d5b7daec9513653cf6b805afe07bcac47/src/Reflex/Host/Basic.hs for other ideas.
-- allows us to take actions on the FRP timeline. The scoped type signature | ||
-- specifies that our host runs on the Global timeline. | ||
-- For more information, see 'Reflex.Spider.Internal.runSpiderHost'. | ||
(runSpiderHost :: SpiderHost Global a -> IO a) $ do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reflex-basic-host
is able to run independent networks in different threads. Here's some example code showing two basic hosts triggering each other's events. Would it be possible to do that here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I believe the answer is "yes", but is there any reason we shouldn't? I can't think of any.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a great idea, but I still think it should be weighted and examined in another PR. @3noch what would be your suggestion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a nice thing to have, but should not hold up this PR.
-- | Run a headless FRP network. Inside the action, you will most probably use | ||
-- the capabilities provided by the 'TriggerEvent' and 'PerformEvent' type | ||
-- classes to interface the FRP network with the outside world. Useful for | ||
-- testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something that's obvious in hindsight but confused me when I was fixing reflex-basic-host
: if none of your triggering events can fire, the whole thing jams up and falls over with a cryptic BlockedIndefinitelyOnMVar
-style message. Worth documenting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also useful for servers, which is where I'm most excited to be playing with headless hosts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One major deficiency for servers: Spider is completely single-threaded. For anything expecting high traffic, this is likely to be a problem. However, there's no reason in principle that we couldn't have a multithreaded Reflex implementation.
This originally came from the reflex-ghci test suite, but it's more broadly useful.