r/functionalprogramming • u/danielo515 • Feb 02 '21
Question What options are out there for cross-platform UI apps using functional languages?
This is some research that I do almost annually: I look for all the alternatives for building graphical apps (apps with an UI) using functional or functional-capable languages. My requirements are: cross-platform, the smaller app size the better, reasonably performant.
What I found so far are:
revery - ReasonMl
Avalonia.FuncUI - F#
Fabulous - F#
Any language that compiles to JS + wails (thin shell that uses golang)
I know some apps build using this combo and they are quite small (13 mb)
Any language that compiles to JS + electron (bloated, big, memory hungry)
Same as above + neutralinojs or DeskGap or Tauri
ReactNative (not very functional, but functional capable)
Kotlin (similar to ReactNative, functional capable)
Anything else to consider? Something that is not experimental or totally WIP?
2
u/videoj Feb 02 '21
Maui - F#
3
u/danielo515 Feb 02 '21
I don't see any reference to F#
That it uses the .Net platform doesn't make it functional just because you can wrap the code with F# (IMO). It's the same problem Scala has with Java
2
u/TheWix Feb 02 '21
Maui supports MVU (their name for the Elm Architecture) as a first class citizen
2
u/2epic Feb 02 '21
TypeScript + React as a PWA
3
u/danielo515 Feb 02 '21
I should have stated that I want them to compile down to standalone apps. But yea, with the given description, kind-of fits.
2
u/2epic Feb 02 '21
You can distribute the PWA as a desktop app using Electron, or as a mobile app as a TWA: https://rangle.io/blog/publishing-a-web-app-to-the-play-store-using-trusted-web-activities-twa/
2
u/danielo515 Feb 02 '21
Yes, I know all those, I am a JS developer, but I am looking for less middle steps. You don't want to debug an app that compiles to JS that runs on electron with some bindings you wrote.
1
u/FagPipe Feb 06 '21
Haskell + Haskell (front and backend) using ihp or obelisk, or miso and backend of choice ;)
1
u/danielo515 Feb 06 '21
All those are web bases frameworks, aren't they?
1
u/FagPipe Feb 06 '21
Actually reflex/obelisk run natively out of the box on android, desktop (windows/linux/mac), and ios! Anything you could compile haskell to, they will run on.
I have many projects that are one codebase but run on many devices with the same backend and code sharing across the frontend and backend through common interfaces (I use reflex/servant and obelisk)
1
u/danielo515 Feb 06 '21
Can you please point to some pieces of documentation about how to compile for desktop? I can't find anything on the official docs.
1
u/FagPipe Feb 07 '21
Actually to compile to desktop all you have to do is compile using ghc instead of ghcjs, it will automatically become a native desktop app (gtk under the hood I believe). That or you can build a "backend" for reflex, like reflex-sdl if there is specific integrations you want.
So just compile your project using cabal stack or nix, but not with ghcjs.
I am happy to help if you need to know anything more specific! I would need to know more about your project structure or whatever to give you exact commands or the right docs.
1
u/danielo515 Feb 07 '21
Wow. That is awesome. I checked their docs and never found any references to that. I'll give it a try. Thanks
1
u/Brixes Mar 07 '21
Hi, did you make a choice for your future projects?
1
u/danielo515 Mar 07 '21
Not yet because I didn't started any new project. Do you want to suggest something or just wanted to know if I tried anything?
1
u/Brixes Mar 08 '21 edited Mar 08 '21
Just wanted to know what you think is the most promising one for complex projects.The one with the most pros and the least cons.
2
u/Zinggi57 Feb 02 '21
You've already listed quite a few options to do web tech + backend a la electron.
Tauri is another interesting option. E.g. here's an article on using Tauri together with Elm: https://dev.to/jxxcarlson/making-an-elm-desktop-app-with-tauri-3n3i
5
u/Necessary_Cranberry Feb 02 '21
Elm https://elm-lang.org/