4

I've been trying to learn functional reactive programming with GUIs in F#. From my understanding this pattern allows for uni directional data flow by updating a global State object which in turn update respective UI components. I've found posts like this one: http://steellworks.blogspot.de/2014/03/tutorial-functional-reactive.html which goes into how to subscribe to Observables and when an input changes, but I was trying to figure out how to keep an immutable global state which would update all necessary components. I'm trying to implement this in Eto.Forms since I want it to be cross-platform compatible I'm not sure if FRP is even the pattern that I'm looking for, or if i'm looking in the completely wrong direction.

Basically, my question is: how would I go about implementing an Elm like FRP pattern in F#

kaeedo
  • 458
  • 2
  • 13
  • 8
    What is your question? – Mark Seemann Aug 16 '16 at 20:47
  • 1
    This is a bit vague. But using a framework (Eto) on top of another (the native GUI, let's say WPF) will complicate things, especially in the beginning. This depends on your primary platform, but you could start maybe with WPF, and [Gjallarhorn](http://reedcopsey.github.io/Gjallarhorn/) will help you manage the state. – s952163 Aug 17 '16 at 01:43
  • No viable Elm-like FRP GUI framework exists in .Net. You'd have to create it from scratch. You'd have to do something like Elm/React, creating a "virtual ETO layer", with virtual events etc, doing diffs, and updating the real ETO view based on that. It'll be more challenging than the JS frameworks because you don't have `eval` to handle the virtual events, so I believe you'd be stuck needing a precompile step manually emitting CIL. – Dax Fohl Aug 17 '16 at 13:34
  • Your other option would be to use Fable and React Native, and either wrap Redux or create a more F#-style replacement for it. Note the latter may be easier than it sounds: there's a 99-line version of Redux. https://gist.github.com/gaearon/ffd88b0e4f00b22c3159. Of course this limits you to React Native, but that seems to be getting bigger. – Dax Fohl Aug 17 '16 at 16:49

0 Answers0