This is a curated list of awesome π functional programming code and learning resources for JavaScript. As a multi-paradigm programming language, JavaScript can be written in many styles. With these resources we want to help you to make better use of JavaScriptβs support for writing programs in a functional way.
Functional programming is a π style of programming which models computations as the evaluation of expressions. Contrast this with imperative programming where programs are composed of statements which change global state when executed. Functional programming typically avoids using mutable state and favors side-effect free functions and immutable data instead. This encourages writing composable and declarative programs that are easy to reason about.
- Libraries
- Functional Languages that Compile to JavaScript
- Programming Tools
- Resources
- Community
- Contribution
These may be appended to entries. Each should be preceded by a "+" or "-" to indicate presence or absence of the tag's meaning. "-" tags should only be included when they are likely to help someone filter libraries for their needs. For instance, -TS
tags are probably useful for Typescript users screening for types, but -CT
tags would be less likely to be helpful to anyone.
- CT. Category Theory. This library appears to be inspired by Haskell, Scala, or another functional language's library with a grounding in Category Theory.
- TS. Typescript. This library has typescript types.
23809β
1434π΄
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. +TS.681β
86π΄
Ramda Adjunct) is a community-maintained extension of Ramda.167β
24π΄
Ramda-extension) is set of utility point-free functions composed only from Ramda functions.1653β
89π΄
Rambda) - A faster alternative to Ramda in under 10kB.221β
26π΄
Rambdax) - Extended version of Rambda- Folktale β A standard library for functional programming in JavaScript. Typescript support expected mid-2020. -TS.
?β
?π΄
lodash/fp) β An instance of59815β
7026π΄
Lodash) with its methods wrapped to produce immutable, auto-curried, iteratee-first, data-last methods. +TS.222β
14π΄
functional.js) β A lightweight functional JavaScript library that facilitates currying and point-free / tacit programming.1553β
75π΄
101) β A modern and modular JavaScript utility library made to work well with vanilla JavaScript methods. -TS16β
1π΄
fnuc) β A functional library for CoffeeScript (and JavaScript) to facilitate functional composition and higher order functions.105β
11π΄
barely-functional) β A tiny (2.7kb) functional programming library using native ES5/6 operations. -TS.44β
4π΄
bluebird-promisell) - A practical functional programming library for promises.- prelude.ls β A functionally oriented utility library somewhat based off of Haskell's Prelude module. -TS.
99β
5π΄
preludejs) - Hardcore Functional Programming for JavaScript. -TS.792β
57π΄
1-liners) β Functional tools that couldnβt be simpler. A dead simple functional utility belt, hand-crafted with love and attention. -TS.5β
2π΄
fn-curry) β A simple function to curry a function.85β
6π΄
curry) β Curry your functions using function bind syntax.57β
3π΄
compose-function) β Compose a new function from smaller functions.49β
0π΄
functionize) β A collection of functions which aid in making non-functional libraries functional.143β
11π΄
lambdajs) β The full ECMAScript API done a functional way.?β
?π΄
fp-dom) β Making the DOM functional.264β
57π΄
react-on-lambda) - Replace JSX in React with functions (currying, compositions and etc).36β
1π΄
trifl) β A functional user interface library with unidirectional dataflow and a virtual dom.247β
21π΄
funcy) β An experiment in adding functional pattern matching to JavaScript. Experimental π©121β
17π΄
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.1619β
116π΄
js-joda) β An immutable date and time library that provides a simple, domain-driven and clean API based on the ISO8601 calendar.41β
3π΄
_part_) β A micro library that encourages functional programming by making native methods available as partially applied functions.79β
4π΄
claire) β A property-based testing library for clearly specifying code invariants and behaviour.448β
25π΄
FPO.js) β FP library for JavaScript by Kyle Simpson (aka getify). Supports named-argument style methods.144β
11π΄
Javascript Parser Combinator) β Javascript parser combinator implementation inspired by the Haskell's Parsec373β
18π΄
fun-task) β An abstraction for managing asynchronous code in JS. Tasks are similar to Promises with the key difference that Tasks can represent a computation while Promises can represent only the results of a computation. Ships with Flow type definitions.3492β
206π΄
most) β Ultra-high performance reactive programming to help you compose asynchronous operations on streams of values and events without many of the hazards of side effects and mutable shared state.53β
1π΄
zen-signals) β β― The simplest signal library possible632β
25π΄
funfix) β Funfix is a library of type classes and data types for Functional Programming in JavaScript, TypeScript and Flow. +CT, +TS.71β
6π΄
pico-lambda) - Arrays, Strings and things the functional way. A 640b functional library based on native methods. -TS.?β
?π΄
pareto-js) - An extremely small, intuitive and fast functional utility library for JavaScript -TS.?β
?π΄
fpEs) - A small library provides simple usages of basic FP & pattern-matching/sumtype & MonadIO/Rx & Optional for Javascript. -TS.- Creed β Sophisticated and functionally-minded async with advanced features: coroutines, promises, ES2015 iterables, fantasy-land. -TS.
144β
19π΄
TGrid) - Grid Computing Framework, Network & Thread extension of601β
49π΄
TSTL), supporting RFC (Remote Function Call). +TS.516β
25π΄
Ferrum) β Iterator library with support for objects as iterables, lazy evaulation andpipe()
; implements Traits (from Rust)/Type Classes (from Haskell) in JS. -TS.- π fp-ts - Typed functional programming in TypeScript. +CT, +TS.
170β
24π΄
iter-tools) - a rich toolset for working with iterables, both sync and async. +TS.- π remeda A function library roughly subsetting Ramda, but written in Typescript and thus more type-friendly. +TS.
994β
68π΄
futil-js) - A collection of functional utilities that could conceivably be part of a library like lodash/fp, but for some reason or other are not.274β
15π΄
rubico) - π [a]synchronous functional syntax25β
0π΄
rocket-pipes) - Powerful pipes, that chain Promise and ADT like Maybe or Either from popular FP libraries. +TS137β
6π΄
omg-curry) - Comprehensive Curry Library with Operator Curry, Curry from functions, Decurry and Infifnite Curries.233β
1π΄
lfi) - A Lazy Functional Iteration Library Supporting Sync, Async, and Concurrent Iteration.4β
0π΄
ts-multimethod) - TypeScript multimethods inspired by Clojure multimethods. +TS4β
1π΄
ts-fp-di) - Tiny TypeScript functional dependency injection, based on Node.js AsyncLocalStorage. +TS7508β
237π΄
effect-ts) β A Fully-fledged functional effect system for typescript with a rich standard library. +TS73β
8π΄
qio) β A type-safe, functional, performant, lawful, composable data structure that solves practical problems of effect-full code in node and browser. +TS93β
8π΄
Ditox.js) - Powerful dependency injection container for building modular apps. +TS36β
2π΄
RxEffects) - Reactive state and effect management with RxJS. +TS925β
69π΄
fxts) - Lazy evaluation and concurrency. +TS- π ts-belt - Fast, modern, and practical utility library for FP in TypeScript. (Uses a data-first approach like remeda, but is π faster than remeda, ramda, rambda, and lodash/fp.)
?β
?π΄
fp-multik) - JS/TS lightweight value-multimethod util1013β
31π΄
true-myth) A library for safe, idiomatic null and error handling in TypeScript, withMaybe
andResult
types, supporting both a functional style and a more traditional method-call style12306β
129π΄
ts-pattern) - The exhaustive Pattern Matching library for TypeScript, with smart type inference. Pattern Matching is a code-branching technique coming from FP languages.56β
2π΄
hyogwa) - Natural πΏ effect system that fits TypeScript; Write codes as you write plain typescript code.302β
4π΄
Verticalize) - Super lightweight function that looks and behaves like a pipe operator.37β
3π΄
PureEval) - A powerful JavaScript functional programming toolset, including utility functions and abstract data structures.2β
0π΄
context-fp) - Microscopic functional programming context aka dependency injection. +TS
Write performant functional code by using the right data structures for the task.
421β
27π΄
Icepick) Utilities for treating frozen JavaScript objects as persistent immutable collections32947β
1785π΄
Immutable.js) β Immutable persistent data collections.27690β
849π΄
Immer) β Immer is a tiny package for immutable state based on copy-on-write mechanism. +TS.3387β
148π΄
Mori) β ClojureScriptβs persistent data structures and supporting API from the comfort of vanilla JavaScript.3153β
115π΄
Baobab) β persistent and optionally immutable data tree with cursors.16β
0π΄
immutable-sequence.js) β High performance implementation of Immutable Sequence in JavaScript, based on45β
4π΄
Finger Trees).- Timm β Immutability helpers with fast reads and acceptable writes.
6009β
268π΄
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.515β
23π΄
DerivableJS) β Functional Reactive State for JavaScript and TypeScript. DerivableJS enables you to make elegant declarative statements about how your bits of state are related. +TS.103β
3π΄
imlazy) β Library for creating and manipulating lazy iterables using the ES2015 iteration protocols.273β
14π΄
collectable) β Super high-performance immutable data structures for modern JavaScript and TypeScript applications. +TS.1652β
51π΄
List) - An extremely fast immutable list with a comprehensive functional API. Designed to1652β
51π΄
seamlessly integrate with Ramda).377β
21π΄
prelude.ts) - Immutable persistent collections, functional constructs such as Option and Either, and combinators. Implemented in Typescript but supports javascript too. +CT, +TS.601β
49π΄
TSTL) - C++ STL (Standard Template Library) is implemented in TypeScript. STL Containers, iterators, algorithms and functors, that following functional programming rule, are provided. +TS.
Use the laws of math instead of always reinventing your own thing. Algebraic!
10116β
374π΄
Fantasy Land) β Not a library, but a specification of the Monad laws for libraries to follow.770β
41π΄
Static Land) β Specification similar to Fantasy Land but based on static methods rather than instance methods.490β
19π΄
immutable-ext) β FantasyLand extensions for32947β
1785π΄
Immutable.js).700β
29π΄
daggy) β Library for creating tagged constructors.3041β
94π΄
Sanctuary) β Sanctuary makes it possible to write safe code without null checks. +CT, +TS.- monet.js β A library that assists functional programming by providing a rich set of Monads and other useful functions. +CT, +TS.
477β
28π΄
union-type) β A small JavaScript library for defining and using union types.175β
15π΄
freeky) β A collection of Free monads.2483β
84π΄
Fluture) β A Future library with included control utilities, high performance and great error messages.66β
6π΄
fantasy-combinators) β Common combinators.90β
8π΄
fantasy-birds) β Port of the Haskell package Data.Aviary.Birds. Everything for your combinatory needs.1591β
102π΄
crocks) β A collection of popular Algebraic Data Types with the main goal to curate and provide not only a common interface between each type, but also all of the helper functions needed to hit the ground running. -TS.23β
1π΄
kudo-js) - A small utility library with a set of Algebraic Data Types and Helper functions to help you write code in a functional programming style in Javascript1527β
59π΄
purify) - Functional programming library for TypeScript focusing on ADTs. +CT, +TS.149β
14π΄
MojiScript)- an async-first, opinionated, and functional language designed to have 100% compatibility with JavaScript engines466β
19π΄
Pratica) - Small, simple, easy FP data types for pragmatic and productive developers who need to ship reliable code fast. +CT, +TS.?β
?π΄
Tifi) - Tifi is a library for functional programming in TypeScript. It solves a problem of the existence of bothundefined
andnull
. Tifi is inspired by the OCaml/Reason utilities for the option data type. +CT, +TS.345β
22π΄
sweet-monads) - A collection of popular monads (such asEither
andMaybe
) and the lazy iterator.
213β
13π΄
lenses) β Composable2032β
273π΄
kmett) style lenses.86β
4π΄
optics) β Profunctor optics (Lens, Prism, iso).183β
15π΄
ramda-lens) β π π Lens library built on Ramda.108β
8π΄
fantasy-lenses) β Composable, immutable getters and setters. (Profunctor lenses WIP)177β
4π΄
nanoscope) β Lenses with dotty support.915β
36π΄
partial.lenses) β Partial lenses is a comprehensive, high-performance optics library for JavaScript.413β
14π΄
shades) β A lodash-inspired lens-like library for Javascript.
9235β
789π΄
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.
- Fable - Compiles F# to readable JavaScript.
- PureScript β A small strongly typed programming language that compiles to JavaScript.
- Idris β A general purpose pure functional programming language with dependent types.
2607β
188π΄
GHCJS) β π Haskell to JavaScript compiler, based on GHC.1564β
67π΄
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.
- π Reason β Reason is a new interface to OCaml, a highly expressive dialect of the ML language featuring type inference and static type checking.
- π ReScript β (previously known as π Bucklescript) ReScript is a type-safe language that compiles to the highest quality of clean, readable and performant JavaScript code.
- 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.
323β
37π΄
Quack) - A multi-paradigm programming language with gradual and duck typing that targets PHP and JS.80β
3π΄
ion) - no BS JS133β
5π΄
RamdaScript) - A Lisp that compiles to opinionated JavaScript on top of RamdaJS13β
2π΄
RacketScript) β RacketScript aims to leverage both JavaScript and Racket's ecosystem, and make interoperability between them clean and smooth.- π Koka β Koka is a function-oriented programming language that seperates pure values from side-effecting computations with a familiar JavaScript like syntax.
- π TypeScript - TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
- π Gleam - Gleam is a typed, functional language that compiles to Erlang and JavaScript.
970β
35π΄
eslint-plugin-fp) - ESLint rules for functional programming21β
0π΄
4.5) β A functional assertions library. If you prefer functional style APIs and practices in JavaScript, this library aims to solve this with functionally-oriented assertions that are lazy and monadic.198β
11π΄
hm-def) β Runtime type checking for JS with Hindley Milner signatures.44β
1π΄
ftor) - A pluggable runtime type checker and functional debugging tool that supports parametric and row polymorphism, implicit rank-2 types and algebraic data types via Scott Encoding.
23407β
1866π΄
Professor Frisbyβs Mostly Adequate Guide to Functional Programming) β This is a book on the functional paradigm in general using the worldβs most popular functional programming language: JavaScript. Itβs a practical introduction that builds up intuition through real-world examples. Strongly recommended. By π Brian Lonsdorf (2016)16641β
1957π΄
Functional-Light JavaScript) β This book explores the core principles of functional programming (FP) that can be applied to JavaScript. But what makes this book different is that it approaches these principles without all the heavy terminology.- π JavaScript AllongΓ©, the βSixβ edition. Starts with as little as possible about functions β but no less! β and builds up towards powerful combinators and decorators. A foundational book. By Reginald Braithwaite (2016)
- π Functional Programming in JavaScript teaches JavaScript developers functional techniques that will improve extensibility, modularity, reusability, testability, and performance. Through concrete examples and jargon-free explanations, this book teaches you how to apply functional programming to real-life development tasks. By Luis Atencio (2016)
- Eloquent JavaScript. A modern introduction to programming using JavaScript. By Marijn Haverbeke (2014)
- Functional JavaScript teaches how to create code thatβs beautiful, safe, and simple to understand and test by using JavaScriptβs functional programming support. By Michael Fogus (2013)
- π Grokking Simplicity teaches functional programming from first principles. It uses JavaScript for all code examples and it uses real-world scenarios. By Eric Normand (2019)
384β
21π΄
scriptum) - a no-frills functional programming library and a online course based on it
- π FP Concepts in JavaScript β An introduction to Functional Programming Concepts in JavaScript. Uses the Ramda library to teach the concepts of composition, pointfree style, and functors through the simplest of examples.
- Functional programming with JavaScript β Another introduction to Functional Programming in JavaScript with a focus on three key themes: computation as the application of functions, statelessness, avoiding side effects.
- A gentle introduction to functional JavaScript β A four-part series introduction functional programming in JavaScript that gets you up to speed what all the hype about functional programming is all about.
- π Functors from first principle - explained with JS - Explaining functors concept using JavaScript.
- π Why Curry Helps β A short overview of how to write reusable and declarative code using currying.
- Favoring Curry - Practical applications of currying using Ramda.
- Functional Mumbo Jumbo β ADTs β A beginner-friendly introduction to Algebraic Data Types.
- π JavaScript and Type Thinking β Learn to reason about your JavaScript code with type thinking. Algebraic Data Types are introduced as a conceptual basis to reason about program entities.
- π Lazy, composable, and modular JavaScript β Use four new features of ES6 β iterables, generators, fat arrows, and for-of β in conjunction with higher-order functions, function composition, and lazy evaluation, to write cleaner and more modular JavaScript.
- Why Ramda β To those not used to functional programming, Ramda seems to serve no purpose whatsoever. However, it does offer a different style of coding, a style thatβs taken for granted in purely functional programming languages: Ramda makes it simple for you to build complex logic through functional composition.
- π Monads in JavaScript β An introduction to the Monad design pattern in JavaScript.
- A Monad in Practicality: First-Class Failures β A walk through some practical use cases for specific monadic structures in JavaScript: use the
Maybe
monad to handle simple failure cases and model more complex scenarios with theEither
monad or theValidation
applicative functor. - π Functional programming β Many articles on various aspects of functional programming in JavaScript by Gleb Bahmutov.
18606β
1016π΄
Functional Programming Jargon) β Jargon from the functional programming world explained in JavaScript.- Data Structures in JavaScript β A series of blog posts that reimplements various data structures in JavaScript to better understand their benefits and downsides.
- π So You Want to be a Functional Programmer - Easy to understand, with some examples, introduction to Functional Programming in Javascript and Elm.
- π Functional Programming for JavaScript People - A complete introduction to functional programming patterns by Chet Corcos with a lot of javascript examples.
- π Introduction to Immutable.js and Functional Programming Concepts - Learn about functional data structures and their uses in this overview of Facebook's popular library for JavaScript: Immutable.js.
- π Master the JavaScript Interview: What is Functional Programming? - A simple introduction by @ericelliott to functional principles and vocabulary.
- π Composing Software - A series of articles on learning functional programming and compositional software techniques in JavaScript ES6+ from the ground up by @ericelliott.
- π Anonymous Recursion in JavaScript - Short and easy to understand article about implementing anonymous recursion in JavaScript.
- π Functional Composition in Javascript β Step by step explanation of how to compose functions in javascript.
- π Functional Programming Principles in Javascript - Practical code examples to learn functional programming concepts like pure function, immutability, first-class entities, and higher order functions
- π Basic Monads in Javascript - Introduction to 2 easy monads in Javascript, Maybe & Either.
- π F# for JavaScript Devs - Showcasing the similarities between F# and JavaScript
- π A practical guide to writing more functional Javascript - A step by step guide to convert imperative JavaScript to more declarative, functional JavaScript.
1072β
53π΄
You don't (may not) need loops βΏ) - Loops are one of the first constructs that junior programmers learn, but they can pose many potential issues in the software development process, and could be avoided in many cases.
- π Classroom Coding with Prof. Frisby β A series that builds a βpracticalβ web application with React and functional programming in JavaScript.
- π Hey Underscore, You're Doing It Wrong! β Underscore.js claims to be a functional programming library, but is it really?
- π Functional programming patterns for the non-mathematician β Learn about practical use cases for functors, applicatives, and monads.
- π Pure JavaScript β Christian Johansen will show you how you can significantly up your game by leaving loops behind and embracing functions as the primary unit of abstraction.
- π Functional programming in JavaScript - A series by Mattias Petter Johansson, from the youtube channel FunFunFunction, that is specifically about popularization of functional programming in JavaScript.
- π Functional Programming in TypeScript - Discover functional programming with Typescript and create a library like fp-ts alongside Sahand Javid in this beginner-friendly YouTube playlist.
- π Anjana Vakil: Learning Functional Programming with JavaScript - JSUnconf 2016 - A simple and understandable introduction of functional proramming in javascript.
- π Functional Programming Basics In ES6 - A complete introduction to functional programming in javascript made it easy by ES6.
- π JavaScript Programmers Should Learn Algebraic Data Types -- May 2018 -- UtahJS Lehi - Seth House explains how ADTs (Algebraic Data Types) can be useful to JavaScript developers.
94β
17π΄
FPJS-Class) β Functional Programming learned through JavaScript.2054β
438π΄
functional-javascript-workshop) β The goal of this workshop is to create realistic problems that can be solved using terse, vanilla, idiomatic JavaScript to teach fundamental functional programming features of JavaScript.1443β
87π΄
functional-frontend-architecture) β A functional frontend framework. Based on Ramda + union-type-js + Flyd + Snabbdom2003β
84π΄
cube-composer) β A puzzle game inspired by functional programming.57β
7π΄
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)
258β
25π΄
Escape from Callback Mountain) - Design & refactoring tips for Promise-based Functional JavaScript. Key benefits include better readability, testability, and reusability. MIT.- Learn Rx β A series of interactive exercises introducing five basic ingredients of functional (reactive) programming: the
map
,filter
,concatAll
,reduce
, andzip
functions. ?β
?π΄
Holdem Evaluator) - Yet another Holdem Evaluator with Ramda functional style
287β
12π΄
Awesome FRP JS) β A curated list of awesome (functional) reactive programming stuff in JavaScript.961β
64π΄
lucasviola/Awesome Functional Programming) β Awesome resources on functional programming theory and learning materials.3459β
305π΄
xgrommx/Awesome Functional Programming) β A ton of articles on functional programming, as well as a huge list of functional libraries for many programming languages.305β
32π΄
Functional Programming Resources In JavaScript)989β
84π΄
tk-learning-center/Functional Programming Learning Path) - A Learning Path for Functional Programming
- π Functional Programming Slack channel β Community with a friendly channel for JavaScript as well as many other channels about functional programming in general.
β Suggestions and PRs are welcome! β
Please read the contribution guidelines to get started.
To the extent possible under law, Christoph Hermann has waived all copyright and related or neighboring rights to this work.
5982β
396π΄
stoeffel/awesome-fp-js)