2

The question "Is Functional GUI programming possible?" was asked three years ago, a lot has changed since then. Things like the RX framework must have changed the way functional GUI programming can be done (in .NET at least). Clearly it is possible to do functional GUI programming; what would be the current best practice for it?

Edit to address the On Hold status:

What are the ways that you can do GUI programming in F#? Particularly are there any new approaches that did not exist when the question "Is Functional GUI programming possible?" was asked. What have been peoples experiences with these approaches? Positive and negative. Examples of what works and what doesn't would be great.

Community
  • 1
  • 1
Fsharp Pete
  • 741
  • 4
  • 16
  • I think my two F#-related answers to the old question still apply. WPF is essentially functional and async workflows make it really nice :-) – Tomas Petricek Apr 13 '14 at 13:44
  • 2
    One new thing in the F# world is Dmitry Mozorov's excellent series on WPF programming with F# which uses many of the nice functional F# features: https://github.com/dmitry-a-morozov/fsharp-wpf-mvc-series/wiki – Tomas Petricek Apr 13 '14 at 13:45
  • 1
    Not related to F# but FP in general. Check out Facebooks React: http://facebook.github.io/react/ for a JS UI framework that is in many ways functional. Especially the 'Om'-library by David Nolen, that sits on top of React, written in ClojureScript, is a particularly interesting functional way of doing web based UI: https://github.com/swannodette/om – Simon Stender Boisen Apr 13 '14 at 15:41
  • 2
    @TomasPetricek Are you aware of any MVVM-supporting frameworks for F# (e.g. similar to what Caliburn.Micro does for C#)? The series you linked is great, but there still seems a lot of 'boilerplate' has to be written (e.g. bindings), and unfortunately tooling is still behind C# - which is why personally I'm holding back on using F# in WPF/ASP MVC projects... – Patryk Ćwiek Apr 13 '14 at 19:00
  • The ReactiveUI framework works nice in my experience. It is built on top of excellent Rx.NET, which works as good or better in F#, because of more functional-oriented features of the language. For example, the possibility to implement an Rx workflow makes things simpler for when defining complex observables. – MisterMetaphor Apr 13 '14 at 20:47
  • 2
    @MisterMetaphor I looked at ReactiveUI, unfortunately things like routing still take *a lot* of ceremony. Mixing ReactiveUI and Caliburn.Micro is generally easy would be the way to go in C#, but setting up either ReactiveUI or Caliburn.Micro to work with F# is a world of pain - I know, I tried it. Especially since both libraries by default rely on partial view classes and instantiating views from them... – Patryk Ćwiek Apr 14 '14 at 10:01
  • @PatrykĆwiek can you please expand on why ReactiveUI is a world of pain in F#, I would have expected it to be a good fit. – Fsharp Pete Apr 15 '14 at 12:32
  • @TomasPetricek thanks for the link, I'll follow it up. Do you have any experience using that approach? – Fsharp Pete Apr 15 '14 at 12:34
  • @FsharpPete Well, I was talking about routing specifically. Both Caliburn.Micro and ReactiveUI rely on partial code-behind classes to create views - in ReactiveUI you even have to implement an [interface in code behind for pairing](https://github.com/reactiveui/ReactiveUI.Samples/blob/master/ReactiveUI.Samples.Routing/Views/WelcomeView.xaml.cs). There are no code-behind classes for XAML files (or partial class support) in F#... – Patryk Ćwiek Apr 15 '14 at 12:44

1 Answers1

2

maybe check into FsXaml and FsViewModule and watch the related video presentation from Reed Copsey

Coding Dude
  • 617
  • 1
  • 6
  • 16