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?
13
Feb 12 '24
You're looking for Idris - dependent type system, focused on general purpose programming.
13
u/gelisam Feb 13 '24
However I can't find much about using Lean4 this way.
Oh boy are you in for a treat, here's a whole book about it! By a famous author! And it's free!
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:
It is planned to work in direction of general purpose language. There's definitely some demand
Even now, there's nothing apart little amount of libs that can prevent you from using it (classic chicken/egg)
You can find some libs and initiatives that can be used, but I think a good central place is missing (https://github.com/axiomed, https://github.com/orgs/lurk-lab/repositories?q=&type=all&language=lean&sort=)
3
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).
1
2
u/Artistic-Teaching395 Feb 12 '24
Functional languages usually always have their own compilers written in themselves as a proof of concept.
2
Nov 28 '24
[removed] — view removed comment
3
u/Powerkaninchen Feb 02 '25
> Hello all,
> We’re assembling a team of proficient Lean 4/mathlib programmers for an ambitious project: developing a mathematical intelligence using LLMs.I did not read further
1
u/functionalprogramming-ModTeam Sep 03 '25
Self-promotion is OK as long as you read and understand this Reddit page about self-promotion (excessive self-promoting is moderated, unfortunately subjectively but just so it's not completely banned). Contact the mods when in doubt.
18
u/GunpowderGuy Feb 12 '24
From what i gather, lean 4 Is not used as a general programming language for two main problems
No libraries for non theorem proving or meta programming ( so only libraries meant to Flex the language )
-Highly experimental
I use idris2 which Is a bit less experimental and has far More libraries ( probably the dependent language with the most libraries )