Functional JavaScript

Build Status

This tiny book may only take you 2 hours to read, but it may take you to a journey of experiencing almost all the functional way of writing code in JavaScript. And It will cover some of the new feature come with ECMAScript 6 like arrow function, pattern matching etc. Further more, I will list the implementations of some fancy typeclasses from Haskell in JavaScript.

If you're kind of:

Plz read Learn JavaScript first, but if you're just like:

this book may help you functional stuff at some point.

I chose Eweda as functional library for almost all examples.

Eweda is stick with more pure academic ideas but unpractical due to Javascript's poor handling of recursion. Here I just use it for example and show the functional idea, but if you want to use such api in production, please use Ramda.

Comment Why not Underscore Short story: no auto curry. Long story: checkout chapter 2.


In case I will write some code in ECMAScript 6 or (draft) standard, you better use firefox to run all those (who looks weird) examples. Simply tell what feature your browser has implement here). Anyway, most long example will be followed by a jsbin.


Thanks to @scott who translated all this into English.