r/functionalprogramming • u/Voxelman • Mar 03 '24
Question Which functional language for Raspberry Pi?
I want to start a project that should also run on a Raspberry Pi (4 or larger).
My first choice was F#, but after a little research I'm a bit concerned about the memory usage. At least at the language benchmark game the dotnet solutions use more RAM than other languages, even Python need less.
The F# programs need about 10x of RAM compared to Python. Even C# needs more.
I know it's a bit difficult to compare because Python programs are only running on one core, but the difference between C# and F# is still significant. Is it just the special use case or do F# programs need significantly more RAM in general?
Haskell and Ocaml perform much better, but the ARM platform support seems to be not really mature (correct me if I'm wrong).
Is there any funktional language (from the ML family) that can be used on a Raspberry Pi? I need something that is significantly more performance then Python. If not, the next best option would be Rust.
View all comments
Show parent comment
3
u/pthierry Mar 04 '24
Our industry, the one with constant security breaches and outages, and all the failed projects, seems a surprising place to look for guidance on what works and what's useful.
We are an industry that sometimes dubs itself "engineering" yet most developers have zero knowledge about recent scientific results. That industry routinely does things that have been proven 30 years ago to be inadequate.
That industry, when C++ was designed, initially said "classes will be too slow!". Before Sun convinced everyone with a massive marketing campaign for Java, that industry was saying "GC will be too slow!". That industry keeps using ambient authority with all the security flaws it brings, when we have known about better security models for decades.
So no, popularity in the industry is not very good evidence that some tool is lacking.
A growing number of companies use Haskell in production. Usually, it's companies where both performance and reliability are important. But because our industry isn't big on producing code that is robust and reliable, well, accepting the kinds of constraints that Haskell adds doesn't seem valuable.
Try Haskell on a real project, where you do evolution and maintenance, and you'll see why we love Haskell. Languages like Purescript or Elm have similar strengths. The compiler is demanding and uncompromising but it quickly becomes you best ally. It guides you to completion of a refactor until everything is fixed and consistent again in terms of typing.