Ranked awesome lists, all in one place
This list is a copy of stoeffel/awesome-fp-js with ranks
Awesome FP JS ★87749
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.
Table of Contents
- Libraries
- Functional Languages that Compile to JavaScript
- Programming Tools
- Resources
- Community
- Contribution
Libraries
- Ramda ★12750 – 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.
- Ramda Adjunct ★200 is a community-maintained extension of Ramda.
- Ramda-extension ★51 is set of utility point-free functions composed only from Ramda functions.
- Folktale – A standard library for functional programming in JavaScript.
- lodash/fp – An instance of Lodash ★32853 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 ★1514 – A modern and modular JavaScript utility library made to work well with vanilla JavaScript methods.
- fnuc ★14 ⏳2Y – A functional library for CoffeeScript (and JavaScript) to facilitate functional composition and higher order functions.
- barely-functional ★70 – A tiny (2.7kb) functional programming library using native ES5/6 operations.
- bluebird-promisell ★45 - A practical functional programming library for promises.
- prelude.ls – A functionally oriented utility library somewhat based off of Haskell’s Prelude module.
- preludejs ★63 ⏳1Y - Hardcore Functional Programming for JavaScript.
- 1-liners ★546 – Functional tools that couldn’t be simpler. A dead simple functional utility belt, hand-crafted with love and attention.
- fn-curry ★5 ⏳4Y – A simple function to curry a function.
- curry ★73 ⏳1Y – Curry your functions using function bind syntax.
- compose-function ★35 ⏳1Y – Compose a new function from smaller functions.
- functionize ★43 ⏳3Y – A collection of functions which aid in making non-functional libraries functional.
- lambdajs ★131 ⏳4Y – The full ECMAScript API done a functional way.
- fp-dom – Making the DOM functional.
- trifl ★35 ⏳1Y – A functional user interface library with unidirectional dataflow and a virtual dom.
- funcy ★227 – An experiment in adding functional pattern matching to JavaScript. Experimental
- date-fp ★104 – 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.
- js-joda ★913 – An immutable date and time library that provides a simple, domain-driven and clean API based on the ISO8601 calendar.
- _part_ ★45 ⏳4Y – 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.
- FPO.js ★323 – FP library for JavaScript by Kyle Simpson (aka getify). Supports named-argument style methods.
- Javascript Parser Combinator – Javascript parser combinator implementation inspired by the Haskell’s Parsec
- fun-task ★320 – 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.
- most ★2777 – 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.
- zen-signals ★12 ⏳1Y – ☯ The simplest signal library possible
- funfix ★409 – Funfix is a library of type classes and data types for Functional Programming in JavaScript, TypeScript and Flow.
- pico-lambda ★54 - Arrays, Strings and things the functional way. A 640b functional library based on native methods.
- pareto-js ★192 ⏳1Y - An extremely small, intuitive and fast functional utility library for JavaScript
Data Structures
Write performant functional code by using the right data structures for the task.
- Icepick ★351 Utilities for treating frozen JavaScript objects as persistent immutable collections
- Immutable.js ★24085 – Immutable persistent data collections.
- Mori ★2962 ⏳1Y – ClojureScript’s persistent data structures and supporting API from the comfort of vanilla JavaScript.
- Baobab ★2853 – persistent and optionally immutable data tree with cursors.
- immutable-sequence.js – High performance implementation of Immutable Sequence in JavaScript, based on Finger Trees ★39 ⏳1Y.
- Timm – Immutability helpers with fast reads and acceptable writes.
- Lazy.js ★4983 – 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.
- DerivableJS ★479 – Functional Reactive State for JavaScript and TypeScript. DerivableJS enables you to make elegant declarative statements about how your bits of state are related.
- imlazy ★66 – Library for creating and manipulating lazy iterables using the ES2015 iteration protocols.
- collectable ★160 – Super high-performance immutable data structures for modern JavaScript and TypeScript applications.
- List ★1095 - An extremely fast immutable list with a comprehensive functional API.
- prelude.ts ★102 - Immutable persistent collections, functional constructs such as Option and Either, and combinators. Implemented in Typescript but supports javascript too.
Algebraic Data Types
Use the laws of math instead of always reinventing your own thing. Algebraic!
- Fantasy Land ★5620 – Not a library, but a specification of the Monad laws for libraries to follow.
- Static Land ★456 – Specification similar to Fantasy Land but based on static methods rather than instance methods.
- immutable-ext – FantasyLand extensions for Immutable.js ★24085.
- daggy – Library for creating tagged constructors.
- Sanctuary – Sanctuary makes it possible to write safe code without null checks.
- monet.js – A library that assists functional programming by providing a rich set of Monads and other useful functions.
- union-type ★400 – A small JavaScript library for defining and using union types.
- freeky ★125 – A collection of Free monads.
- Fluture – A Future library with included control utilities, high performance and great error messages.
- fantasy-combinators ★57 ⏳2Y – Common combinators.
- fantasy-birds ★56 ⏳1Y – Port of the Haskell package Data.Aviary.Birds. Everything for your combinatory needs.
- crocks ★564 – 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.
- 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 Javascript
Lenses
- lenses – Composable kmett ★1332 style lenses.
- optics ★74 ⏳2Y – Profunctor optics (Lens, Prism, iso).
- ramda-lens ★152 ⏳1Y – Lens library built on Ramda.
- fantasy-lenses ★105 ⏳2Y – Composable, immutable getters and setters. (Profunctor lenses WIP)
- nanoscope ★160 ⏳1Y – Lenses with dotty support.
- partial.lenses ★539 – Partial lenses is a comprehensive, high-performance optics library for JavaScript.
Functional Languages that Compile to JavaScript
- ClojureScript ★7695 – 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.
- GHCJS ★1965 – Haskell 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.
- BuckleScript – JavaScript backend for the OCaml compiler.
- Reason – Reason is a new interface to OCaml, a highly expressive dialect of the ML language featuring type inference and static type checking.
- 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.
- Quack ★271 - A multi-paradigm programming language with gradual and duck typing that targets PHP and JS.
- ion ★47 - no BS JS
- RamdaScript ★92 - A Lisp that compiles to opinionated JavaScript on top of RamdaJS
Programming Tools
- eslint-plugin-fp ★466 - ESLint rules for functional programming
- eslint-config-cleanjs ★1138 - An eslint config which reduces JS to a pure functional language
- 4.5 ★16 ⏳1Y – 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.
- hm-def ★73 – Runtime type checking for JS with Hindley Milner signatures.
- ftor ★32 - 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.
Resources
Books
- 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)
- Functional-Light JavaScript ★8569 – 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)
Articles
- 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.
- 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.
- Functional Programming Jargon ★11978 – 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.
Videos
- 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.
- 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.
Examples and Exercises
- FPJS-Class ★81 ⏳2Y – Functional Programming learned through JavaScript.
- functional-javascript-workshop ★1687 – 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.
- functional-frontend-architecture ★1156 – A functional frontend framework. Based on Ramda + union-type-js + Flyd + Snabbdom
- cube-composer ★1265 – A puzzle game inspired by functional programming.
- FP Youtube Search ★40 ⏳1Y – 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)
- Escape from Callback Mountain ★209 - Design & refactoring tips for Promise-based Functional JavaScript. Key benefits include better readability, testability, and reusability. MIT.
- Functional Programming for Beginners – Dozens of exercises with solutions and explanations.
-
Learn Rx – A series of interactive exercises introducing five basic ingredients of functional (reactive) programming: the
map
,filter
,concatAll
,reduce
, andzip
functions.
Community
Related Lists
- Awesome FRP JS ★191 – A curated list of awesome (functional) reactive programming stuff in JavaScript.
- lucasviola/Awesome Functional Programming ★386 – Awesome resources on functional programming theory and learning materials.
- xgrommx/Awesome Functional Programming ★1807 – A ton of articles on functional programming, as well as a huge list of functional libraries for many programming languages.
- Functional Programming Resources In JavaScript ★237
Talk
- Functional Programming Slack channel – Community with a friendly channel for JavaScript as well as many other channels about functional programming in general.
Contribution
Suggestions and PRs are welcome!
Please read the contribution guidelines to get started.
License
To the extent possible under law, Christoph Hermann has waived all copyright and related or neighboring rights to this work.
This list is a copy of stoeffel/awesome-fp-js with ranks