The following guide serves as an excellent learning roadmap for functional programming. It can be used to track our level of knowledge regarding functional programming. This guide was developed for the Fantasyland institute of learning for the LambdaConf conference. It was designed for statically-typed functional programming languages that implement category theory.
This post is extracted from the book Hands-On Functional Programming with TypeScript by Remo H. Jansen. In this book, you will understand the pros, cons, and core principles of functional programming in TypeScript.
This roadmap talks about five levels of difficulty: Beginner, Advanced Beginner, Intermediate, Proficient, and Expert.
Languages such as Haskell support category theory natively, but, we can take advantage of category theory in TypeScript by implementing it or using some third-party libraries. Not all the items in the list are 100% applicable to TypeScript due to language differences, but most of them are 100% applicable.
Beginner
To reach the beginner level, you will need to master the following concepts and skills:
CONCEPTS |
SKILLS |
- Immutable data
- Second-order functions
- Constructing and destructuring
- Function composition
- First-class functions and lambdas
|
- Use second-order functions (map, filter, fold) on immutable data structures
- Destructure values to access their components
- Use data types to represent optionality
- Read basic type signatures
- Pass lambdas to second-order functions
|
Advanced beginner
To reach the advanced beginner level, you will need to master the following concepts and skills:
CONCEPTS |
SKILLS |
- Algebraic data types
- Pattern matching
- Parametric polymorphism
- General recursion
- Type classes, instances, and laws
- Lower-order abstractions (equal, semigroup, monoid, and so on)
- Referential transparency and totality
- Higher-order functions
- Partial application, currying, and point-free style
|
- Solve problems without nulls, exceptions, or type casts
- Process and transform recursive data structures using recursion
- Able to use functional programming in the small
- Write basic monadic code for a concrete monad
- Create type class instances for custom data types
- Model a business domain with abstract data types (ADTs)
- Write functions that take and return functions
- Reliably identify and isolate pure code from an impure code
- Avoid introducing unnecessary lambdas and named parameters
|
Intermediate
To reach the intermediate level, you will need to master the following concepts and skills:
CONCEPTS |
SKILLS |
- Generalized algebraic data type
- Higher-kinded types
- Rank-N types
- Folds and unfolds
- Higher-order abstractions (category, functor, monad)
- Basic optics
- Implement efficient persistent data structures
- Existential types
- Embedded DSLs using combinators
|
- Able to implement large functional programming applications
- Test code using generators and properties
- Write imperative code in a purely functional way through monads
- Use popular purely functional libraries to solve business problems
- Separate decision from effects
- Write a simple custom lawful monad
- Write production medium-sized projects
- Use lenses and prisms to manipulate data
- Simplify types by hiding irrelevant data with existential
|
Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at $19.99/month. Cancel anytime
Proficient
To reach the proficient level, you will need to master the following concepts and skills:
CONCEPTS |
SKILLS |
- Codata
- (Co)recursion schemes
- Advanced optics
- Dual abstractions (comonad)
- Monad transformers
- Free monads and extensible effects
- Functional architecture
- Advanced functors (exponential, profunctors, contravariant)
- Embedded domain-specific languages (DSLs) using generalized algebraic datatypes (GADTs)
- Advanced monads (continuation, logic)
- Type families, functional dependencies (FDs)
|
- Design a minimally powerful monad transformer stack
- Write concurrent and streaming programs
- Use purely functional mocking in tests.
- Use type classes to modularly model different effects
- Recognize type patterns and abstract over them
- Use functional libraries in novel ways
- Use optics to manipulate state
- Write custom lawful monad transformers
- Use free monads/extensible effects to separate concerns
- Encode invariants at the type level.
- Effectively use FDs/type families to create safer code
|
Expert
To reach the expert level, you will need to master the following concepts and skills:
CONCEPTS
|
SKILLS |
- High performance
- Kind polymorphism
- Generic programming
- Type-level programming
- Dependent-types, singleton types
- Category theory
- Graph reduction
- Higher-order abstract syntax
- Compiler design for functional languages
- Profunctor optics
|
- Design a generic, lawful library with broad appeal
- Prove properties manually using equational reasoning
- Design and implement a new functional programming language
- Create novel abstractions with laws
- Write distributed systems with certain guarantees
- Use proof systems to formally prove properties of code
- Create libraries that do not permit invalid states.
- Use dependent typing to prove more properties at compile time
- Understand deep relationships between different concepts
- Profile, debug, and optimize purely functional code with minimal sacrifices
|
Summary
This guide should be a good resource to guide you in your future functional-programming learning efforts. Read more on this in our book Hands-On Functional Programming with TypeScript.
What makes functional programming a viable choice for artificial intelligence projects?
Why functional programming in Python matters: Interview with best selling author, Steven Lott
Introducing Coconut for making functional programming in Python simpler