• Stars
    star
    5,918
  • Rank 6,515 (Top 0.2 %)
  • Language
  • Created almost 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ˜Ž A curated list of awesome functional programming stuff in js

Awesome FP JS Awesome

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
Tags

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.

Libraries

  • 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.
  • Ramda Adjunct is a community-maintained extension of Ramda.
  • Ramda-extension is set of utility point-free functions composed only from Ramda functions.
  • Rambda - A faster alternative to Ramda in under 10kB.
  • Rambdax - Extended version of Rambda
  • Folktale โ€“ A standard library for functional programming in JavaScript. Typescript support expected mid-2020. -TS.
  • lodash/fp โ€“ An instance of Lodash with its methods wrapped to produce immutable, auto-curried, iteratee-first, data-last methods. +TS.
  • 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. -TS
  • 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. -TS.
  • 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.
  • preludejs - Hardcore Functional Programming for JavaScript. -TS.
  • 1-liners โ€“ Functional tools that couldnโ€™t be simpler. A dead simple functional utility belt, hand-crafted with love and attention. -TS.
  • 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.
  • react-on-lambda - Replace JSX in React with functions (currying, compositions and etc).
  • 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.
  • js-joda โ€“ An immutable date and time library that provides a simple, domain-driven and clean API based on the ISO8601 calendar.
  • _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.
  • FPO.js โ€“ 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 โ€“ 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 โ€“ 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 โ€“ โ˜ฏ The simplest signal library possible
  • funfix โ€“ Funfix is a library of type classes and data types for Functional Programming in JavaScript, TypeScript and Flow. +CT, +TS.
  • 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.
  • TGrid - Grid Computing Framework, Network & Thread extension of TSTL, supporting RFC (Remote Function Call). +TS.
  • 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.
  • 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.
  • 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.
  • rubico - ๐Ÿž [a]synchronous functional syntax
  • rocket-pipes - Powerful pipes, that chain Promise and ADT like Maybe or Either from popular FP libraries. +TS
  • omg-curry - Comprehensive Curry Library with Operator Curry, Curry from functions, Decurry and Infifnite Curries.
  • lfi - A Lazy Functional Iteration Library Supporting Sync, Async, and Concurrent Iteration.
  • ts-multimethod - TypeScript multimethods inspired by Clojure multimethods. +TS
  • ts-fp-di - Tiny TypeScript functional dependency injection, based on Node.js AsyncLocalStorage. +TS
  • effect-ts โ€“ A Fully-fledged functional effect system for typescript with a rich standard library. +TS
  • qio โ€“ A type-safe, functional, performant, lawful, composable data structure that solves practical problems of effect-full code in node and browser. +TS
  • Ditox.js - Powerful dependency injection container for building modular apps. +TS
  • RxEffects - Reactive state and effect management with RxJS. +TS
  • 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 util
  • true-myth A library for safe, idiomatic null and error handling in TypeScript, with Maybe and Result types, supporting both a functional style and a more traditional method-call style
  • ts-pattern - The exhaustive Pattern Matching library for TypeScript, with smart type inference. Pattern Matching is a code-branching technique coming from FP languages.

Data Structures

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

  • Icepick Utilities for treating frozen JavaScript objects as persistent immutable collections
  • Immutable.js โ€“ Immutable persistent data collections.
  • Immer โ€“ Immer is a tiny package for immutable state based on copy-on-write mechanism. +TS.
  • Mori โ€“ ClojureScriptโ€™s persistent data structures and supporting API from the comfort of vanilla JavaScript.
  • Baobab โ€“ persistent and optionally immutable data tree with cursors.
  • 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.
  • 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.
  • imlazy โ€“ Library for creating and manipulating lazy iterables using the ES2015 iteration protocols.
  • collectable โ€“ Super high-performance immutable data structures for modern JavaScript and TypeScript applications. +TS.
  • List - An extremely fast immutable list with a comprehensive functional API. Designed to seamlessly integrate with Ramda.
  • prelude.ts - Immutable persistent collections, functional constructs such as Option and Either, and combinators. Implemented in Typescript but supports javascript too. +CT, +TS.
  • TSTL - C++ STL (Standard Template Library) is implemented in TypeScript. STL Containers, iterators, algorithms and functors, that following functional programming rule, are provided. +TS.

Algebraic Data Types

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

  • Fantasy Land โ€“ Not a library, but a specification of the Monad laws for libraries to follow.
  • Static Land โ€“ Specification similar to Fantasy Land but based on static methods rather than instance methods.
  • immutable-ext โ€“ FantasyLand extensions for Immutable.js.
  • daggy โ€“ Library for creating tagged constructors.
  • 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.
  • 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.
  • 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.
  • 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
  • purify - Functional programming library for TypeScript focusing on ADTs. +CT, +TS.
  • MojiScript- an async-first, opinionated, and functional language designed to have 100% compatibility with JavaScript engines
  • 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 both undefined and null. Tifi is inspired by the OCaml/Reason utilities for the option data type. +CT, +TS.

Lenses

  • 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 โ€“ Partial lenses is a comprehensive, high-performance optics library for JavaScript.
  • shades โ€“ A lodash-inspired lens-like library for Javascript.

Functional 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.
  • 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 โ€“ 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.
  • 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.
  • Quack - A multi-paradigm programming language with gradual and duck typing that targets PHP and JS.
  • ion - no BS JS
  • RamdaScript - A Lisp that compiles to opinionated JavaScript on top of RamdaJS
  • 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.

Programming Tools

  • eslint-plugin-fp - ESLint rules for functional programming
  • 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.
  • hm-def โ€“ Runtime type checking for JS with Hindley Milner signatures.
  • 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.

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 โ€“ 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)
  • scriptum - a no-frills functional programming library and a online course based on it

Articles

Videos

Examples and Exercises

  • FPJS-Class โ€“ Functional Programming learned through JavaScript.
  • 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.
  • 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)
  • Escape from Callback Mountain - 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, and zip functions.
  • Holdem Evaluator - Yet another Holdem Evaluator with Ramda functional style

Community

Related Lists

Talk

Contribution

โญ Suggestions and PRs are welcome! โญ

Please read the contribution guidelines to get started.

License

CC0

To the extent possible under law, Christoph Hermann has waived all copyright and related or neighboring rights to this work.

More Repositories

1

awesome-frp-js

A curated list of awesome functional reactive programming stuff in js
286
star
2

material-iterm

๐Ÿ’ป Light & dark material theme for iterm2
238
star
3

react-motion-drawer

Drawer built with react-motion
JavaScript
221
star
4

react-cond

Lisp-Style conditional rendering in react.
JavaScript
178
star
5

elm-verify-examples

Elm
166
star
6

redux-elm-middleware

Elm middleware for redux
JavaScript
149
star
7

awesome-ama-answers

A curated list of awesome AMA answers
127
star
8

redux-io

FSA-compliant io monad middleware for redux
JavaScript
66
star
9

compose-function

Function composition
JavaScript
57
star
10

redux-future

FSA-compliant future monad middleware for redux
JavaScript
53
star
11

.dotfiles

๐Ÿก
Vim Script
50
star
12

babel-plugin-array-includes

Replaces `arr.includes(val)' with `arr.indexOf(val) >= 0`.
JavaScript
44
star
13

react-mini

Create minimalistic react components
JavaScript
37
star
14

elm-verify

Elm
35
star
15

redux-saga-test

Helper for testing redux-saga
JavaScript
27
star
16

gulp-param

Add params to your tasks
JavaScript
26
star
17

elmi-to-json

Haskell
25
star
18

redux-either

FSA-compliant either monad middleware for redux
JavaScript
23
star
19

react-form-hoc

Higher order component for react forms
JavaScript
22
star
20

gh-contributors-table

๐Ÿ™‡ Say "arigatล" to your contributors
JavaScript
21
star
21

recompose-examples

WIP Examples with recompose
JavaScript
20
star
22

mergesort

O(n log n)
JavaScript
20
star
23

underscore.string.fp

This is a wrapper for underscore.string to use it as a FP-library or with Ramda/lodash-fp
JavaScript
20
star
24

react-material-card

A material design card for react
JavaScript
18
star
25

elm-online

Subscribe to online/offline events ๐Ÿ“ถ
Elm
12
star
26

haskell-simple-dsl-examples

Simple examples on how to implement a DSL in Haskell.
Haskell
11
star
27

tasty-test-reporter

An ingredient for tasty that prints a summary and outputs junit xml that works with jenkins.
Haskell
11
star
28

elm-interface-to-json

Haskell
9
star
29

inquander

Inquirer for commander. If no arguments and options are passed to your commander app, it runs inquirer.
JavaScript
8
star
30

pm2-interactive-ui

๐Ÿšฅ interactive cli for pm2
JavaScript
7
star
31

partition-all

Clojure's partition-all in js
JavaScript
7
star
32

extjs5-the-missing-components

This package adds missing components to extjs5.
JavaScript
7
star
33

nix-test-runner

Test runner for nix expressions
Rust
6
star
34

react-mini-this

React components as pure functions with function bind syntax
JavaScript
6
star
35

debug-view

Elm
6
star
36

arityN

Wraps a function with a function of a sertain arity.
JavaScript
5
star
37

grulp

:neckbeard: Never have to worry again if the project is using grunt or gulp. Just use grulp
JavaScript
5
star
38

elm-reflection

Haskell
5
star
39

editable

Elm
5
star
40

radioactive-react-example

Simple example with react and radioactive
JavaScript
5
star
41

create-constants

Create constants
JavaScript
5
star
42

bind-it

DEPRECATED: use stoeffel/bind-first and stoeffel/bind-last
JavaScript
4
star
43

ext.promise

promise for extjs
JavaScript
4
star
44

valid-sift

Check if it's a valid sift filter
JavaScript
3
star
45

compare.js

Comparator functions for you favorite sort-algo
JavaScript
3
star
46

reflux-hoc

Higher-order Component for reflux
JavaScript
3
star
47

if-change-then-notify

Notify me if a certain file changes
JavaScript
3
star
48

set-extra

Elm
3
star
49

pretty-diff

Pretty printing a diff of two values
Haskell
3
star
50

Tetris

A lill tetris developed using raphaeljs
JavaScript
3
star
51

elm-game-of-life

Game of Life in Elm
Elm
3
star
52

expand-object-keys

Expand dotty object keys to objects
JavaScript
3
star
53

underscore.string.cli

String manipulations on the commandline
JavaScript
2
star
54

reassemble-string

๐Ÿญ Reassemble your strings
JavaScript
2
star
55

.dots

๐Ÿก
Shell
2
star
56

css-longhand-cli

CLI for css-longhand
JavaScript
2
star
57

react-compose

Compose react components
2
star
58

burnhub

Burndown chart for github issues
JavaScript
2
star
59

guard-function

๐Ÿ’‚โ€โ™‚๏ธ You shall not pass!
JavaScript
2
star
60

retrieve-arguments

Retrieves the argumentnames of a function
JavaScript
2
star
61

gulp-macros

sweetjs macros for gulp
JavaScript
2
star
62

abclou

PureScript
2
star
63

advent-of-code-2016

my solutions http://adventofcode.com/
Haskell
2
star
64

tmux-tui

TUI to manage tmux sessions ๐Ÿšง
Haskell
2
star
65

SEPS-GRP1

JavaScript
2
star
66

awesome

A curated list of awesome lists
2
star
67

elm-check-updates

JavaScript
1
star
68

nur-packages

Nix
1
star
69

format-string

Format a string, using values from an object.
JavaScript
1
star
70

haskell-simple-quasi-quoter

code for small demo on how to use QuasiQuoter
Haskell
1
star
71

Aoc2021

Haskell
1
star
72

hosts_alias

my first ruby gem
Ruby
1
star
73

use-module

angularjs-style DI for nodemodules
JavaScript
1
star
74

resetable

Elm
1
star
75

reverse-arguments

Reverse the arguments passed to a function.
JavaScript
1
star
76

elm-playground

Elm
1
star
77

bn.js.logo

1
star
78

i18next-playground

JavaScript
1
star
79

stoeffel.github.io

๐Ÿก
CSS
1
star
80

sencha-leaflet

Leaflet component for sencha touch 2
JavaScript
1
star
81

underscore.hasInside

Recursivly searching for a property by name
JavaScript
1
star
82

lan-camp

CSS
1
star
83

rest-param

๐Ÿ’ฌ Returns a function with an appended rest param
JavaScript
1
star
84

array-comprehensions

Functional array comprehension
JavaScript
1
star
85

ydcv

Your Daily Comic Viewer - my first Sencha Touch 2.x approach
JavaScript
1
star
86

gulp-help

Adds a default help task to gulp and provides the ability to add custom help messages to your gulp tasks
JavaScript
1
star
87

react-rxjs-todomvc

TodoMVC implementation with React and RxJS
JavaScript
1
star
88

fparser-cli

a cli for bylexus's fparser
JavaScript
1
star