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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tim McGilchrist
May 24, 2018
Programming
160
0
Share
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
240
Idris States: Dependent types, not just for vectors?
lambda_foo
0
250
RAFT: Implementing Distributed Consensus with Erlang
lambda_foo
4
700
Other Decks in Programming
See All in Programming
Explore CoroutineScope
tomoeng11
0
140
2026-04-15 Spring IO - I Can See Clearly Now
jonatan_ivanov
1
150
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
950
実用!Hono RPC2026
yodaka
2
290
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.4k
【26新卒研修資料】TDD実装演習
dip_tech
PRO
0
150
Making the RBS Parser Faster
soutaro
0
640
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
230
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
330
From Formal Specification to Property Based Test
ohbarye
0
630
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
2
390
AWSコミュニティ活動は顧客のクラウド推進に効くのか / Do AWS community activities help customers adopt the cloud?
seike460
PRO
0
160
Featured
See All Featured
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
110
Writing Fast Ruby
sferik
630
63k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
200
Utilizing Notion as your number one productivity tool
mfonobong
4
300
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
350
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
120
Bash Introduction
62gerente
615
210k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
530
Six Lessons from altMBA
skipperchong
29
4.2k
Done Done
chrislema
186
16k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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