-
Notifications
You must be signed in to change notification settings - Fork 4
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
Question: advice on holding a widget state #3
Comments
I'm not sure how to answer, your question is very broad. But if you want to go the "everything FRP" route, then I think that the paper "Declarative event-oriented programming" mentioned in the README might be a good starting point. |
I understand that my question was very vague, but still dared to ask :) |
No worries. Hope I could help! 😄 |
Can't resist, I'm so excited! I thought I would never understand how to program using FRP, but I actually started reading that Conal Eliott's paper you suggested above and trying to replicate same stuff for widget rendering, not with Fran, but using Reactive Banana and its glfw bindings I found on github. Also created a couple of my own AddHandlers on top of that. It almost feels like magic, I wire up some Behaviors, some Thanks for your help and for Reactive Banana, its api is really concise and nice :) |
Glad I could help. 🍌 |
Hi!
I am not sure if this is a proper place, but I wanted to ask you a question knowing you as an frp-expert :)
I'm rather new to FRP and haskell, but already familiar with basic concepts (am trying to write more and more functional code).
What I got interested in is to try to build a small UI-toolkit like app, which will render some widgets from ground up. I'm using a
nanovg-hs
library to do painting in OpenGL.All FRP libraries I see, rely on some existing UI toolkit (for example
threpenny-gui
,reflex-dom
use browser for this (html elements),reactive-banana
gets hooked up to eitherwx
orgtk
orsdl
)... so things like pushed state, click animations, focused rectangle etc are handled not by these libraries, but by lower level (and imperative-language) library.In my case I want to do everything in Haskell and this is where I got confused. Mainly I am not sure where to put state related to animation? For example, consider user pressing a button. I want to draw it pressed, then, after user released it, I want to play some fade animation of button's background for example.
And if all I have is a function which draws a button and accepts current time (or dt between frames), it would also need to know a time at which click has happened and store the current fade value etc etc. Where should this be stored? Should I create some typeclass where I would store this state and draw-function will read/modify it?
Perhaps this is a rather generic question, but I'm trying to at least figure out a direction in which to do my reasearch/googling :) I'd be glad to dive deep in some existing libraries for an answers or examples, but none of them does this kind of stuff by itself (if I'm not mistaken).
If you would give me some advice, or if you know some existing work I could use to learn from, it would be much appreciated.
Also I guess you should immediately close this issue, because I've used it as a means to simply ask a question, it's not a real issue :)
The text was updated successfully, but these errors were encountered: