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
- 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++, ?, ?
Monads
- A word on Haskell Monads and C++, John Wiegley, 2010
- Monads in C++, Bartosz Milewski, 2011
- 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
- Software Transactional Memory in C++: pure functional approach (Tutorial), Alexander Granin, 2018
Papers
- Persistence for the Masses: RRB-Vectors in a Systems Language, Juan Pedro Bolívar Puente
- C++ Monadic interface (Proposal P0650R2), 2018
- Functional Concepts in C++, Rose H. Abdul Rauf, Ulrich Berger, Anton Setzer
- Functional Programming in C++, Brian McNamara, Yannis Smaragdakis
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 Programming: data, Meeting C++, 2017
- Atom Heart Monad: FRP in C++, Curry On!, 2018
-
Juan Pedro Bolívar Puente talks
- Transducers: from Clojure to C++, CppCon, 2015
- Postmodern immutable data structures, CppCon, 2017
- Most valuable values, CppCon, 2018
-
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
-
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++, 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
Quora Questions
Russian Materials
Articles (Rus)
Basics (Rus)
- Функциональное программирование и c++ на практике, Никита Черный aka nikitablack, 2017
- Functional programming in c++ by example (Eng), Никита Черный aka nikitablack, 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)
- 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
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 |
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 |
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
- Eric Niebler
- Isabella Muerte
- Ivan Čukić
- Jason Rice
- Jason Turner
- John Carmack
- John Wiegley
- Jonathan Boccara
- Juan Pedro Bolívar Puente
- Kevlin Henney
- Kiryll Shynharow
- Michał Dominiak
- Nicola Bonelli
- Paul Fultz
- Phil Nash
- Rainer Grimm
- Simon Brand
- Stuart Golodetz
- Sumant Tambe
- Tobias Hermann
- Toby Allsopp
- Wisnu Anggoro
- Никита Черный aka nikitablack
- stepic777
- Владимир aka tangro
- Дмитpий Hecтepук