heinrichapfelmus / frp-guides Goto Github PK
View Code? Open in Web Editor NEWA collection of tutorials, guidelines, examples, patterns and half-baked ideas on functional reactive programming (FRP).
A collection of tutorials, guidelines, examples, patterns and half-baked ideas on functional reactive programming (FRP).
I have written a number of custom widgets for threepenny-gui and reactive-banana as part of various projects, and was wondering whether these would be at all useful for this repository. It would be helpful to get some feedback on my designs and any improvements/alternatives for them, as well as help others by providing examples of patterns that I have found useful.
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 either wx
or gtk
or sdl
)... 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 :)
Hello @HeinrichApfelmus,
I would really appreciate a guide on the more opaque/arcane functions in Reactive.Banana.Combinators and Reactive.Banana.Frameworks (e.g. self-referential stepper vs accumB, reactimate vs execute vs mapEventIO), along with examples and caveats so that when it's unclear as to what function to use, or whether one would need to write a custom helper function to achieve a certain functionality, it is easier to figure out where to go. I would be more than happy to provide help (for what it is worth), as I am a novice Haskeller with FRP experience confined almost exclusively to threepenny-gui and reactive-banana. Also, a translation guide between the paradigms and patterns of those libraries would be immensely helpful as well, but that might be a more ambitious endeavor. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.