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
Pipes by Example
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Nick Partridge
May 09, 2014
Programming
1
180
Pipes by Example
Presented to YOW! Lambda Jam 2014.
Nick Partridge
May 09, 2014
Tweet
Share
Other Decks in Programming
See All in Programming
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.1k
文字コードの話
qnighy
44
17k
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
110
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
270
20260315 AWSなんもわからん🥲
chiilog
1
120
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
260
株式会社 Sun terras カンパニーデック
sunterras
0
2.1k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
440
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
160
Claude Code Skill入門
mayahoney
0
300
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
370
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1k
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.6k
Done Done
chrislema
186
16k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
700
The Curious Case for Waylosing
cassininazir
0
270
How STYLIGHT went responsive
nonsquared
100
6k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
250
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
Technical Leadership for Architectural Decision Making
baasie
3
290
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
210
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
970
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
Pipes by Example Nick Partridge. nkpart on most things.
Why Pipes Because you’re writing a web server, of course.
Not just for streaming! produce :: m a consume ::
a -> m ()
Pipe Types Lead, PVC, etc.
Producers Consumers + Pipes Proxy a a’ b b’ m
c
Pipe a b m r a b m On exhaustion:
r Proxy () a () b m r
Producer b m r _ b m On exhaustion: r
Proxy X () () b m r
Consumer a m r a _ m On exhaustion: r
Proxy () a () X m r
The Primitives Because live coding always works.
Use the Monad Running producers sequentially is just >> When
pipes/consumers/producers/finish, they return a value Control.Monad and friends are very useful.
Elimination Finally some Category Theory.
Pipe a b m r a b m On exhaustion:
r
Effect m r m On exhaustion: r _ _ Proxy
X () () X m r
Substitution Producers: for or ~> eliminates yield Consumer side: >~
eliminates await
Elimination - Loop Bodies for generator body ! for x
yield == x for (yield x) f == f x
Companion Libraries Where the features are hiding.
Companion Libraries pipes-parse pipes-safe pipes-group
1. Pipes Parse type Parser a m r = forall
x. StateT (Producer a m x) m r Provides ‘push-back’. You can modify the underlying producer to return a value again.
2. Pipes Safe ReaderT (IORef (Finalizers m)) m r Resource
management, exception safety, through a monad transformer on m that allows registering Finalizers.
3. Pipes Group FreeT (Producer a m) m x Working
on sub-streams in constant memory. a ‘linked-list’ of sub-stream producers, each one returning the next sub-stream on exhaustion
return () :: Effect Talk ()
References Pipes haddocks - Pipes, Pipes.Prelude, Pipes.Tutorial Haskell for All
- Gabriel Gonzales’ blog Haskell Pipes Google Group “pipes-“ seach on hackage