-
Notifications
You must be signed in to change notification settings - Fork 193
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
FRP interface reactiveOf #486
Conversation
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.
Cool!
codeworld-api/codeworld-api.cabal
Outdated
@@ -36,6 +40,12 @@ Library | |||
cereal >= 0.5.4 && < 0.6, | |||
cereal-text >= 0.1.0 && < 0.2 | |||
|
|||
if flag(reflex) |
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.
Do you think a flag is the right answer here? What exactly is the goal?
- If it's the additional dependency, I don't have any concerns about it. I'm happy to just depend on reflex without the flag.
- If you're trying to dissuade usage until you're more confident in the API, consider a WARNING pragma instead? Then people could still try it out on the live site.
- If it's about polluting the API, consider a different public module, like
CodeWorld.Reactive
, instead?
Or is there some reason we should be worried about pushing this live?
That was my worry. But if that is not a problem, I can remove it. Caveat: I have built reflex from github. I guess I should test if this actually works with reflex from hackage… I think the interface is pretty much the only sensible (the other option would be a I am also less worried about polluting the API, it is the “advanced” API anyways. |
I'll get the new version of Reflex up on hackage ASAP. I'd recommend holding off on upstreaming this until then, as there have been some breaking changes. |
This patch allows users to create interactions by defining a FRP program, based on the reflex library. The dependency on reflex is optional, and enabled with -freflex. This is a result of some hacking with the reflex people at the Compose Unconference. A mode where even reactive collaborations are supported depends on some fancy new feature in reflex, which would allow stats to be reset.
to keep CodeWorld/Driver clean (and to give @ryantrinkle an idea about what kind of interface I would have preferred here :-)).
Ryan, f93f42c has a sketch of the simple interface I would like to see. The downside is that it hard-codes the number of events and behaviors, and I am temped to pull out heterogeneous lists to fix that … but then it would not longer be simple… |
Given that events can be merged and fanned out, maybe you can get away with just one event for the simple host example. |
I was wondering: Is there a performance penalty of merging and fanning out? Also, this eventTriggerRef can contain a But that would break if the two events were merged and fanned out, right? |
There's not much of a penalty for fanning out - about the same as
traversing any other event. The fan primitive is designed to be lazy, so
even if you have an infinite number of keys in the potential input, you can
still deliver them efficiently. The overhead is something like
O(log(number of distinct keys that have been subscribed to)).
…On Mon, May 22, 2017 at 11:00 AM, Joachim Breitner ***@***.*** > wrote:
I was wondering: Is there a performance penalty of merging and fanning out?
Also, this eventTriggerRef can contain a Maybe. If this is Nothing, does
this mean that nobody is listening to this event? If CodeWorld could see
that the time event is not used, it could avoid looping (it already does
that in the other drivers, by some tricks involving comparing StableNames
).
But that would break if the two events were merged and fanned out, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#486 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABGlYJE7qOunf3EbGEQa5K3X5ZOrBPbSks5r8aMCgaJpZM4Nh0DV>
.
|
@nomeata @ryantrinkle Is there a fundamental reason why making time a |
Defining time as a Now, you could certainly accumulate an |
Okay, I see. Yeah, I guess if you had a |
@cdsmith Yep! Eventually, if we did a whole lot of work on continuous-time FRP (which Reflex is designed to be consistent with, as an extension), we might be able to provide something cleaner. However, I think making continuous time FRP nice to work with is still an open problem, and Reflex's approach of "time is just a totally-ordered set" seems to be great for most kinds of applications. |
@nomeata Do you prefer to merge this, or wait for Reflex changes? If the former, I'd prefer not to define a module in the Reflex hierarchy here. If that's just interim and you don't want to merge this, that's fine. Just checking. |
Oh, yeah, let's get Reflex.SimpleHost into Reflex. I'm getting close to having 0.5 ready for release, and I think I could stick that in quite easily. @nomeata Thoughts? |
There is no reason to hurry with this PR, so moving this module (or something similar) to |
I have a renewed interest in merging something like this now. I'm interested in turning http://code.world/haskell into a more general-purpose UI for building Haskell code with commonly used APIs. The first three on my list are gloss, reflex, and diagrams. Any thoughts on the right path forward here? There was some discussion about making changes to reflex to make this easier, and of this not working correctly with reflex. I'm happy to poke around a bit myself, but I may as well ask first. |
I think the question was just whether |
@cdsmith I had already been doing some hacking on the gloss front: https://github.com/hpacheco/codeworld-api-gloss |
This patch allows users to create interactions by defining a FRP
program, based on the reflex library. The dependency on reflex is
optional, and enabled with -freflex.
This is a result of some hacking with the reflex people at the Compose
Unconference (but all the code in this patch is mine).
A mode where even reactive collaborations are supported depends on some
fancy new feature in reflex, which would allow stats to be reset.
This might be of interest to @ryantrinkle and the other reflex guys.