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
Robin Palotai
September 18, 2012
Programming
490
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Functional Programming Patterns
A short enumeration of selected patters occuring in FP.
Robin Palotai
September 18, 2012
More Decks by Robin Palotai
See All by Robin Palotai
A subjective on Functional Programming
ron
4
360
SwfControl
ron
0
67
Other Decks in Programming
See All in Programming
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
470
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
540
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
660
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.5k
Lessons from Spec-Driven Development
simas
PRO
0
190
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
110
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
130
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
10
4k
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
230
Claspは野良GASの夢をみるか
takter00
0
190
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
300
Featured
See All Featured
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
320
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
610
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
480
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
580
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
160
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