What does HackerNews think of mostly-adequate-guide?

Mostly adequate guide to FP (in javascript)

Language: JavaScript

#4 in JavaScript
#16 in JavaScript
So, this is going to be an uphill battle for you. I suggest you actually learn Haskell first, and then you'll be able to apply its lessons to TypeScript.

Its tricky because these are patterns that are familiar in Haskell but are not really taught in other settings.

Additionally, to really learn these, you need to experiment with them. Use them. etc. That's pretty hard to do if the learning resources are mostly in haskell and you don't really understand it.

Alternatively, this might help: https://github.com/MostlyAdequate/mostly-adequate-guide

Also alternatively, what I would do is just go slowly through the fp-ts code. Look at it a piece at a time and slowly grow your understanding.

This may also help https://www.amazon.com/Domain-Modeling-Made-Functional-Domai...

There are a good deal of resources explaining these concepts in non-Haskell languages. This one is quite good and in javascript: https://github.com/MostlyAdequate/mostly-adequate-guide

As far as functors this could be rephrased more comprehensibly to those unfamiliar with Haskell as "What is a Functor, really? Functor is an interface here are some definitions:"

(typescript)

  interface ArrayFunctor {
      map: (f: ((a: A) -> B), arr: Array) -> Array
  }

  interface PromiseFunctor {
      map: (f: ((a: A) -> B), arr: Promise) -> Promise
  }

  interface ObservableFunctor {
      map: (f: ((a: A) -> B), arr: Observable) -> Observable
  }

"definitions" is plural here because typescript doesn't support higher-kinded types or else it might look like this:

  interface Functor {
      map: (f: ((a: A) -> B), arr: F) -> F
  }

(note, there are ways around this used in the fp-ts library, see here: https://www.matechs.com/blog/encoding-hkts-in-ts4-1)

> I actually do understand some useful subset of what Monads are and I just don't know it

This is certainly the case if you have ever used flatMap on an array or chained Promises (or other async structures like futures in other langs).

This is always my favorite: Professor Frisby's Mostly Adequate Guide to Functional Programming [1]

[1] : https://github.com/MostlyAdequate/mostly-adequate-guide

For Biology, and especially for Molecular biology I'd go for:

- Albert's Molecular Biology of the cell - https://www.amazon.com/dp/0815344325/ref=dp-kindle-redirect?... - It introduces basic Biochemistry, a lot of Genetics and Gene-regulation and Developmental biology. The book also touches other areas (but very vaguely) like Immunology... I think if you read this book you will be able to understand modern Molecular Biology papers.

- Biochem: Legninger's Principles of Biochemistry https://www.amazon.com/dp/B01K0PYUYQ/ref=dp-kindle-redirect?... - Our prof taught us from this, it has great visuals and covers a lot of areas.

- Developmental biology: Gilbert's - https://www.amazon.com/Developmental-Biology-Tenth-Scott-Gil... - it introduces more genetic regulation and development for all walks of life

- Human developmental biology: Bruce M. Carlson - Human Embryology and Developmental biology - https://www.amazon.com/Human-Embryology-Developmental-Biolog... - Again it's the choice of my prof, but I loved it, great images and visual explanations.

- Anatomy: I'd definitely go for anything by Netter -> https://www.amazon.com/Atlas-Human-Anatomy-Netter-Science/dp...

- Cancer: Robert A. Weinberg - The biology of cancer - https://www.amazon.com/Biology-Cancer-2nd-Robert-Weinberg/dp...

- Plant biochem: Biochemistry and Molecular Biology of Plants - https://www.amazon.com/Biochemistry-Molecular-Biology-Plants... - A very good book with great illustrations.

For electronics and Embedded:

- Art of Electronics by Paul Horovitz - https://www.amazon.com/Art-Electronics-Paul-Horowitz-ebook/d... - I saw that others also suggested it, great book

- Paul Scherz - Practical Electronics for inventors - https://www.amazon.com/Practical-Electronics-Inventors-Fourt... - I was introduced to electronics via this book. Not really a textbook but it's I think it's a great book to get started, it covers almost the same topics as the Art of Electronics but not as deep and with better visual explanations.

- Embedded systems - Michael Barr - Programming Embedded Systems in C and C++ - I was introduced to embedded software development by this book, when I was working for an IoT company and only had experience with systems and web programming.

Programming (my cherry picked favourites):

- Hacking: The Art of Exploitation - I love this book. I've read it after I had a few years of professional programming experience with C#. It introduces programming via C, also every example program is disassembled with GDB. It gives the reader an intuition of how C code compiled and what happens on the register level.

- C in a Nutshell: The Definitive Reference - Usually when you search for good books to learn C from, you get titles like The C programming language, Deep C Secret. But I think C in a Nutshell beats all other C books. (Especially when you read it together with C related chapters from The Art of Exploitation).

- Functional Programming in Scala - https://www.manning.com/books/functional-programming-in-scal... - I saw that other people suggested SICP, and I agree with that, it does a great job introducing to some parts of functional programming. But FPIS also introduces a strictly typed aspect of FP, functional parallelism, functional designs patterns... It's a great book.

- Concurrency in Go: Tools and Techniques for Developers - https://www.amazon.com/Concurrency-Go-Tools-Techniques-Devel... - I love the Go language and how it handles concurrency. This book does a great job of describing how the go runtime works, and does a great job explaining concurrency in general. Also there are a lot of good design patters in it.

- Professor Frisby's Mostly Adequate Guide to Functional Programming - https://github.com/MostlyAdequate/mostly-adequate-guide - It's not a textbook. This is the book that introduced me to FP. I love it, great book.

- Computer Systems: A Programmer's Perspective - https://www.amazon.com/dp/9332573905/ref=dp-kindle-redirect?... - This was the suggested textbook for https://courses.cs.washington.edu/courses/cse351/ that was also available on Coursera. Great book.

I enjoyed reading Professor Frisby's Mostly Adequate Guide to Functional Programming, 146 pages.

https://github.com/MostlyAdequate/mostly-adequate-guide

"Mostly adequate guide to FP (in javascript)"

I really enjoyed this one.

https://github.com/MostlyAdequate/mostly-adequate-guide

https://github.com/MostlyAdequate/mostly-adequate-guide is also didactic but goes into more details, and is not Haskell-specific (IIRC functors, map and so forth are all defined in JavaScript)
I have learnt monads via the absolutely MARVELOUS book by Brian Lonsdorf. cf https://github.com/MostlyAdequate/mostly-adequate-guide

I agree that Haskell is built around those concepts. But the point of learning category theory is to change your mindset when programming. And even in Javascript, it is super useful. (basically because, while trying to learn category theory, you become fluent in functional programming ).

I highly recommend to deeply understand JavaScript itself first. I personally recommend books from Dr. Axel Rauschmayer -- http://exploringjs.com After reading it you will have a strong foundation in prototypes, clojures, high-order functions, and other fundamental concepts.

Also, I can recommend spending some time playing with native DOM interface -- so you will understand what is event loop, how listeners are attached/detached, what is event delegation, how to traverse DOM (and what does it cost), and all that jazz.

Nowadays parts of functional programming are on the rise, so you might want to familiarize yourself with it a little bit -- https://github.com/MostlyAdequate/mostly-adequate-guide this is a good book, and fist 5-7 chapters are good enough to change your look at the programming.

This is a foundation, and without it it will be hard to write decent code in a fast and reliable manner. After that you can pick any library (whatever is needed for the jobs around you) or any framework, and try to solve your problem in it. There is not that much a benefit from just learning libraries, frameworks and tools per se, so I recommend to move gradually, and you will understand during your path what do you need better.

IMO the most accessible resource for learning functional concepts like Functors, Applicatives and Monads is the free online book: https://github.com/MostlyAdequate/mostly-adequate-guide

It uses Javascript to explain everything from scratch. Pure-functions, currying, composition, functors, monads, applicatives and so on.

Its free, so check it out. Reading it and understanding the concepts completely changed my whole coding style in the last couple of month. I hope functional javascript becomes more mainstream and we will soon call this stuff 'standard'. Its just too convenient to stack a Future on top of a Reader and get dependency injection + async function handeling without any boilerplate code.

P.S. Since ES6, javascript is wonderful. Functional code often really looks like lisp. Pity that we don't have macros (yet, and actually there is a way (sweet.js).

P.P.S. If DrBoolean got you hooked. You might want to check Ramda and fantasy-land. The former is a more functional minded underscore/lodash, the latter a specification (and community) for algebraic data structures in javascript to which a lot of new libraries adhere to.

On a similar note, and I am definitely still on the beginner scale for FP, but I really like Brian Lonsdorf's stuff on JS FP, for example:

- Mostly Adequate Guide [0]

- Professor Frisby Introduces Composable Functional JavaScript [1] - the style of video is 'interesting', but I recommend sticking with it if you can, because the content is great. Lots of comments on there about hating the style, but I quite liked it.

- Classroom Coding with Professor Frisby [2] which is his earlier work

All excellent. I still feel like I have a lot to learn and a lot goes over my head, but watching and reading these has made me appreciate how beautiful and intuitive the end result of FP can be, even when the concepts seem complex.

[0] https://github.com/MostlyAdequate/mostly-adequate-guide

[1] https://egghead.io/courses/professor-frisby-introduces-compo...

[2] https://www.youtube.com/playlist?list=PLK_hdtAJ4KqX0JOs_KMAm...

Which language(s) do you know already? If it's possible, have you looked at the state of FP in something you're already familiar with?

For example, this guide in JavaScript is pretty good: https://github.com/MostlyAdequate/mostly-adequate-guide/

Or in Ruby, while you still have to create classes, you could explore writing pure functions and not changing state.

Personally I feel like there's too many stumbling blocks in both those languages (unless you've got Lisp experience or are really into mathematics), and just getting used to the concepts in a more familiar environment will be more useful than scratching your head about monads.

If he's already learning JS, why not stick with functional concepts there, in a language he is familiar with.

Two resources I can recommend are:

- http://reactivex.io/learnrx/

- https://github.com/MostlyAdequate/mostly-adequate-guide

The second link in particular is quite an in-depth look at the more theoretical side of functional programming but the first part it deals with fundamentals which is quite good. and is not super complex to follow.

I say this as someone who can grasp the basics like functional composition, currying, partial application etc. but not stuff like monads, functors, etc. so take my advice for what it's worth :)

Good luck!