r/functionalprogramming • u/polystyrenes • Jul 07 '24
Question Learning Functional for Web Dev
New to functional programming and it looks that I am entering an era where there are so many new languages and frameworks coming out and I am overloaded and where I should I spend my time. I would like a language that would not only teach me close to academically the uses of functional, but is also practical for web development as a project that I have in mind is centered around controlled digital lending. Would love for your suggestions. Thanks.
13
Upvotes
•
u/kinow mod Jul 07 '24
Hi u/polystyrenes, you may find something useful looking at previous posts from other users in this subreddit that were also looking for a programming language for functional programming: https://old.reddit.com/r/functionalprogramming/wiki/programming-languages
10
u/davesnx Jul 07 '24
ReScrpt, OCaml or Elm.
Those give the best of fp and applied to frontend, which can play a big role in the future
7
u/jacobissimus Jul 07 '24
I loved this book when I started https://mostly-adequate.gitbook.io/mostly-adequate-guide
5
u/eightrx Jul 07 '24
Check out elm if you haven’t already. Here’s a talk by Annaia Berry
5
u/zelphirkaltstahl Jul 07 '24
Focus on the basics (JS in web dev or some backend language rendering templates). Treat frameworks more like changing sets of clothes. Hypetrains pass by all the time. Don't get stuck in a loop of always chasing the latest hype.
5
u/miyakohouou Jul 08 '24
Haskell is quite useful for backend web development, and there are several frameworks to choose from. Professionally I work on a very large application built on top of Yesod and persistent. For personal projects, I'm a fan of servant for API-heavy projects. For quick and dirty backend projects I also enjoy scotty. I haven't used IHP personally, but it's a commercial product for building web applications in Haskell and I've heard good things about it.
My last experience with using Haskell on the frontend was quite a while ago, and at the time it was pretty rough and produced very heavy pages, so personally I'd suggest just doing your frontend in Elm or TypeScript, but I've heard that compiling to javascript is a lot better now than it used to be. If you want to explore that, I'd suggest checking out miso.
4
u/pm_me_ur_happy_traiI Jul 08 '24
If you watch the recent Honeypot React documentary and take a shit every time someone says "functional programming" you'll get alcohol poisoning in no time.
Lots of react developers aren't steeped in FP, and so the ecosystem is littered with bad role models. It's JavaScript, you can use it how you like. But it was created with functional programmers in mind. Data flows one way, which means you can model your app as a function of state. It pairs with typescript, and has the added benefit of being popular and easy to find jobs in.
3
u/jceb Jul 08 '24
I can recommend plain JS with https://sanctuary.js.org. David, the creator, made a really video introducing the library. I created a cheat sheet that helps getting started with various patterns, esp. Promises: https://github.com/identinet/sanctuary-cheat-sheet
3
u/jherrlin Jul 08 '24
I suggest taking a look at Clojure.
2
u/notSugarBun Jul 08 '24
rambda
2
u/raxel42 Jul 08 '24
Scala has the compiler to JS as well.
2
u/Flyyster Jul 08 '24
Learn Reactive X. It utilizes functional patterns with other constructs to gain the best of both worlds.
2
u/Right_Opportunity_17 Jul 08 '24
Has anyone used PureScript?
2
u/Public_Possibility_5 Jul 08 '24
Also Gleam or Moonbit
2
u/TestDrivenMayhem Jul 08 '24
This I taking off in the Typescript world.
https://effect.website/