4 ms·
> I miss early return dearly, and understand why it isn’t a thing (except if you have a MonadZero at hand) but I know it’s a syntactic transformation that won’t
by runeks 3y ago
> I miss early return dearly, and understand why it isn’t a thing (except if you have a MonadZero at hand) but I know it’s a syntactic transformation that won’t make it in.
Early return is mandatory for readability sometimes. I suggest using ExceptT for this: https://www.stackage.org/haddock/lts-21.8/mtl-2.2.2/Control-Monad-Except.html#t:ExceptT https://www.stackage.org/haddock/lts-21.8/mtl-2.2.2/Control-....
You don’t even have to expose ExceptT in your interface; you can just use it internally for early return and have your function return an Either.