
30 Nov
2015
30 Nov
'15
5:40 p.m.
On Mon, Nov 30, 2015 at 02:25:49PM -0800, Jeffrey Brown wrote:
I've written a monadic function which in a Maybe context produces a Nothing when it fails (as intended), but in an Either context produces an Exception rather than a Left.
The Maybe instance for Monad overrides fail to be Nothing, but Either instance does not. The default definition for fail is error. The Except type has the behavior you are looking for, I believe — but you may be better off avoiding the use of fail to begin with. :) Except/ExceptT: http://haddock.stackage.org/lts-3.16/transformers-0.4.2.0/Control-Monad-Tran... Also recommended for all your error-ful needs: http://haddock.stackage.org/lts-3.16/errors-2.0.1/Control-Error.html