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
170
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
200
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
230
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
360
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.8k
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
260
AIエージェントで 変わるAndroid開発環境
takahirom
1
380
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
230
Vite+ Unified Toolchain for the Web
naokihaba
0
590
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
190
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
210
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
1
190
霧の中の代数的エフェクト
funnyycat
1
170
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
250
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
141
7.6k
Optimizing for Happiness
mojombo
378
71k
Chasing Engaging Ingredients in Design
codingconduct
0
230
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
330
Six Lessons from altMBA
skipperchong
29
4.3k
How to Ace a Technical Interview
jacobian
281
24k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
410
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.7k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
180
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
180
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