I\'m trying to better understand how to handle error cases in haskell and made wrote some code to help me with that.
Is there a better way (more elegant, sho
I think the most readable way is the maybe function you already tried, just a little bit prettified by avoiding lambdas (pointfree style) and using maybe even for the innermost check (by replacing if with mfilter):
import Control.Monad(mfilter)
process2 :: MyType -> String
process2 =
maybe "error" $
maybe "error2" $
maybe "error3"
show . mfilter (<10) . Just