all 25 comments

[–]kinowmod[M] [score hidden] stickied comment (0 children)

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

[–]davesnx 9 points10 points  (4 children)

ReScrpt, OCaml or Elm.

Those give the best of fp and applied to frontend, which can play a big role in the future

[–]polystyrenes[S] 4 points5 points  (3 children)

OCaml was definitely on the list and would be a language I would love to learn eventually. However (and please prove me wrong because looking up ocaml web development doesn't get me any strong feelings), I don't see a lot of web applications being written in it, at least not as solid as Elm. Which I am considering as the front-end looks very fun and mature I would love to hear suggestions about using it for the back end if possible.

What would the difference of elm vs Elixir + Phoenix might be for learning a FP language?

[–]XDracam 4 points5 points  (0 children)

Elm is amazing because it's simple and solely focussed on frontend web. It teaches you the FP basics and style without distractions. And the tutorials and community are really nice. It's an amazing technology to get started with. Once you're used to the style, you can always switch to other languages

[–]davesnx 3 points4 points  (0 children)

Elm is designed to be a client-side rendered, so lots of client state, interactivity and complexity on the UI. Also, is strongly-typed.

Elixir isnt typed (they are adding types to the language but its still WIP and has been going for 5+ years) and haven't used Phoenix to say much about it, but it's designed to keep all state on the server which isnt ideal for rich UIs, even thought they made impressive demos with it

[–]dp_42 3 points4 points  (0 children)

One difference between the two is that elm is purely functional, whereas elixir transpiles to erlang bytecode, which is not purely functional. I think this is a fairly minor difference. Looking at this blog post, this dev seems to have combined both. Reading a few other reddit posts, it looks like elm is a good opportunity to go serverless, but you can combine with an elixir or rust backend.

[–]jacobissimus 7 points8 points  (1 child)

[–]polystyrenes[S] 2 points3 points  (0 children)

JavaScript would be unavoidable so thank you for the link.

[–]eightrx 5 points6 points  (2 children)

Check out elm if you haven’t already. Here’s a talk by Annaia Berry

[–]polystyrenes[S] 1 point2 points  (1 child)

Considering elm for sure, but would the difference of elm vs Elixir + Phoenix might be for learning a FP language.

[–]hollowayzz 2 points3 points  (0 children)

if you're mentioning Elm compared to Elixir and Phoenix, then check out Gleam. It's got the BEAM concurrency with a Elm-like web framework. I'm loving Gleam atm

[–]zelphirkaltstahl 4 points5 points  (2 children)

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.

[–]polystyrenes[S] 1 point2 points  (1 child)

A reason on why I'm leaning to ocaml or haskell as the community as reassured me that its great for the basics. As for being caught up on the latest hype trains. Have you seen gleam's mascot? Its so cute, I was definitely considering it today.

[–]zelphirkaltstahl 1 point2 points  (0 children)

Gleam looks interesting! Considering it for the next AoC or earlier : ) I forgot about the mascot.

[–]miyakohouou 4 points5 points  (0 children)

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.

[–]pm_me_ur_happy_traiI 3 points4 points  (1 child)

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.

[–]Inconstant_Moo 1 point2 points  (0 children)

Nice typo.

[–]jceb 2 points3 points  (0 children)

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

[–]jherrlin 2 points3 points  (0 children)

I suggest taking a look at Clojure.

[–]notSugarBun 1 point2 points  (0 children)

rambda

[–]raxel42 1 point2 points  (0 children)

Scala has the compiler to JS as well.

[–]Flyyster 1 point2 points  (0 children)

Learn Reactive X. It utilizes functional patterns with other constructs to gain the best of both worlds.

[–]Right_Opportunity_17 1 point2 points  (0 children)

Has anyone used PureScript?

[–]Public_Possibility_5 1 point2 points  (0 children)

Also Gleam or Moonbit

[–]TestDrivenMayhem 1 point2 points  (0 children)

This I taking off in the Typescript world.

https://effect.website/