Tôi là Duyệt

Awesome functional programming in JavaScript

A curated list of awesome functional programming in JavaScript. Origin here, suggestions and PRs are welcome.

Table of Contents


  • Ramda – A practical functional library for JavaScript that is designed specifically for a functional programming style. A style that makes it easy to create functional pipelines and never mutates user data.
  • Folktale – Folktale is a suite of libraries for generic functional programming that allows you to write elegant modular applications with fewer bugs and more reuse.
  • lodash/fp – An instance of Lodash with its methods wrapped to produce immutable, auto-curried, iteratee-first, data-last methods.
  • functional.js – A lightweight functional JavaScript library that facilitates currying and point-free / tacit programming.
  • 101 – A modern and modular JavaScript utility library made to work well with vanilla JavaScript methods.
  • fnuc – A functional library for CoffeeScript (and JavaScript) to facilitate functional composition and higher order functions.
  • barely-functional – A tiny (2.7kb) functional programming library using native ES5/6 operations.
  • prelude.ls – A functionally oriented utility library somewhat based off of Haskell’s Prelude module.
  • allong.es – A collection of functions to facilitate writing JavaScript with functions as first-class values, designed to complement libraries like Underscore, not compete with them.
  • 1-liners – Functional tools that couldn’t be simpler. A dead simple functional utility belt, hand-crafted with love and attention.
  • fn-curry – A simple function to curry a function.
  • curry – Curry your functions using function bind syntax.
  • compose-function – Compose a new function from smaller functions.
  • functionize – A collection of functions which aid in making non-functional libraries functional.
  • lambdajs – The full ECMAScript API done a functional way.
  • fp-dom – Making the DOM functional.
  • trifl – A functional user interface library with unidirectional dataflow and a virtual dom.
  • funcy – An experiment in adding functional pattern matching to JavaScript. Experimental
  • date-fp – A functional utility library for working with JavaScript dates. All functions in date-fp are pure, autocurried and will not mutate the date objects they are applied to.
  • part – A micro library that encourages functional programming by making native methods available as partially applied functions.
  • claire – A property-based testing library for clearly specifying code invariants and behaviour.

https://blog.duyet.net/2016/04/awesome-functional-programming-in-javascript.html#data-structuresData Structures

Write performant functional code by using the right data structures for the task.

  • Immutable.js – Immutable persistent data collections.
  • Mori – ClojureScript’s persistent data structures and supporting API from the comfort of vanilla JavaScript.
  • immutable-sequence.js – High performance implementation of Immutable Sequence in JavaScript, based on Finger Trees.
  • Timm – Immutability helpers with fast reads and acceptable writes.
  • Lazy.js – A utility library with a lazy engine under the hood that strives to do as little work as possible while being as flexible as possible.

https://blog.duyet.net/2016/04/awesome-functional-programming-in-javascript.html#algebraic-data-typesAlgebraic Data Types

Use the laws of math instead of always reinventing your own thing. Algebraic!

  • FantasyLand – Not a library, but a specification of the Monad laws for libraries to follow.
  • daggy – Library for creating tagged constructors.
  • Sanctuary – Sanctuary makes it possible to write safe code without null checks.
  • ramda-fantasy – Fantasy-Land compatible types for easy integration with Ramda.js.
  • monet.js – A library that assists functional programming by providing a rich set of Monads and other useful functions.
  • union-type – A small JavaScript library for defining and using union types.
  • freeky – A collection of Free monads.
  • Fluture – A Future library with included control utilities, high performance and great error messages.
  • fantasy-combinators – Common combinators.
  • fantasy-birds – Port of the Haskell package Data.Aviary.Birds. Everything for your combinatory needs.


  • lenses – Composable kmett style lenses.
  • optics – Profunctor optics (Lens, Prism, iso).
  • ramda-lens
    Lens library built on Ramda.
  • fantasy-lenses – Composable, immutable getters and setters. (Profunctor lenses WIP)
  • nanoscope – Lenses with dotty support.
  • partial.lenses – Ramda compatible partial lenses. View, insert and update optional data.

https://blog.duyet.net/2016/04/awesome-functional-programming-in-javascript.html#functional-languages-that-compile-to-javascriptFunctional Languages that Compile to JavaScript

  • ClojureScript – Compiles Clojure, a hosted Lisp with immutable persistent data structures, to JavaScript.
  • Elm – A type-safe functional programming language for declaratively creating web browser-based graphical user interfaces. Implemented in Haskell.
  • PureScript – A small strongly typed programming language that compiles to JavaScript.
  • Idris – A general purpose pure functional programming language with dependent types.
  • GHCJSHaskell to JavaScript compiler, based on GHC.
  • ElixirScript – Compiles a subset of Elixir, a dynamic, functional language designed for building scalable and maintainable applications, to JavaScript.
  • Js_of_ocaml – Compiles OCaml bytecode to JavaScript, making it possible to run OCaml programs in the browser.
  • Scala.js – Compiles Scala to JavaScript.
  • LiveScript – LiveScript has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate.





https://blog.duyet.net/2016/04/awesome-functional-programming-in-javascript.html#examples-and-exercisesExamples and Exercises

  • FPJS-Class – Functional Programming learned through JS
  • functional-javascript-workshop – Teaching fundamental functional programming features of JavaScript
  • functional-frontend-architecture – A functional frontend framework. Based on Ramda + union-type-js + Flyd + Snabbdom
  • cube-composer – A puzzle game inspired by functional programming.
  • FP Youtube Search – YouTube search app with ReactJS, Redux, and FP concepts
  • Hardcore Functional Programming in JavaScript – Learn to apply techniques from the forefront of computer science research to solve practical problems in Javascript. Discover functional programming and see it demonstrated step-by-step with how to build an example web app using abstract interfaces like Monads, Functors, Monoids and Applicatives. (commercial)