Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Either Error Success
Search
Tim McGilchrist
May 24, 2018
Programming
180
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
210
Code reuse through polymorphic variants
lambda_foo
1
260
Idris States: Dependent types, not just for vectors?
lambda_foo
0
290
RAFT: Implementing Distributed Consensus with Erlang
lambda_foo
4
720
Other Decks in Programming
See All in Programming
速習iPhone Duo対応
yuukiw00w
2
980
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
580
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
110
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
Workers Cache を知る
syumai
0
350
プロダクトコードからライブラリの境界を見つける
elmetal
PRO
0
110
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
380
JRuby: Past, Present, and Future
headius
0
230
APNsからLive Activityを開始する話
yumnumm
0
160
golang-bob.pdf
iwatsukayura
0
130
ジョジョの世界をXRで再現する
mofurune
0
150
残高管理から台帳サービスへの進化
artoy
1
190
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Six Lessons from altMBA
skipperchong
29
4.5k
30 Presentation Tips
portentint
PRO
1
430
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Amusing Abliteration
ianozsvald
1
340
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
New Earth Scene 8
popppiees
4
2.7k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
730
The Limits of Empathy - UXLibs8
cassininazir
2
720
We Are The Robots
honzajavorek
0
400
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
540
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