$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Either Error Success
Search
Tim McGilchrist
May 24, 2018
Programming
0
150
Either Error Success
Tim McGilchrist
May 24, 2018
Tweet
Share
More Decks by Tim McGilchrist
See All by Tim McGilchrist
Dependently Typed State Machines
lambda_foo
0
180
Code reuse through polymorphic variants
lambda_foo
1
220
Idris States: Dependent types, not just for vectors?
lambda_foo
0
230
RAFT: Implementing Distributed Consensus with Erlang
lambda_foo
4
690
Other Decks in Programming
See All in Programming
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.3k
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
200
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
180
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
740
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
110
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
130
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
tparseでgo testの出力を見やすくする
utgwkk
2
260
Cell-Based Architecture
larchanjo
0
140
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.3k
Python札幌 LT資料
t3tra
6
980
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
0
170
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
60
37k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
860
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Producing Creativity
orderedlist
PRO
348
40k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
140
Agile that works and the tools we love
rasmusluckow
331
21k
Facilitating Awesome Meetings
lara
57
6.7k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
400
Test your architecture with Archunit
thirion
1
2.1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
2
3.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
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