Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Functional Programming Patterns
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Robin Palotai
September 18, 2012
Programming
7
480
Functional Programming Patterns
A short enumeration of selected patters occuring in FP.
Robin Palotai
September 18, 2012
Tweet
Share
More Decks by Robin Palotai
See All by Robin Palotai
A subjective on Functional Programming
ron
4
350
SwfControl
ron
0
57
Other Decks in Programming
See All in Programming
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
240
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
600
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
460
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
140
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
120
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
2
380
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.9k
[SF Ruby Feb'26] The Silicon Heel
palkan
0
110
モダンOBSプラグイン開発
umireon
0
140
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
160
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
850
Featured
See All Featured
Everyday Curiosity
cassininazir
0
160
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Code Review Best Practice
trishagee
74
20k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
How GitHub (no longer) Works
holman
316
140k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
240
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
92
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Transcript
Functional Programming Patterns
1st class functions Functions are values too. They have type.
Can be assigned to variables. f: a b → g: (a, b) c → input type output type → multiple arguments
Higher order funs A higher order function is a function
that takes other functions as argument. h: ([a], a b) [b] → → list elem mapper Strategy pattern-like
Currying f: (a, b) c → f: a b c
→ → f: a (b c) → → curried form right-associative Factory pattern-like
Pure Functions Referential transparency – expression replaceable with its value
without changing program semantics. easy to reason about optimizable
Immutability Values are constructed and then never modified. persistent collections
tuples and Lists pair: (a, b) 3-tuple: (a, b, c)
1 :: 2 :: 3 :: Nil [1, [2, [3, []]]] heterogeneous fixed lengthc homogeneous unbounded length
Transform Recursion is low-level flow control. Usages can be abstracted.
Tell what, not how. map, filter, fold
Algebraic Data Types data List a = Cons a (List
a) | Nil data Tree a = Node (Tree a) a (Tree a) | Empty
Functor A functor is a computational context. Map applies a
normal function to a value in a context. map: f a (a b) f b → → → F<A> (A B) F<B> → → → fmap
Monad point: a f a → flatMap: f a (a
f b) f → → → b A context with richer operations. pure, return bind
Option Nulls made explicit. No more NPE. data Option a
= Some a | None orElse: Opt a Opt a Opt a → → getOrElse: Opt a a a → → Monad
Either data Either a b = Left a | Right
b Often used for error handling, where error is on the left, success on the right. Monad for a fixed a
Future Promise / Future is a context, where the contained
computation may execute concurrently. Used to compose async computations without blocking. Monad
Typeclasses A typeclass describes a contract. A typeclass instance describes
how a given data type fulfills that contract. Like an Adapter, but more versatile.
Semigroup Monoid , Semigroup defines addition. Monoid is semigroup with
an identity element. Pops all over your code!
Foldable A foldable provides means for stateful traversal. foldLeft: f
a b (b a b) b → → → → → Nice cooperation with Monoids
Extra stuff Applicative functors, Monad transformers, Relational databases, Linear logic,
IO, DI, Logging, Total FP, Actors, ...
Thx