Awesome
Functional Programming in C++
List of materials and links about functional programming in C++.
English Materials
Books
- Functional Programming in C++, Ivan Čukić, Manning Publications, 2018
- Learning C++ Functional Programming, Wisnu Anggoro
- Functional Programming with C++, Chris Weed
Articles
Basics
- Functional Programming Using C++ Templates (Part 1), Stuart Golodetz, 2007
- Functional Programming Using C++ Templates (Part 2), Stuart Golodetz, 2007
- What Does Haskell Have to Do with C++?, Bartosz Milewski, 2009
- In-depth: Functional programming in C++, John Carmack, 2012
- Efficient Pure Functional Programming in C++ Using Move Semantics, Anders Schau Knatten, 2012
- The connection between C++ template metaprogramming and functional programming, Abel Sinkovics, 2013
- Functional Data Structures in C++: Lists, Bartosz Milewski, 2013
- Functional Data Structures and Concurrency in C++, Bartosz Milewski, 2013
- Study Notes: Functional Programming with C++, Yongwei, 2014
- Functional programming in C++, Madhukar, 2014
- Make your functions functional, Jonathan Boccara, 2016
- C++ is a Dynamic, Pure, Functional Programming Language, brosenan, 2016
- An Overview of Elements of Functional Programming in C++, Kiryll Shynharow, 2017
- Functional programming in c++ by example, nikitablack, 2017
- Functional programming in c++ by example (Rus), nikitablack, 2017
- Functional in C++17 and C++20, Rainer Grimm, 2017
- Lambdas: The Functional Programming Companion of Modern C++, Daksh, 2018
- Functional Programming in C++, MehreenTahir, 2018
- Introduction to Functional programming in C++, ?, ?
- Lambda-style anonymous functions for C++ in less than 500 lines of code, Matthew Might, ?
- 8 essential patterns you should know about functional programming in C++14, Nala Ginrut, 2019
Monads
- A word on Haskell Monads and C++, John Wiegley, 2010
- Monads in C++, Bartosz Milewski, 2011
- Monadic parsing in C++, Scott Prager, 2012
- An Attempt to Explain Monads in C++, Isabella Muerte, 2014
- Optional Types and Lightweight Continuation Passing in C++, Isabella Muerte, 2014
- Monads in C++, Rainer Grimm, 2017
- The Vector Monad in C++, Without the Ugly Stuff, Jonathan Boccara, 2017
- The Vector Monad in C++, Really Without the Ugly Stuff, Barry Revzin, 2017
- Multiple error handling with the optional monad in C++, Jonathan Boccara, 2017
- Free Monads in C++, Toby Allsopp, 2016
- An Introduction to Monads for C++ Programmers, ShellBlade
Design Concepts and Approaches
- compile-time iteration with C++20 lambdas, Vittorio Romeo, 2018
- Software Transactional Memory in C++: pure functional approach (Tutorial), Alexander Granin, 2018
Papers
- Lambda expressions and closures for C++, Jeremiah Willcock, Jaakko Järvi, John Freeman, Bjarne Stroustrup, 2006
- C++ lambda expressions and closures, Jaakko Järvi, John Freeman, 2008
- Functional Style in C++: Closures, Late Binding, and Lambda Abstractions, ?, 1999
- A proposal to add lambda functions to the C++ standard, Valentin Samko, 2006
- Persistence for the Masses: RRB-Vectors in a Systems Language, Juan Pedro Bolívar Puente
- Constexpr Lambda, 2015
- C++ Monadic interface (Proposal P0650R2), Vicente J. Botet Escribá, 2018
- Functional Concepts in C++, Rose H. Abdul Rauf, Ulrich Berger, Anton Setzer
- Functional Programming in C++, Brian McNamara, Yannis Smaragdakis
- Abbreviated Lambdas for Fun and Profit, 2017
Blogs
- Functional C++. Abusing the type system like never before. (Blog), ?
- Function Traits, 2013
- Function Composition, 2013
- Continuation Passing Style, 2013
- Composing Continuations, 2015
- And more...
- C++ Truths (Blog), Sumant Tambe
- Understanding Fold Expressions, 2016
- Folding Functions, 2016
- Dependently-typed Curried printf in C++, 2016
- Folding Monadic Functions, 2017
- And more...
Talks and Screencasts
Talks
-
Bartosz Milewski talks
- Functional Patterns in C++, 1. Functors, 2012
- Functional Patterns in C++, 2. Currying, Applicative, 2012
- Functional Patterns in C++, 3. Async API, Monoid, Monad, 2012
- Compile-Time/Run-Time Functional Programming in C++, Bartosz Milewski, Eric Niebler, BoostCon, 2012
- Haskell -- The Pseudocode Language for C++ Template Metaprogramming (Part 1), BoostCon, 2013
- Haskell -- The Pseudocode Language for C++ Template Metaprogramming (Part 2), BoostCon, 2013
- Re-discovering monads in C++, C++ User Group Novosibirsk, 2014
- Functional techniques in C++, CDays14, 2014
- Categories for the Working C++ Programmer, C++ Russia, 2015
- Monads for C++, itCppCon17, 2017
-
Eric Niebler talks
- Compile-Time/Run-Time Functional Programming in C++, Bartosz Milewski, Eric Niebler, BoostCon, 2012
- Ranges for the Standard Library, CppCon, 2015
- Ranges for the Standard Library, C++ Siberia, 2015
- Keynote: Ranges for the Standard Library, C++Now, 2015
- STL Concepts and Ranges, Northwest C++ Users Group, 2015
- Introducing the Ranges TS, code::dive, 2017
-
Ivan Čukić talks
- Functional reactive programming in C++, Meeting C++, 2016
- Functional Programming: data, Meeting C++, 2017
- Atom Heart Monad: FRP in C++ (Keynote), C++ Siberia, 2017
- Atom Heart Monad: FRP in C++, Curry On!, 2018
- New C++ features for writing DSLs, C++ Siberia, 2019
-
Juan Pedro Bolívar Puente talks
- Transducers: from Clojure to C++, CppCon, 2015
- Postmodern immutable data structures, CppCon, 2017
- Postmodern immutable data structures, C++Now, 2017
- Most valuable values, CppCon, 2018
- Squaring the circle: value oriented design in an object oriented system, C++ Russia Piter, 2019
-
Phil Nash talks
- Functional C++ for Fun and Profit, Phil Nash, St. Petersburg C++ User Group, 2016
- What Could Possibly Go Wrong?: A Tale of Expectations and Exceptions, Simon Brand, Phil Nash, CppCon, 2018
-
David Sankel talks
- Functional Programming in C++, BoostCon, 2013
- Intro to Functional Programming, C++ Now, 2014
- Functional Design Explained, CppCon, 2015
- The Mathematical Underpinnings of Promises in C++, BoostCon, 2017
-
Practical Functional Programming in C++, Bryce Adelstein-Lelbach, CppCon, 2014
-
Applying functional programming in code design, Michał Dominiak, CppCon, 2015
-
Functional Programming in C++, Nicola Gigante, Meeting C++ 2015
-
Functional programming: functors and monads, Michał Dominiak, CppCon, 2015
-
Goodbye metaprogramming, and hello functional, Paul Fultz, 2016
-
Functional C++, Kevlin Henney, BUILD STUFF, 2017
-
Functional Programming Tools in C++, Sumant Tambe, SF Bay Area ACCU, 2017
-
constexpr ALL the Things! (Combinatorial parsers), Ben Deane, Jason Turner, CppCon, 2017
-
What Could Possibly Go Wrong?: A Tale of Expectations and Exceptions, Simon Brand, Phil Nash, CppCon, 2018
-
Generalized Full Duplex Messaging, Jason Rice, C++ Now, 2018
Screencasts
- Learning Modern C++ Functional Programming: Understand Essential Part, Packt Video, 2018
- Functional Programming in C++ Using Lambda Expressions, CodesBay, 2018
Cources
- Functional Programming using C++ (1/27) - Introducing functional programming, Tobias Hermann, 2017
- Functional Programming using C++ (2/27) - Correctness follows from expressiveness, Tobias Hermann, 2017
QA
StackOverflow Questions
- Functional Programming in C++
- What can C++ offer as far as functional programming?
- Monad interface in C++
- C++ Design: Functional Programming vs OOP
- Persistent data structures in c++
Quora Questions
Russian Materials
Articles (Rus)
Basics (Rus)
- Функциональное программирование и c++ на практике, Никита Черный aka nikitablack, 2017
- Functional programming in c++ by example (Eng), Никита Черный aka nikitablack, 2017
- Каррирование и частичное применение на C++14 (Currying and partial application in C++14), Матвей Черевко, 2017
Monads (Rus)
- Монады и do-нотация в C++ (Monads and do-notation in C++), stepic777, 2013
- Использование монад в С++. Часть 1: монада списка (Using monads in C++. Part 1: The List monad), Владимир aka tangro, 2015
- Монада Maybe на языке C++ (The Maybe monad in C++), Дмитpий Hecтepук, 2015
Design Concepts and Approaches (Rus)
Talks and Screencasts (Rus)
Talks (Rus)
-
Эволюция метапрограммирования: как правильно работать со списками типов, Олег Фатхиев, C++ Siberia 2019
-
Элементы функционального программирования в современном С++, Павел Кретов, DataArt Online
-
Alexander Granin talks
- Функциональный и декларативный дизайн на С++ (Functional and Declarative Design in C++), C++ User Group Novosibirsk, 2014
- Функциональный микроскоп: линзы в С++ (Functional Microscope: Lenses in C++), C++ Siberia, 2015
- Функциональная "Игра Жизнь": параллельные клеточные автоматы и комонады в С++ (Functional 'Game of Life': Parallel Cellular Automata and Comonads in C++), C++ Russia, 2016
- Функциональный подход к Software Transactional Memory в С++ (Pure Functional Approach to Software Transactional Memory in C++), C++ Russia, 2018
- Настоящее и будущее функционального программирования на C++ (The Present and The Future of Functional Programming in C++), Keynote, C++ Siberia 2019
- Монадические парсеры (Monadic Parsers), C++ Russia 2019 Moscow
Projects
Libraries
Library | Description | Author |
---|---|---|
Boost.Hana | Boost.Hana is a library with concepts borrowed from category theory | ? |
optional | C++11/14/17 std::optional with functional-style extensions and reference support | Simon Brand |
expected | C++11/14/17 std::expected with functional-style extensions | Simon Brand |
FTL | C++ template library for fans of functional programming | beark |
LIBF++ | C++ as a Pure Functional Programming Language | GJDuck |
Immer | Postmodern immutable and persistent data structures for C++ | Juan Pedro Bolívar Puente |
Lager | Library for functional interactive C++ programs // Redux for C++ | Juan Pedro Bolívar Puente |
cpp_stm_free | Composable monadic STM for C++ on Free monads | Alexander Granin |
Cat | Cat: C++14/17 functional library | Nicola Bonelli |
neither | A functional implementation of Either in C++14. | LoopPerfect |
FunctionalPlus | Functional Programming Library for C++. Write concise and readable C++ code. | Tobias Hermann |
Immutable++ | Persistent immutable data structures providing practically O(1) for appends, updates and lookups based on work by Rich Hickey and by consequence Phil Bagwell. | Rasmus Andersson |
Okasaki | Functional data structures in C++ | Bartosz Milewski |
Asyncro | Monadic Futures | Dennis Kormalev |
Cefal | (Concepts-enabled) Functional Abstraction Layer for C++ | Dennis Kormalev |
Showcase Projects
Project | Description | Author |
---|---|---|
Ewig | A mini-emacs built using C++ in a functional way, using the Redux architecture. Supports efficiently editing huge file and concurrent loading/saving | Juan Pedro Bolívar Puente |
Amber | The 'Amber' game project demonstranting functional and declarative design in C++. | Alexander Granin |
cpp_lenses | Functional lenses demo in C++ | Alexander Granin |
CMLife | Functional Game of Life in C++. Based on functional declarative design and functional idioms (comonads, zippers etc.) | Alexander Granin |
coroutine_monad | Using coroutines for monadic composition | Toby Allsopp |
Monadic parsing in C++ | Monadic parsers | Scott Prager |
monad_do | Emulation of DO syntax sugar for monads in C++ | Evgeny Panasyuk |
kari.hpp | Experimental library for currying in C++14 | Matvey Cherevko |
Lambda.cpp | Lambdas PoC implementation | Matthew Might |
Knuth's arrow notation | Implemented in two variants: constexpr functions and templates | Alexander Granin |
Constexpr monadic parsers ("Constexpr all the things") | See also the talk "Constexpr all the things". | Ben Deane, Jason Turner |
cpp_parsec_free | Monadic parsers (based on Free monads) | Alexander Granin |
Misc
C++ FP Experts
The list of authors of the materials presented here, listed alphabetically. (Some authors can be missing by occasion).
Please, pm me if you don't want to be in this list. Or if you want to be there.
- Abel Sinkovics
- Alexander Granin
- Anders Schau Knatten
- Barry Revzin
- Bartosz Milewski
- Ben Deane
- Brian McNamara
- Bryce Adelstein-Lelbach
- Chris Weed
- David Sankel
- Dennis Kormalev
- Eric Niebler
- Evgeny Panasyuk
- Isabella Muerte
- Ivan Čukić
- Jason Rice
- Jason Turner
- John Carmack
- John Wiegley
- Jonathan Boccara
- Juan Pedro Bolívar Puente
- Kevlin Henney
- Kiryll Shynharow
- Matthew Might
- Michał Dominiak
- Nala Ginrut
- Nicola Gigante
- Nicola Bonelli
- Paul Fultz
- Phil Nash
- Rainer Grimm
- Rasmus Andersson
- Scott Prager
- Simon Brand
- Stuart Golodetz
- Sumant Tambe
- Tobias Hermann
- Toby Allsopp
- Vicente J. Botet Escribá
- Vittorio Romeo
- Wisnu Anggoro
- Никита Черный aka nikitablack
- stepic777
- Олег Фатхиев
- Павел Кретов
- Владимир aka tangro
- Дмитpий Hecтepук
- Матвей Черевко aka BlackMATov