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
Slide 4
Slide 4 text
–Mark H
“I have people sitting around solutionizing”
Slide 5
Slide 5 text
Examples
• Code
Slide 6
Slide 6 text
–Nick H
“I will admit human error played a large part”
Slide 7
Slide 7 text
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
Slide 8
Slide 8 text
Exception Pattern
• Code
Slide 9
Slide 9 text
Exception Pattern
• type signature doesn’t indicate errors
• exceptions compose without effort
• no stack traces by default
• dealing with exceptions properly is hard
Slide 10
Slide 10 text
EitherT Pattern
• Code
Slide 11
Slide 11 text
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
Slide 12
Slide 12 text
Transformers Either
• Code
Slide 13
Slide 13 text
Either Examples
• mismi - wrapper around Amazonka
• mafia - cabal build tool
• boris - continuous integration / builds
Conclusion
• make error behaviour explicit
• use appropriate tool for the
job
• EitherT yields more
maintainable code
• similar or less effort to
exceptions