r/functionalprogramming • u/ContextMission8629 • Oct 28 '24
Question Are there any production-ready functional language for developing native desktop/mobile apps easily?
Hi guys, like what the title said, I'm looking for more information about whether there is a functional language that can be used to develop native desktop/mobile apps.
I love the way programs can be written with highly declarative style and type-safe manner, making the program easy to reason about. I'm tired of the way imperative and OOP languages makes me having to look at every nitty-gritty details to ensure my logic is correct due to a plethora of side effects.
I know if I want to do native apps, I'll need to have some kind of FFI to interop with each platform's specific APIs but I'm ok with that. But the main thing that I'm concern about is the memory usage of functional languages. I generally feel that they're not for high-performant desktop/mobile apps.
Did any of you have experience developing a small-to-medium apps and deploy it to app stores for real-world use?
Thanks a lot for stopping by and read my post!
14
u/lilyallenaftercrack Oct 28 '24
I never used it myself, but some people have been playing with Tauri + Elm
https://discourse.elm-lang.org/t/announcing-tauri-elm-app-a-template-for-building-desktop-apps-with-tauri/9460
13
u/Parasomnopolis Oct 28 '24
F# brings with it the whole .Net ecosystem. So you get things like:
5
u/frontenac_brontenac Oct 28 '24
TypeScript can be used to write functional code to great effect. It doesn't have typeclasses but everything else is just killer.
F# is long in the tooth but a decade ago I would have strongly recommended it.
5
u/pthierry Oct 29 '24
My team found a way around the lack of good support for this, because we didn't need to target desktop apps, only mobile: we made a Progressive Web App in Elm and published a container for it on app stores. I didn't check if this can be done for desktop too.
4
u/SillyTurboGoose Oct 28 '24
Have thought about the same thing. Makes total sense, in my mind, to model reactive-like virtual-DOM trees with functional monads. No reason a node should know about its grandchildren. Side effects sound like a pain though.
3
u/xiaodaireddit Oct 30 '24
write c++ in a functional style? or rust?
7
u/MaxPhantom_ Oct 28 '24
Tauri 2.0 with Rust for native bindings and React + Functional Typescript have been pretty great so far
4
u/[deleted] Oct 29 '24
Kotlin + Arrow is probably your best bet.
2
u/bedrooms-ds Oct 29 '24
No offense, but guis are one of the few exceptions where OOP feels natural. But, yes, I'd love to have a mature modern FP gui framework.
3
u/pi_meson117 Oct 28 '24
F# is pretty good since that area is a strength of c#. Avalonia caught my attention, but there are other options too.
Production-ready could be more subjective though. I know people have used dotnet Maui to make apps, but some were saying it was NOT production ready.
Scala is probably the current most used functional lang, and to my knowledge also has a few solid libraries for making apps.
3
u/theconsultingdevK Oct 30 '24
Currently working on developing a desktop app with Clojure. I am using Swing as it suits my needs better. There are reactive UI libraries for swing: SeeSaw, and JAVAFX: cljfx.
For mobile apps i use ClujureScript -> React Native.
3
u/lazy-lambda Oct 30 '24
You can try Scala which also has the whole JVM ecosystem available for integration.
2
u/Il_totore Nov 14 '24
Scala has many diverse and very mature web front libraries like Laminar and Tyrian. Works like a charm with Tauri and Ionic. You can also go full Scala with ScalaJS + Scala Native bindings with webview (instead of Tauri which is (more or less) Rust bindings for webview).
2
u/videoj Oct 30 '24
F# and FuncUI
F# has External Functions for native interop.
1
u/pthierry Nov 28 '24
Haskell has been used with
reflex-frp, but I don't think it's easy yet:Android app in Haskell, six months, no previous Android experience