HACKER Q&A
📣 low_tech_punk

Learning Functional Programming in 2022?


My gateway drug was Grokking Simplicity by Eric Normand. I'd love to know where to go next. A little bit about myself:

- 5 years of OOP in TypeScript

- Enjoyed React's shift towards functional paradigm

- Enjoyed RxJS

- Looked into Haskell and lisp, but can't find good places to use them: I tried Xmonad, and Emacs, but sorry, I didn't have a use case for neither of them.

- Had shallow experience in C/C#/Java/Python

- Enjoy programming as a creative activity; willing to spent lots of time honing my skills.


  👤 GiffertonThe3rd Accepted Answer ✓

👤 mdcds
Some background: I'm an experienced Scala dev who started out with Haskell.

Consider Elm since you're familiar with building web UIs. You can try re-implementing a project. And it's Haskell-inspired.

Otherwise, I'd say learning FP is about first learning how to use algebraic data types (ATDs) and the typeclass pattern. Once these two things become clear, some of the common typeclasses like Functor and Monad will become easy to grok. And both of those concept can be explored in Elm.


👤 r3a1d33p
I find this talk inspiring. Underscore.js got many things wrong for FP: https://www.youtube.com/watch?v=m3svKOdZijA.

I've read Grokking Simplicity too. It's very approachable book. Highly recommend it for JS/TS developers who want to learn FP!


👤 treman
There’s a Corecursive episode [1] about Elm for front-end development that maybe could be helpful.

[1] https://corecursive.com/teaching-fp-with-richard-feldman/

Edit: spelling


👤 bmitc
F#, Elixir, Erlang, Clojure, and Racket is where I would concentrate. Pick one and go for it. Find books that work through a domain in a project-like style and port the code to your language of choice.

Check out the course Programming Languages by Dan Grossman on Coursera.


👤 codeptualize
Sounds like you are mostly frontend. I can highly recommend ReScript https://rescript-lang.org/

I learned a lot about functional programming from it.

It is a more frontend focussed https://reasonml.github.io/ which is all based on OCaml. It has the same awesome type system and all the FP goodies while providing easy TS/JS interop and convenient escape hatches.

It compiles (very fast) to highly efficient readable JS that you can use wherever.