Recommendations for learning functional programming

What would be good resources for learning functional programming that translate well to ReScript? There are a lot of resources for JavaScript, OCaml, and F# but not ReScript. Since JavaScript lacks many of ReScripts best features would it be better to learn from OCaml resources or maybe even F# (which also has its roots in OCaml)?

I’m more interested in learning practical application of the principles in order to write better code.

2 Likes

For me, learning and practicing OCaml has been really helpful in getting into the functional programming concepts. It also helped me to better understand the capabilities and boundaries of ReScript.

I’ve been reading the Real World OCaml book (https://dev.realworldocaml.org), which is available for free in the web. Good resource, and it’s also a nice reading.

I’m also interested in knowing other learning resources.

2 Likes

Thanks for the link. I’ll definitely be taking a look.

At the risk of spamming, let me plug my own book here: https://www.packtpub.com/product/learn-type-driven-development/9781788838016

It was written before the ReScript rebranding, but not much has changed (other than the ReScript syntax and some compiler outputs). I still think it’s a good way to get started.

It’s on sale right now ($5 for the ebook).

If you are looking for a free alternative, Prof. Dan Grossman’s free online course is a great resource as well: https://www.coursera.org/learn/programming-languages . It uses Standard ML as a teaching language, but more than 90% of the concepts carry over intact to ReScript.

5 Likes

I forgot that I had purchased this book last year. I guess I got side-tracked. Thanks for responding though and providing the additional resource as well. Nothing wrong with shameless self-promotion when it benefits the community :money_mouth_face:

Maybe try Scala? It’s known as a relatively practical language as functional languages go, and it’s sort of got a similar syntax to ReScript (like, it has some significant whitespace but also uses some C-like braces, parentheses, and semicolons).

Or elm? The syntax of Elm is really different, but because it’s exclusively a browser-side thing, it’s documentation ends up being very practical.

1 Like

RealWorldOCaml is a good book, but it’s focused on a lot of technical details without really teaching functional programming.
You can also check https://ocamlbook.org/ (git-src).

1 Like

A colleague of mine recommends Functional Programming In OCaml over RWO.

I second the Elm recommendation, it’s a small language and a good school. It also makes different tradeoffs than ReScript, so it’ll give you some perspective.

And yes, Yawar’s book is good, so buy it :wink:

3 Likes

As I go through Real World OCaml that definitely seems to be the case that it’s more about learning OCaml than learning functional programming principles using OCaml. Thanks for the link as well.

1 Like

Looks like a textbook for the course mentioned in the link be Yawar. I’ll definitely be taking a look. Oh, and I did purchase his book. :grinning:

this book is quite good https://www.amazon.com/Functional-Approach-Programming-Guy-Cousineau/dp/0521576814, it is written in caml-light syntax.

This has been my #1 recommendation for many years now and IMO is one of the best ways to learn Functional Programming particularly for JS devs. It gives a very good ground level understanding of FP; at my company we put all new JS developers through it during their training to give them a leg up on understanding FP techniques we use in TypeScript.

1 Like