Skip to content

Minimal, readable implementations of core FP concepts in Python.

Notifications You must be signed in to change notification settings

NisonChrist/functional-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

functional-python

A small, practical playground for learning functional programming concepts in Python through concise examples and incremental exercises.

Why this repo?

Functional programming (FP) can feel abstract when presented only as theory or toy examples. This repository focuses on small, concrete, and reusable patterns that you can apply in real projects. The goal is to show how FP ideas improve code clarity, safety, and composability—without requiring a new language.

Goals

  • Provide minimal, readable implementations of core FP concepts in Python.
  • Explain why and when each concept is useful.
  • Offer hands-on examples you can run and modify quickly.
  • Keep the code small enough to study in one sitting.

What’s inside

Current modules:

  • functor.py — a basic Functor with map
  • maybe.py — a Maybe type to represent optional values safely
  • either.py — an Either type for success/error-style modeling

Each module includes a small main() demonstrating usage.

Requirements

  • Python 3.12.10+

Suggested learning path

  1. Functor — Learn how map applies a transformation without changing the container.
  2. Maybe — Avoid None checks scattered across your code.
  3. Either — Model success/failure explicitly without exceptions.

About

Minimal, readable implementations of core FP concepts in Python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages