r/functionalprogramming • u/Experiment_SharedUsr • Feb 12 '24
Question Lean4 as a general programming language?
I don't need to prove theorems or do mathy stuff. I just need a good functional programming language to write programs in.
Every time I hear about Lean, it sounds just perfect: its type system is more powerful than even Haskell and its performance should be better than OCaml. It must also be a good general programming language, since its compiler and interpreter are written in Lean4.
However I can't find much about using Lean4 this way. It doesn't look like there are many libraries I can use to write applications.
Why isn't Lean4 used more as a general programming language? Where should I start if I wanted to try using it that way?
18
u/GunpowderGuy Feb 12 '24
From what i gather, lean 4 Is not used as a general programming language for two main problems
-Highly experimental
I use idris2 which Is a bit less experimental and has far More libraries ( probably the dependent language with the most libraries )
13
u/[deleted] Feb 12 '24
You're looking for Idris - dependent type system, focused on general purpose programming.
13
u/gelisam Feb 13 '24
Oh boy are you in for a treat, here's a whole book about it! By a famous author! And it's free!
https://lean-lang.org/functional_programming_in_lean/
8
u/MysteriousGenius Feb 12 '24
I also got super excited about using it as general purpose language and pestered the community about it for a week. From what I've got from Sebastian Ulrich and others:
3
u/[deleted] Feb 14 '24
No theoretical reason for Lean to not be a good general purpose language. I suspect that it will become one. But now it is very immature yet and Microsoft [mistakenly] does not take it seriously to make it a mature product, instead they think about it only as a research language unfortunately.
3
u/Thimoteus Feb 12 '24
It really depends on what you're trying to use it for. On one extreme, I wouldn't use it for enterprise-grade software. On the other extreme, I have used it for small personal projects (for example, I used it to write a static site generator for my own blog).
2
u/Artistic-Teaching395 Feb 12 '24
Functional languages usually always have their own compilers written in themselves as a proof of concept.
2
u/[deleted] Nov 28 '24
[removed] — view removed comment