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
Either Error Success
Search
Tim McGilchrist
May 24, 2018
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Either Error Success
Tim McGilchrist
May 24, 2018
More Decks by Tim McGilchrist
See All by Tim McGilchrist
Dependently Typed State Machines
lambda_foo
0
190
Code reuse through polymorphic variants
lambda_foo
1
250
Idris States: Dependent types, not just for vectors?
lambda_foo
0
270
RAFT: Implementing Distributed Consensus with Erlang
lambda_foo
4
700
Other Decks in Programming
See All in Programming
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
170
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
560
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
190
Lessons from Spec-Driven Development
simas
PRO
0
190
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
280
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
230
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
170
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
140
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
2
630
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
550
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
470
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
230
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
250
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
230
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
230
How to Ace a Technical Interview
jacobian
281
24k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Transcript
None
Either Error Success FP-SYD 2018
Introduction • who, what, why, where, how questions • who
-> Tim McGilchrist @lambda_foo • what -> exciting area of error handling • where -> in Haskell mostly • how -> with functions and data types
–Mark H “I have people sitting around solutionizing”
Examples • Code
–Nick H “I will admit human error played a large
part”
The Async Problem • Asynchronous exceptions are a feature of
Haskell • No fancy effect systems or modular IO effects • Deal with it! • Code in IO can fail at any point with an exception
Exception Pattern • Code
Exception Pattern • type signature doesn’t indicate errors • exceptions
compose without effort • no stack traces by default • dealing with exceptions properly is hard
EitherT Pattern • Code
EitherT Pattern • pattern matching has your back • composition
is explicit (you need to think) • application stack traces • constrained exception handling • extra work • interfacing with exception heavy code
Transformers Either • Code
Either Examples • mismi - wrapper around Amazonka • mafia
- cabal build tool • boris - continuous integration / builds
Exception Examples • http-client - http library • stack -
Haskell build tool ++ • hs-tls - Native Haskell TLS / SSL implementation
Conclusion • make error behaviour explicit • use appropriate tool
for the job • EitherT yields more maintainable code • similar or less effort to exceptions
Resources • https://simonmar.github.io/posts/2017-01-24- asynchronous-exceptions.html • https://haskell-lang.org/library/safe-exceptions • https://www.fpcomplete.com/blog/2016/11/exceptions- best-practices-haskell •
https://simonmar.github.io/bib/papers/async.pdf