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
reactive banana light #30
Comments
Actually, it appears to me that it's probably easiest to use #ifdefs to avoid code duplication. I will change reactive-banana so that it can in principle be used with UHC, hoping that you guys will help out with nasty details. On that note, I don't know much about UHC and the JS backend. Does it support |
On Thu, Mar 29, 2012 at 3:26 PM, Heinrich Apfelmus
IORef seems supported: Control.Monad.ST seems as well (at least the Lazy variant) transformers works fine although it needs a small fix because of an mtl on the other hand won't work because of fundeps. I haven't looked at containers/deepseq yet (Map/IntMap) but I think at base version reported by uhc is 3.0 but I think quite some 4.0 when looking at the reactive-banana dependency list, only fclabels In general I think most of what's needed is supported. Please let me know if I need to try specific pieces of code.
|
Ok, I have introduced a new flag Now it's your turn. :-) Disable the flag and beat the banana until it compiles with UHC. Let me know if you run into any problems. |
On Sat, Mar 31, 2012 at 4:16 PM, Heinrich Apfelmus
Thanks a lot, I'm making good progress. UHC's javascript backend hasn't implemented MVar yet. Next thing I walked in to: Data.Unique -- quite recent base thing, not very portable. I can and then, the killer dependency: Vault All in all, I think I can work around / implement these dependencies, Anyway, so far I'm quite happy that the model+combinators themselves I'll keep you posted.
|
Yep, I'm confident that this will work. Concerning It's fine to implement The Unfortunately, the The
(Huh, these pure implementations sure turn out to be really useful.) It uses Furthermore, the
No worries, we got this. :) I propose the following: Since I now have a good grasp of the problem areas, I will move the troublesome stuff into the After that, the only remaining problem is |
Created a new issue for the Does UHC have the ST monad? Strictly speaking, it's not needed for reactive-banana, but the vault package exports an ST interface. I think that ST can be implemented in terms of |
Heinrich Apfelmus
Yes, it's there. And Control.Monad.ST.Lazy too, so should be safe to
|
Another issue (not a show stopper) is the ScopedTypeVariables extension, which UHC doesn't support. With the extension you can: example :: forall t. Event t (InEvent, TimeStamp) -> Event t OutEvent
example mainIn = ...
where connectionEvent :: Event t (InEvent, TimeStamp)
connectionEvent = filterE isConnEvent mainIn here, the t in the type signature of connectionEvent refers to the t in example. example :: forall t. Event t (InEvent, TimeStamp) -> Event t OutEvent
example mainIn = ... (connectionEvent mainIn) ...
where connectionEvent :: forall t. Event t (InEvent, TimeStamp) -> Event t (InEvent, TimeStamp)
connectionEvent = filterE isConnEvent Of course now connectionEvent can move to the top level. |
For instance, the flag |
RankNTypes are supported and on by default, but ScopedTypeVariables don't seem to work. I can nag the devs about it, but I think I'll wait until after GADT/fundep/TF are done :) For now, just removing the type signatures of all nested stuff works, and I no longer have to pass extra arguments around to get hold of t. So my code is exactly the same as in GHC structurally, just without the signatures. I just have them commented for now and in case of errors, I enable a few to have GHC produce more helpful error messages. Not ideal, but it's workable. |
@bluescreen303 Ok. The latest commit on the vault package now uses the pure variant for non-GHC compilers. Furthermore, I was able to remove the dependency on unordered-containers when the |
nice, more progress :) vault compiles fine and I ran a few simple tests where I put haskell and JS objects into a vault and was able to retrieve them. reactive-banana itself still uses HashMap (Frameworks) and System/Mem/StableName (Internal/InputOutput) so it doesn't get much further. I think it was your plan to have all these things abstracted into vault right? I can see they are (conditionally) in Vault, but reactive-banana hasn't been updated to use that. |
Oops, I simply forgot to create and push a patch. The HashMap and StableName should be gone in the latest commit now. |
You forgot one line (26) in InputOutput. Other than that... it compiles! I haven't tried anything yet except for compiling, but I will probably do that this weekend and let you know. And then it's time for the nice work... reactive-bananana-html widget toolkit :) |
I ported my current code to use Frameworks.hs. There is however, some stuff UHC should fix for this to work flawlessly.There is an outstanding bug http://code.google.com/p/uhc/issues/detail?id=53. I worked around that with a small patch: https://gist.github.com/2350944 Also, I found that the code uses Control.Exception (evaluate) in a few places. Exception handling is not/partially implemented in the JS backend, so evaluate was missing. Do you think evaluate :: a -> IO a
evaluate x = (x `seq` return x) >>= return is enough for now? And lastly: I noticed 'actuate' doesn't block, so I can continue executing other stuff without thinking about starting new threads myself (which would be virtual of course, as JS is single threaded). It will probably also allow me to run networks in parallel (open systems, as we discussed in an email), so this is great. But is this the intended/expected behavior? I think this is all there is to this issue. As far as I'm concerned this issue can be closed. |
Great! Concerning Concerning Let me know if anything else comes up and how your experiments with reactive-banana work out in the end. :-) |
reactive-banana makes heavy use of extensions (GADTs, type families), preventing it from being compiled with the UHC compiler.
The semantics model itself (model.hs) is clean in this respect.
While the model isn't meant for high-performance situations, it probably suffices for web applications (UHC's javascript target).
It would be very nice if reactive-banana could have a smaller brother (reactive-banana-light) with the same semantics/API.
This way, code will be fairly portable between the light and normal versions.
The text was updated successfully, but these errors were encountered: