r/functionalprogramming • u/Pestilentio • Apr 29 '24
Question Functional programming and Front End development
Hey everyone,
Recenly saw a talk about Effect (which seems that it's getting trendy on media) and was drawn back to studying FP again. I did some studying 2-3 years for about 3-4 months, I would say I got up to 20-30% of undestanding what its about, messing with fp-ts and trying to convert my existing imperative workflows to functional ones. I also refreshed some math in order to understand a bit more.
This time I got a Haskell book and I intend to make a deeper dive, aiming to create an intuition on how I design systems mostly. I know this is gonna take year(s) and I'm fine with that.
My question is in regards to tooling - I understand that, regarding web-apis and cli tool, there are a lot of choices in terms of programming languages that are quite solid. Regarding developing web-uis, in which you have to compile to js, is there an all-around, aknowledged way/framework? I've come across Rescript, Purescript, Elm and some more, but I have no idea about maturity and usage of those tools in production environments and I would like the opinion of people that do actually use any of those tools in production.
I'm new to all this and I would like to also have the ability to model the UI layer of my apps with FP, and the current state of Angular, React and Vue do not seem to quite fit with the FP model.
So what are your experiences regarding the Front End tooling and FP? Do we have any experienced Front End dev that do FP here? Are you happy working with your tooling? Which is your tool of choice? Do you use it at work? Have you done any interesting project to share? How do you find development in relation to popular tools like React/Angular/Vue?
View all comments
Show parent comment
3
u/ab5717 Apr 30 '24 edited Apr 30 '24
Honestly, same here for the most part I think a deeper grokking of
Applicatives andMonads could potentially help.One thing I remember from
Professor Frisby's Mostly Adequate Guideis that at one point, the author claimed on this page (at least as he was implementing it) something to the effect of:An
Applicativeshould be used when the order of operations doesn't matter. It's something that could be easily executed in parallel (since his examples are in JavaScript, I'm assuming via Web workers or maybe instances of a lambda invocation?).However, a
Monadwaits until the previous operation completes before starting the next one.Now, here's one (of several) things that was unclear to me. Does this behavior follow from the Abstract Algebra or Category Theory definitions? Or is that just specific to his (or Haskell's) implementation??
I see that people discussing this question in the context of Haskell agree with Professor Frisby (mostly).
Later he says
Why not just use monads and be done with it, you ask? It's good practice to work with the level of power you need, no more, no less. This keeps cognitive load to a minimum by ruling out possible functionality.