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
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
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
240
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
140
Package Management Learnings from Homebrew
mikemcquaid
0
200
Implementation Patterns
denyspoltorak
0
280
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
290
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
120
Vibe codingでおすすめの言語と開発手法
uyuki234
0
220
Fluid Templating in TYPO3 14
s2b
0
130
2026年 エンジニアリング自己学習法
yumechi
0
130
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
590
CSC307 Lecture 08
javiergs
PRO
0
670
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
510
Site-Speed That Sticks
csswizardry
13
1.1k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
110
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
140
GraphQLとの向き合い方2022年版
quramy
50
14k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
Optimising Largest Contentful Paint
csswizardry
37
3.6k
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