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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Nick Partridge
May 09, 2014
Programming
180
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Pipes by Example
Presented to YOW! Lambda Jam 2014.
Nick Partridge
May 09, 2014
Other Decks in Programming
See All in Programming
Creating Composable Callables in Contemporary C++
rollbear
0
130
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
130
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
160
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.1k
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
160
New "Type" system on PicoRuby
pocke
1
930
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6k
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.6k
RTSPクライアントを自作してみた話
simotin13
0
610
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
240
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
Oxlintのカスタムルールの現況
syumai
6
1.1k
Featured
See All Featured
Optimizing for Happiness
mojombo
378
71k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
210
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
230
Building the Perfect Custom Keyboard
takai
2
790
WENDY [Excerpt]
tessaabrams
11
38k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
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