Functional Programming License
Services
Functional Programming
Context: frontend-dev-bookmarks / Architecture
Functional programming is a programming paradigm, that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.
-
A Gentle Introduction to Functional JavaScript: A 3 part series, by Derick Bailey featuring Chet Harrison, about functional programming with many examples in JavaScript.
- Monads, Monoids and Composition with Functional JavaScript: Chet Harrison explains monads using form validation as an example.
- Notes and Code from the Crowdcast: Chet Harrison provides a broad overview of functional programming concepts and a step by step tutorial for building Monads.
- The Basics of Functional Programming: In this first episode, you’ll learn the basics of why functional programming, what it is, where it came from and what the core of it is. You’ll see function composition, function purity, currying, higher order functions and first-class functions.
- A Million Ways to Fold in JS: Brian Lonsdorf provides many functional alternatives to loops in this video.
- Adventures in Functional Programming: A talk by Jim Weirich, demonstrating how to use functional programming and lambda calculus to derive Y combinator.
- Allong.es: allong.es is a JavaScript library based on the function combinator and decorator recipes introduced in the book JavaScript Allongé.
- Barely Functional: Tiny (2.7kb) functional programming library using native es5/6 operations.
- Basic Lazy Evaluation and Memoization in JavaScript: Memoization is a way of optimizing code so that it will return cached results for the same inputs.
- Bilby.js: A functional library based on category theory with immutable multimethods, functional data structures, functional operator overloading, automated specification testing.
- Composability: from Callbacks to Categories in ES6: The author borrows some ideas from functional languages to explore a different approach for addressing the callback hell.
- Curry or Partial Application?: Eric Elliott describes the difference between partial application and curry.
- Daggy: Library for creating tagged constructors with catamorphism.
- Date FP: Functional programming date manipulation library.
- Debugging Functional: This post will demonstrate a simple solution that can go a long way to enhance the debugging experience in functional JavaScript applications.
- Deterministic: A weekly digest of interesting news and articles covering functional programming for the web, especially on the front end.
-
Example Projects: Open source projects which use functional programming, preferably point-free and side-effect-free.
- Async Problem: This project considers various approaches to the problem of concurrently reading files inside a directory and concatenating their contents.
- CommonJS module dependencies resolver: The module and all related modules are written using point-free style.
- Egg Hunt Server: A restful API written in FP style.
- Idealist: Functional HTTP micro-framework.
- Sanctuary Build Script: A build script for generating the Sanctuary website.
- FP DOM: A collection of functions to favor functional programming in a DOM context.
- Fantasy Combinators: Combinators which are used for fantasy-land projects.
-
Fantasy Land: Specification for interoperability of common algebraic structures in JavaScript.
- Conformant Implementations: A list of libraries implementing the Fantasy Land specification.
- Fantasy Lenses: Composable, immutable getters and setters.
- Functional Concepts For JavaScript Developers: Currying: Andrew Robbins talks about what currying is and why it’s useful.
- Functional Core Reactive Shell: Giovanni Lodi makes an overview of different architecture meta-patterns and describes his current findings about functional programming and observables as a way to control side effects.
- Functional Frontend Architecture: This repository is meant to document and explore the implementation of what is known as “the Elm architecture”. A simple functional architecture for building frontend applications.
- Functional JavaScript Mini Book: Jichao Ouyang gives and introduction to functional programming with JavaScript and describes some Typeclasses like Functor and Monad.
- Functional Javascript Workshop: The goal of this workshop is to create realistic problems that can be solved using terse, vanilla, idiomatic JavaScript.
- Functional Principles In React: Jessica Kerr talks about four functional principles: Composition, Declarative Style, Isolation and Flow Of Data, and their usage in React.
- Functional Programming Jargon: Jargon from the functional programming world in simple terms.
- Functional Programming for JavaScript People: Chet Corcos explains different features of functional programming like composition, currying, lazy evaluation, referential transparency and compares Clojure with Haskell.
- Functional Refactoring in JavaScript: In this article Victor Savkin shows how to apply functional thinking when refactoring JavaScript code. He does that by taking a simple function and transforming it into a more extendable one, which has no mutable state, and no if statements.
- Functional.js: Functional.js is a functional JavaScript library. It facilitates currying and point-free / tacit programming and this methodology has been adhered to from the ground up.
- Functionize: A collection of functions which aids in making non-functional libraries functional.
- Futures and Monoids: Yassine Elouafi explains the nature of Monoids using Futures, Numbers and Strings as examples.
- Hey Underscore, You’re Doing It Wrong!: In this talk Brian Lonsdorf gently takes a shot at underscore.js for not thinking about currying and partial function application in its library design.
- Immutability, Interactivity & JavaScript: We’ll dive in and see how trees of JavaScript arrays can permit building efficient immutable collections. Then we’ll see how embracing immutable values dramatically simplifies some classic hard problems in client side programming including but not limited to undo, error playback, and online/offline synchronization.
- Immutable Sequence.js: High performance implementation of Immutable Sequence in JavaScript, based on Finger Tree.
- Immutable.js: Immutable persistent data collections for Javascript which increase efficiency and simplicity.
- JSAir – Functional and Immutable Design Patterns in JavaScript: An episode of JavaScript Air about “the how and why of functional programming and immutable design patterns in JavaScript” with Dab Abramov and Brian Lonsdorf as guests.
- JavaScript and Type Thinking: Yassine Elouafi introduces Algebraic Data Types with an example of a simple and a recursive type.
- Javascript Combinators by Reginald Braithwaite: In this talk, we’ll explore functions that consume and return functions, and see how they can be used to build expressive programs that hew closely to JavaScript’s natural style.
- Lamda.js: This library takes all the methods on instances of strings, arrays, objects, numbers, and regexp’s and turns them into functions that can be used in a pointfree way.
- Lenses Quick n’ Dirty: A video by Brian Lonsdorf that introduces lenses.
- Lenses and Virtual DOM Support Open Closed: Hardy Jones explains how Lenses work using a simple example of working with Virtual DOM.
- Lenses.js: Composable kmett style lenses.
- Lodash/fp: The lodash/fp module is an instance of lodash with its methods wrapped to produce immutable auto-curried iteratee-first data-last methods.
- Making your JavaScript Pure: Jack Franklin compares pure and impure functions and describes how to leverage functional programming principles in JavaScript.
-
Monads: Composable computation descriptions. The essence of monad is thus separation of composition timeline from the composed computation’s execution timeline, as well as the ability of computation to implicitly carry extra data.
-
Collections of Monads: Libraries of monad implementations.
- Akh: Akh includes a basic set of common monad transformers, along with monads derived from these transformers. Akh structures implement the Fantasy Land specification.
- Folktale: Folktale is a suite of libraries for generic functional programming in JavaScript that allows you to write elegant modular applications with fewer bugs, and more reuse.
- Monet.js: Monet is a tool bag that assists Functional Programming by providing a rich set of Monads and other useful functions.
<li> <strong>Continuation Monad</strong>: Represents computations in continuation-passing style (CPS). In continuation-passing style function result is not returned, but instead is passed to another function, received as a parameter (continuation).</p> <ul dir="auto"> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://blog.mattbierner.com/the-delimited-continuation-monad-in-javascript/">The Delimited Continuation Monad in Javascript</a></strong>: This post overviews continuations in Atum and covers the implementation of the delimited continuation monad in JavaScript. </li> </ul> </li> <li> <strong>Either Monad</strong>: The Either type represents values with two possibilities: a value of type Either a b is either Left a or Right b. It is often used for error handling.</p> <ul dir="auto"> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://www.npmjs.com/package/lazy-either">Lazy Either</a></strong>: The LazyEither type is used to represent a lazy Either value. It is similar to the Future and Promise types. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://tech.evojam.com/2016/03/21/practical-intro-to-monads-in-javascript-either/">Practical Intro to Monads in JavaScript: Either</a></strong>: Jakub Strojewski describes the Either Monad, a tool for fast-failing, synchronous computation chains. </li> </ul> </li> <li> <strong>Free Monad</strong>: A free monad satisfies all the Monad laws, but does not do any computation. It just builds up a nested series of contexts. The user who creates such a free monadic value is responsible for doing something with those nested contexts.</p> <ul dir="auto"> <li> <strong>Fantasy Frees</strong>: An implementation of Coyoneda, Yoneda, Trampoline, Free Monad and Free Applicative with usage examples. </li> <li> <strong>Free Monad Experiments by Hardy Jones</strong>: Coyoneda, Coproduct, Either, Free, State, AJAX and so on. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://www.youtube.com/watch?v=WH5BrkzGgQY&list=PLK_hdtAJ4KqUWp5LJdLOgkD_8qKW0iAHi&index=1">Free Monads Video Series</a></strong>: A video series on free monads by Brian Lonsdorf explaining Coyoneda, Free Monad and Interpretors. </li> <li> <strong>Freeky</strong>: Collection of free monads by Brian Lonsdorf. </li> </ul> </li> <li> <strong>Futures</strong>: Futures represent the value arising from the success or failure of an asynchronous operation (I/O).</p> <ul dir="auto"> <li> <strong>Fluture</strong>: The debuggable Fantasy Land Future library. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://folktale.origamitower.com/api/v2.1.0/en/folktale.concurrency.task.html">Folktale Task</a></strong>: A structure for time-dependent values, providing explicit effects for delayed computations, latency, etc. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://medium.com/@yelouafi/from-callback-to-future-functor-monad-6c86d9c16cb5">From Callback to Future -> Functor -> Monad</a></strong>: Yassine Elouafi goes through a simple implementation of Futures and compares them to Promises. </li> <li> <strong>Future IO</strong>: A fantasy-land compliant monadic IO library for Node.js. </li> <li> <strong>Futurizer</strong>: Turn callback-style functions or promises into futures! </li> </ul> </li> <li> <strong>Introduction</strong>: Introductory materials about monads.</p> <ul dir="auto"> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://curiosity-driven.org/monads-in-javascript">Monads in JavaScript</a></strong>: This article explains monads and their usage in JavaScript including Identity, Maybe, List, Continuation, Do notation and Chaining. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://tech.evojam.com/2016/02/22/practical-intro-to-monads-in-javascript/">Practical Intro to Monads in JavaScript</a></strong>: A simple, practical tutorial for JavaScript developers showing how some monads can be used. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://igstan.ro/posts/2011-05-02-understanding-monads-with-javascript.html">Understanding Monads With JavaScript</a></strong>: The author starts with a problem of dealing with explicit immutable state and solves it with JavaScript using monads. </li> </ul> </li> <li> <strong>Maybe Monad</strong>: Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error. It is a simple kind of error monad, where all errors are represented by Nothing. A richer error monad can be built using the Either type.</p> <ul dir="auto"> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://sean.voisen.org/blog/2013/10/intro-monads-maybe/">A Gentle Intro to Monads … Maybe?</a></strong>: A short introduction to Maybe and the world of monads. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://robotlolita.me/2013/12/08/a-monad-in-practicality-first-class-failures.html">A Monad in Practicality: First-Class Failures</a></strong>: This article shows how the Maybe monad can be used for handling simple failure use cases. It then extrapolates into complex failure scenarios and shows how these cases can be modelled in terms of the Either monad. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://tech.evojam.com/2016/02/22/practical-intro-to-monads-in-javascript/">Practical Intro to Monads in JavaScript</a></strong>: A simple, practical tutorial for JavaScript developers showing how some monads can be used. </li> </ul> </li> <li> <strong>Reader Monad</strong>: Represents a computation, which can read values from a shared environment, pass values from function to function, and execute sub-computations in a modified environment.</p> <ul dir="auto"> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://passy.svbtle.com/dont-fear-the-reader">Don’t Fear the Reader</a></strong>: Pascal Hartig explains how to use the reader monad in JavaScript. </li> <li> <strong>Fantasy Readers</strong>: Fantasy Land compatible implementation of the Reader Monad. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://www.livecoding.tv/evilsoft/videos/WojoB-functional-js-reader-monad">LiveCoding Video of Reader Monad Implementation</a></strong>: In this video you will learn how to use and implement a Reader from scratch. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://vimeo.com/105300347">Monad a Day: Reader</a></strong>: Short video by Brian Lonsdorf about the Reader Monad. </li> </ul> </li> <li> <strong>Transformers</strong>: Special types that allow us to roll two monads into a single one that shares the behavior of both.</p> <ul dir="auto"> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://akh-js.com/">Akh</a></strong>: Akh includes a basic set of common monad transformers, along with monads derived from these transformers. Akh structures implement the Fantasy Land specification. </li> <li> <strong>Fantasy ArrayT</strong>: Monad transformer for JavaScript Arrays. </li> <li> <strong>Monad Transformers</strong>: Monad transformers are tricky, they require an excessive amount of type juggling. One of the aims of this package is to reduce the amount of wrapping and unwrapping needed for making a new transformer and to provide an easy way to define and combine transformers. </li> <li> <strong>Monad Transformers Library</strong>: Practical monad transformers for JS. </li> </ul> </li> <li> <strong>Validation Monad</strong>: A disjunction that is appropriate for validating inputs and aggregating failures.</p> <ul dir="auto"> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://folktale.origamitower.com/api/v2.1.0/en/folktale.validation.html">Folktale Validation</a></strong>: Validation Monad implementation of Folktale Library. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://tech.evojam.com/2016/04/26/practical-intro-to-monads-in-javascript-validation/">Practical Intro to Monads in JavaScript: Validation</a></strong>: Jakub Strojewski shows how to accumulate errors in a simple Validation use case. </li> </ul> </li> </ul>
-
Collections of Monads: Libraries of monad implementations.
- Mori: A library for using ClojureScript’s persistent data structures and supporting API from the comfort of vanilla JavaScript.
- Mostly Adequate Guide to Functional Programming: A book by Brian Lonsdorf that introduces algebraic functional programming in JavaScript.
- Nanoscope: Nanoscope is a javascript library designed to make complex transformations of data much easier. It is a built on the idea of a functional Lens – a construct that enables focusing on sub-parts of data structures to get and modify.
- Pointfree Fantasy: Point-free wrappers for fantasy-land. Functions are curried using lodash’s curry function, and receive their data last. Gives us aliases with our familar haskell names as well.
- Pointfree Javascript: In this post Lucas Reis presents what is called pointfree style programming and goes through some common scenarios to demonstrate its benefits.
- Practical Functional Programming: Pick Two: James Coglan tries to show in this video how to use functional concepts in daily JavaScript programming.
- Promises + FP = Beautiful Streams: Yassine Elouafi show how to use functional programming and algebraic data types to derive a pure functional definition of reactive programming like streams.
- Pure JavaScript: Christian Johansen shows you how you can up your game by leaving loops behind and embracing functions as the primary unit of abstraction.
- Pure UI: Guillermo Rauch discusses the definition of an application’s UI as a pure function of application state.
- PureScript: PureScript is a strongly, statically typed language which compiles to JavaScript. It is written in and inspired by Haskell.
-
Ramda: A practical library designed specifically for a functional programming style, one that makes it easy to create functional pipelines, one that never mutates user data.
- Practical Ramda – Functional Programming Examples: Tom MacWright gives some practical examples of Ramda usage.
- Ramda Fantasy: Fantasy Land compatible types for easy integration with Ramda. This is an experimental project and will probably merge with Sanctuary.
-
Sanctuary: Sanctuary is a functional programming library inspired by Haskell and PureScript. It depends on and works nicely with Ramda. Sanctuary makes it possible to write safe code without null checks.
- Sanctuary Build Script: A build script for generating the Sanctuary website.
- The Little Idea of Functional Programming: Jack Hsu tries to take a look at a couple of simple concepts that make up the little idea behind functional programming and to tie the concepts back to code examples in JavaScript.
- Timm: Immutability helpers with fast reads and acceptable writes.
-
Transducers: Transducers are a powerful and composable way to build algorithmic transformations that you can reuse in many contexts.
- “Transducers” Presentation at Strange Loop: This talk will describe transducers, a new library feature for Clojure (but of interest to other languages) that emphasizes composable, context-free, intermediate-free notions like ‘mapping’ and ‘filtering’ and their concrete reuse across all of the contexts above.
- Figuring out what transducers are good for: Tim Cuthbertson attempts some plausible but detailed examples with Transducers in JavaScript.
-
Implementations: Libraries that implement Transducer protocoll and include ready to use transformers.
- Transduce: Implementation by Kevin Beaty extracted from underarm.
- Transducers-js by Cognitect Labs: A high performance Transducers implementation for JavaScript by Cognitect Labs.
-
Transducers.js Library by James Long: A small library for generalized transformation of data (inspired by Clojure’s transducers)
- Transducers.js Round 2 with Benchmarks: Refactored version of Transducers.js, some benchmarks, Laziness, the transformer protocoll.
- Transducers.js: A JavaScript Library for Transformation of Data: A post announcing the transducers.js library with some explanation.
<li> <strong><a rel="nofollow noopener" target="_blank" href="http://simplectic.com/blog/2015/ramda-transducers-logs/">Streaming Logs with Transducers and Ramda</a></strong>: In this article we will use Ramda to parse a log file without curly braces (and introduce transducers along the way). </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://clojure.org/reference/transducers">Transducers Documentation for Clojure</a></strong>: Transducers are composable algorithmic transformations. They are independent from the context of their input and output sources and specify only the essence of the transformation in terms of an individual element. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://simplectic.com/blog/2014/transducers-explained-1/">Transducers Explained: Part 1</a></strong>: An introduction to transducers using JavaScript. We will work from reducing over arrays, to defining transformations as transformers, then incrementally introducing transducers and using them with transduce. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://simplectic.com/blog/2014/transducers-explained-pipelines/">Transducers Explained: Pipelines</a></strong>: In this article, we will introduce four new transducers: filter, remove, drop and take. We will show how transducers can be composed into pipelines and talk about the order of transformation. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming">Transducers are Coming</a></strong>: The first announcement by Rich Hickey. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://xgrommx.github.io/rx-book/content/getting_started_with_rxjs/creating_and_querying_observable_sequences/transducers.html">Transducers with Observable Sequences</a></strong>: A chapter from the RxJS Book describing Transducers. </li> <li> <strong><a rel="nofollow noopener" target="_blank" href="https://medium.com/@roman01la/understanding-transducers-in-javascript-3500d3bd9624#.3lbq6d4yq">Understanding Transducers in JavaScript</a></strong>: Roman Liutikov translated code examples from similar Clojure article into JavaScript. So you can still read the article and check code examples here. </li> </ul>
- Union Type: Union types are a way to group different values together. Union-type is a small JavaScript library for defining and using union types.
License
This work is licensed under a Creative Commons Attribution 4.0 International License.
Please provide a link back to this repository. This is not necessary for GitHub forks.